Creates the menu item.

@param pageClass
the page class
@param resourceModelKey
the resource model key
@param component
the component
@param parameters
the {@link PageParameters}
@return the suckerfish menu panel. menu item
165391
public static MenuItem newMenuItem(final Class<? extends Page> pageClass,
		final String resourceModelKey, final Component component, final PageParameters parameters)
	{
		final BookmarkablePageLink<String> bookmarkablePageLink = new BookmarkablePageLink<>(
			MenuPanel.LINK_ID, pageClass, parameters);
		final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceModelKey,
			component);
		final MenuItem menuItem = new MenuItem(bookmarkablePageLink, labelModel);
		return menuItem;
	}
667357
@SuppressWarnings("unchecked")
    private static <T> T createCustomComponent(Class<T> componentType, Class<?> componentClass,
            Map<String, String> configProperties) throws Exception {
        if (componentClass == null) {
            throw new IllegalArgumentException("Invalid component spec (class not found)."); //$NON-NLS-1$
        }
        try {
            Constructor<?> constructor = componentClass.getConstructor(Map.class);
            return (T) constructor.newInstance(configProperties);
        } catch (Exception e) {
        }
        return (T) componentClass.getConstructor().newInstance();
    }
772288
public static PagerDuty create(String apiKey) {
    Retrofit retrofit = new Retrofit.Builder() //
        .baseUrl(HOST) //
        .addConverterFactory(GsonConverterFactory.create())
        .build();
    return create(apiKey, retrofit);
  }
963722
private Featurable createMenu(ActionRef action)
    {
        final Featurable menu = factory.create(Medias.create(PATH.split(action.getPath())));
        menus.add(menu);
        return menu;
    }
558851
public static Object actionList(PageContext pageContext, Resource directory, String serverPassword, int type, ResourceFilter filter, int listInfo, boolean recurse, String sort)
	    throws PageException {
	// check directory
	SecurityManager securityManager = pageContext.getConfig().getSecurityManager();
	securityManager.checkFileLocation(pageContext.getConfig(), directory, serverPassword);

	if (type != TYPE_ALL) {
	    ResourceFilter typeFilter = (type == TYPE_DIR) ? DIRECTORY_FILTER : FILE_FILTER;
	    if (filter == null) filter = typeFilter;
	    else filter = new AndResourceFilter(new ResourceFilter[] { typeFilter, filter });
	}

	// create query Object
	String[] names = new String[] { "name", "size", "type", "dateLastModified", "attributes", "mode", "directory" };
	String[] types = new String[] { "VARCHAR", "DOUBLE", "VARCHAR", "DATE", "VARCHAR", "VARCHAR", "VARCHAR" };

	boolean hasMeta = directory instanceof ResourceMetaData;
	if (hasMeta) {
	    names = new String[] { "name", "size", "type", "dateLastModified", "attributes", "mode", "directory", "meta" };
	    types = new String[] { "VARCHAR", "DOUBLE", "VARCHAR", "DATE", "VARCHAR", "VARCHAR", "VARCHAR", "OBJECT" };
	}
	Array array = null;
	Query query = null;
	Object rtn;
	if (listInfo == LIST_INFO_QUERY_ALL || listInfo == LIST_INFO_QUERY_NAME) {
	    boolean listOnlyNames = listInfo == LIST_INFO_QUERY_NAME;
	    rtn = query = new QueryImpl(listOnlyNames ? new String[] { "name" } : names, listOnlyNames ? new String[] { "VARCHAR" } : types, 0, "query");
	}
	else rtn = array = new ArrayImpl();

	if (!directory.exists()) {
	    if (directory instanceof FileResource) return rtn;
	    throw new ApplicationException("directory [" + directory.toString() + "] doesn't exist");
	}
	if (!directory.isDirectory()) {
	    if (directory instanceof FileResource) return rtn;
	    throw new ApplicationException("file [" + directory.toString() + "] exists, but isn't a directory");
	}
	if (!directory.isReadable()) {
	    if (directory instanceof FileResource) return rtn;
	    throw new ApplicationException("no access to read directory [" + directory.toString() + "]");
	}

	long startNS = System.nanoTime();

	try {
	    // Query All
	    if (listInfo == LIST_INFO_QUERY_ALL) _fillQueryAll(query, directory, filter, 0, hasMeta, recurse);

	    // Query Name
	    else if (listInfo == LIST_INFO_QUERY_NAME) {
		if (recurse || type != TYPE_ALL) _fillQueryNamesRec("", query, directory, filter, 0, recurse);
		else _fillQueryNames(query, directory, filter, 0);
	    }

	    // Array Name/Path
	    else if (listInfo == LIST_INFO_ARRAY_NAME || listInfo == LIST_INFO_ARRAY_PATH) {
		boolean onlyName = listInfo == LIST_INFO_ARRAY_NAME;
		if (!onlyName || recurse || type != TYPE_ALL) _fillArrayPathOrName(array, directory, filter, 0, recurse, onlyName);// QueryNamesRec("",query, directory, filter,
																   // 0,recurse);
		else _fillArrayName(array, directory, filter, 0);
	    }

	}
	catch (IOException e) {
	    throw Caster.toPageException(e);
	}

	// sort
	if (sort != null && query != null) {
	    String[] arr = sort.toLowerCase().split(",");
	    for (int i = arr.length - 1; i >= 0; i--) {
		try {
		    String[] col = arr[i].trim().split("\\s+");
		    if (col.length == 1) query.sort(col[0].trim());
		    else if (col.length == 2) {
			String order = col[1].toLowerCase().trim();
			if (order.equals("asc")) query.sort(col[0], lucee.runtime.type.Query.ORDER_ASC);
			else if (order.equals("desc")) query.sort(col[0], lucee.runtime.type.Query.ORDER_DESC);
			else throw new ApplicationException("invalid order type [" + col[1] + "]");
		    }
		}
		catch (Throwable t) {
		    ExceptionUtil.rethrowIfNecessary(t);
		}
	    }
	}
	if (query != null) query.setExecutionTime(System.nanoTime() - startNS);
	return rtn;
    }
