creates a copy of the menu item chosen, with the ID changed to newId
@param selected the item to copy
@param newId the ID for the copy
@return the newly created item
516958
public static MenuItem createFromExistingWithId(MenuItem selected, int newId) {
        return visitWithResult(selected, new AbstractMenuItemVisitor<MenuItem>() {
            @Override
            public void visit(AnalogMenuItem item) {
                setResult(AnalogMenuItemBuilder.anAnalogMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }

            @Override
            public void visit(BooleanMenuItem item) {
                setResult(BooleanMenuItemBuilder.aBooleanMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }

            @Override
            public void visit(EnumMenuItem item) {
                setResult(EnumMenuItemBuilder.anEnumMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }

            @Override
            public void visit(SubMenuItem item) {
                setResult(SubMenuItemBuilder.aSubMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }

            @Override
            public void visit(TextMenuItem item) {
                setResult(TextMenuItemBuilder.aTextMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }

            @Override
            public void visit(RemoteMenuItem item) {
                setResult(RemoteMenuItemBuilder.aRemoteMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }

            @Override
            public void visit(FloatMenuItem item) {
                setResult(FloatMenuItemBuilder.aFloatMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }
            @Override
            public void visit(ActionMenuItem item) {
                setResult(ActionMenuItemBuilder.anActionMenuItemBuilder()
                        .withExisting(item)
                        .withId(newId)
                        .menuItem()
                );
            }
        }).orElse(null);
    }
1043320
@SuppressWarnings("unchecked")
    public static <T> Id<T> newId(final Class<T> type) {
        return (Id<T>) newId((Type) type);
    }
1235226
public static JsonArrayDocument create(String id, JsonArray content) {
        return new JsonArrayDocument(id, 0, content, 0, null);
    }
518845
public function changePositionAction($pageId, $menuName, $newPosition)
    {
        if ($this->getRequest()->isXmlHttpRequest())
        {
            $pageMenuRepo = $this->getDoctrine()->getRepository('FulgurioLightCMSBundle:PageMenu');
            $pageMenu = $pageMenuRepo->findOneBy(array('page' => $pageId, 'label' => $menuName));
            if ($pageMenu)
            {
                if ($newPosition == $pageMenu->getPosition())
                {
                    // No change
                }
                else if ($newPosition > $pageMenu->getPosition())
                {
                    if ($newPosition <= $pageMenuRepo->getLastMenuPosition($pageMenu->getLabel()))
                    {
                        // Down !
                        $pageMenuRepo->upMenuPagesPosition($pageMenu->getLabel(), $pageMenu->getPosition() + 1, $newPosition);
                        $pageMenu->setPosition($newPosition);
                        $em = $this->getDoctrine()->getManager();
                        $em->persist($pageMenu);
                        $em->flush();
                    }
                }
                else if ($pageMenu->getPosition() > 1)
                {
                    // Up !
                    $pageMenuRepo->downMenuPagesPosition($pageMenu->getLabel(), $newPosition, $pageMenu->getPosition());
                    $pageMenu->setPosition($newPosition);
                    $em = $this->getDoctrine()->getManager();
                    $em->persist($pageMenu);
                    $em->flush();
                }
                else {
                    // doesn t happen
                }
            }
            return new Response();
        }
        throw new AccessDeniedException();
    }
328112
public static ComponentFeedbackPanel newComponentFeedbackPanel(final String id,
		final Component filter)
	{
		final ComponentFeedbackPanel feedbackPanel = new ComponentFeedbackPanel(id, filter);
		feedbackPanel.setOutputMarkupId(true);
		return feedbackPanel;
	}
1053667
protected Button newSubmitButton(final String id)
	{
		return new Button(id)
		{
			private static final long serialVersionUID = 1L;

			/**
			 * {@inheritDoc}
			 */
			@Override
			public void onSubmit()
			{
				/**
				 * Here comes the action what to do like (i.e. Send Email)
				 */
				onSubmitError(null);
			}
		};
	}
953180
public BoxRequestsFolder.UpdateFolder getRenameRequest(String id, String newName) {
        BoxRequestsFolder.UpdateFolder request = new BoxRequestsFolder.UpdateFolder(id, getFolderInfoUrl(id), mSession)
                .setName(newName);
        return request;
    }
1299839
@Override
	public CPOptionValue create(long CPOptionValueId) {
		CPOptionValue cpOptionValue = new CPOptionValueImpl();

		cpOptionValue.setNew(true);
		cpOptionValue.setPrimaryKey(CPOptionValueId);

		String uuid = PortalUUIDUtil.generate();

		cpOptionValue.setUuid(uuid);

		cpOptionValue.setCompanyId(companyProvider.getCompanyId());

		return cpOptionValue;
	}
1349473
protected CmsSelectBox createSelectBox() {

        CmsSelectBox selectbox = new CmsSelectBox();
        selectbox.setTitle(CmsAliasMode.page.toString(), aliasMessages.pageDescription());
        selectbox.setTitle(CmsAliasMode.redirect.toString(), aliasMessages.redirectDescription());
        selectbox.setTitle(CmsAliasMode.permanentRedirect.toString(), aliasMessages.movedDescription());
        selectbox.addOption(CmsAliasMode.page.toString(), aliasMessages.optionPage());
        selectbox.addOption(CmsAliasMode.redirect.toString(), aliasMessages.optionRedirect());
        selectbox.addOption(CmsAliasMode.permanentRedirect.toString(), aliasMessages.optionMoved());

        selectbox.getElement().getStyle().setWidth(190, Unit.PX);
        selectbox.getElement().getStyle().setMarginRight(5, Unit.PX);
        return selectbox;
    }
1180991
protected void changeId(I item, String id) {

        if (m_items.remove(item.getId()) != null) {
            m_items.put(id, item);
        }
    }
1021141
def selected(self, ids):
        
        result = copy(self.choices)
        result = filter(lambda x: x[0] in ids, result)
        # result = ((item, item) for item in result)
        return list(result)
400727
public static UniversalIdStrMessage newInstance(String id, byte[] content) {
        UniversalIdStrMessage msg = newInstance(content);
        msg.setId(id);
        return msg;
    }
672859
public void copyElement(final String id, final I_CmsSimpleCallback<CmsUUID> callback) {

        CmsRpcAction<CmsUUID> action = new CmsRpcAction<CmsUUID>() {

            @Override
            public void execute() {

                start(200, false);
                getContainerpageService().copyElement(
                    CmsCoreProvider.get().getStructureId(),
                    new CmsUUID(id),
                    getData().getLocale(),
                    this);
            }

            @Override
            protected void onResponse(CmsUUID result) {

                stop(false);
                callback.execute(result);
            }

        };
        action.execute();
    }
444300
public static UniversalIdIntQueueMessage newInstance(Long id, byte[] content) {
        UniversalIdIntQueueMessage msg = newInstance(content);
        msg.setId(id);
        return msg;
    }
845908
public static FeedbackPanel newFeedbackPanel(final String id)
	{
		final FeedbackPanel feedbackPanel = new FeedbackPanel(id);
		feedbackPanel.setOutputMarkupId(true);
		return feedbackPanel;
	}
736884
function setId(element, id) {
    const currentId = getAttribute(element, 'id');

    if (currentId) {
        return currentId;
    }

    const newId = id || (`mui-id-${generateRandomString(6)}`);

    setAttribute(element, 'id', newId);

    return newId;
}
697754
public WasAssociatedWith newWasAssociatedWith(QualifiedName id) {
	return newWasAssociatedWith(id, (QualifiedName)null,(QualifiedName)null);
    }