702798
private void doGetComponent() throws PageException {
	Struct sct = new StructImpl();
	pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
	// Base Component
	try {
	    PageSource psCFML = config.getBaseComponentPageSource(CFMLEngine.DIALECT_CFML);

	    if (psCFML != null && psCFML.exists()) sct.set("baseComponentTemplateCFML", psCFML.getDisplayPath());
	    else sct.set("baseComponentTemplateCFML", "");
	}
	catch (PageException e) {
	    sct.set("baseComponentTemplateCFML", "");
	}
	try {
	    PageSource psLucee = config.getBaseComponentPageSource(CFMLEngine.DIALECT_LUCEE);

	    if (psLucee != null && psLucee.exists()) sct.set("baseComponentTemplateLucee", psLucee.getDisplayPath());
	    else sct.set("baseComponentTemplateLucee", "");

	}
	catch (PageException e) {
	    sct.set("baseComponentTemplateLucee", "");
	}
	sct.set("strBaseComponentTemplateCFML", config.getBaseComponentTemplate(CFMLEngine.DIALECT_CFML));
	sct.set("strBaseComponentTemplateLucee", config.getBaseComponentTemplate(CFMLEngine.DIALECT_LUCEE));

	// dump template
	try {
	    PageSource ps = ((PageContextImpl) pageContext).getPageSourceExisting(config.getComponentDumpTemplate());
	    if (ps != null) sct.set("componentDumpTemplate", ps.getDisplayPath());
	    else sct.set("componentDumpTemplate", "");
	}
	catch (PageException e) {
	    sct.set("componentDumpTemplate", "");
	}
	sct.set("strComponentDumpTemplate", config.getComponentDumpTemplate());

	sct.set("deepSearch", Caster.toBoolean(config.doComponentDeepSearch()));
	sct.set("componentDataMemberDefaultAccess", ComponentUtil.toStringAccess(config.getComponentDataMemberDefaultAccess()));
	sct.set("triggerDataMember", Caster.toBoolean(config.getTriggerComponentDataMember()));
	sct.set("useShadow", Caster.toBoolean(config.useComponentShadow()));
	sct.set("ComponentDefaultImport", config.getComponentDefaultImport());
	sct.set("componentLocalSearch", config.getComponentLocalSearch());
	sct.set("componentPathCache", config.useComponentPathCache());

    }
324302
public function createFromPageAction(Request $request, $rootId, $pageId)
    {
        $rootNode = $this->admin->getObject($rootId);

        if (!$rootNode) {
            throw new NotFoundHttpException(sprintf('unable to find the Menu with id : %s', $rootId));
        }

        $page = $this->get('networking_init_cms.page_manager')->find($pageId);

        if (!$page) {
            throw new NotFoundHttpException(sprintf('unable to find the Page with id : %s', $pageId));
        }

        $menuItem = new MenuItem();

        $menuItem->setPage($page);
        $menuItem->setRoot($rootNode);
        $menuItem->setParent($rootNode);
        $menuItem->setName($page->getTitle());

        $em = $this->getDoctrine()->getManager();
        $em->persist($menuItem);
        $em->flush();

        $this->admin->createObjectSecurity($menuItem);

        return $this->redirect(
            $this->admin->generateUrl('list', ['page_id' => $page->getId(), 'menu_id' => $menuItem->getId()]).'#end'
        );
    }
330156
public final <C extends IRequestablePage> C newPage(final Class<C> pageClass) {
        PageFactory<C> content = getFactory(pageClass);
        if (content != null) {
            return content.createPage(new PageParameters());
        }
        return new DefaultPageFactory().newPage(pageClass);
    }
1139694
protected CmsPair<String, List<Object>> makePaged(CmsSelectQuery select, CmsUserSearchParameters params) {

        CmsPagingQuery paging = new CmsPagingQuery(select);
        paging.setUseWindowFunctions(useWindowFunctionsForPaging());
        int page = params.getPage();
        int pageSize = params.getPageSize();
        paging.setNameSubquery(shouldNameSubqueries());
        paging.setPaging(pageSize, page);
        CmsStatementBuilder builder = new CmsStatementBuilder();
        paging.visit(builder);
        return CmsPair.create(builder.getQuery(), builder.getParameters());
    }
620432
private void createMenuEntry(
        MenuItem parent,
        final CmsTreeNode<I_CmsContextMenuItem> node,
        CmsContextMenuTreeBuilder treeBuilder) {

        Command entryCommand = null;
        if (node.getChildren().size() == 0) {
            entryCommand = new Command() {

                private static final long serialVersionUID = 1L;

                public void menuSelected(MenuItem selectedItem) {

                    node.getData().executeAction(getDialogContext());
                }
            };
        }
        MenuItem entry = parent.addItem((node.getData().getTitle(A_CmsUI.get().getLocale())), entryCommand);
        for (CmsTreeNode<I_CmsContextMenuItem> child : node.getChildren()) {
            createMenuEntry(entry, child, treeBuilder);
        }
        if (treeBuilder.getVisibility(node.getData()).isInActive()) {
            entry.setEnabled(false);
        }
    }
1255960
public static Url getBaseUrl(final Class<? extends Page> pageClass,
		final PageParameters parameters)
	{
		return RequestCycle.get().mapUrlFor(pageClass, parameters);
	}
226371
public static IModel<String> newResourceModel(final ResourceBundleKey resourceBundleKey,
		final IModel<?> model)
	{
		IModel<String> resourceModel;
		resourceModel = newResourceModel(resourceBundleKey.getKey(), null, model, 
				resourceBundleKey.getDefaultValue(), resourceBundleKey.getParameters());
		return resourceModel;
	}
799543
@Nullable
  @OverrideOnDemand
  public IHCNode renderMenuItemPage (@Nonnull final IWebPageExecutionContext aWPEC,
                                     @Nonnull final IMenuItemPage aMenuItemPage)
  {
    if (!aMenuItemPage.matchesDisplayFilter ())
      return null;

    final Locale aDisplayLocale = aWPEC.getDisplayLocale ();
    final HCA ret = new HCA (aWPEC.getLinkToMenuItem (aMenuItemPage.getID ()));
    // Set window target (if defined)
    if (aMenuItemPage.hasTarget ())
      ret.setTarget (new HC_Target (aMenuItemPage.getTarget ()));
    ret.addChild (aMenuItemPage.getDisplayText (aDisplayLocale));
    return ret;
  }
715508
public static <T> ParameterBuilder<T> create(String name, Class<T> type) {
    return new ParameterBuilder<T>()
        .name(name)
        .type(type);
  }
1109282
protected Parameter createPageParameter(ParameterContext context) {
        ModelReference intModel = createModelRefFactory(context).apply(resolver.resolve(Integer.TYPE));
        return new ParameterBuilder()
            .name(getPageName())
            .parameterType(PAGE_TYPE)
            .modelRef(intModel)
            .description(PAGE_DESCRIPTION)
            .build();
    }
1204651
private void prepareMenu(Container menu, Component component, int x, int y)
    {
        int n = menu.getComponentCount();
        for (int i=0; i<n; i++)
        {
            Component menuComponent = popupMenu.getComponent(i);
            if (menuComponent instanceof JMenu)
            {
                JMenu subMenu = (JMenu)menuComponent;
                prepareMenu(subMenu, component, x, y);
            }
            if (menuComponent instanceof AbstractButton)
            {
                AbstractButton abstractButton = (AbstractButton)menuComponent;
                Action action = abstractButton.getAction();
                if (action != null && action instanceof LocationBasedAction)
                {
                    LocationBasedAction locationBasedAction = 
                        (LocationBasedAction)action;
                    locationBasedAction.prepareShow(component, x, y);
                }
            }
        }
    }
1124711
public UIComponent createComponent(FacesContext context, Resource componentResource)
    {
        Application application = getMyfacesApplicationInstance(context);
        if (application != null)
        {
            return application.createComponent(context, componentResource);
        }
        throw new UnsupportedOperationException();
    }