/** * Returns the design context menu currently bound to the component. * * @param component The CWF component of interest. * @return The associated design context menu, or null if none. */ public static Menupopup getDesignContextMenu(BaseComponent component) { return component == null ? null : (Menupopup) component.getAttribute(CONTEXT_MENU); }
/** * Returns the UI element that registered the CWF component. * * @param component The CWF component of interest. * @return The associated UI element. */ public static ElementUI getAssociatedElement(BaseComponent component) { return component == null ? null : (ElementUI) component.getAttribute(ASSOC_ELEMENT); }
/** * Returns the command target associated with the specified component. * * @param component The component whose command target is sought. * @return The associated command target. If there is no associated command target, returns the * component itself (i.e., the component is the command target). */ private BaseComponent getCommandTarget(BaseComponent component) { BaseComponent commandTarget = (BaseComponent) component.getAttribute(getTargetAttributeName()); return commandTarget == null ? component : commandTarget; }
/** * Returns the listener associated with the given component and event. * * @param component The component. * @param eventName The event name. * @return A DeferredEventListener, or null if not found. */ public static ActionListener getListener(BaseComponent component, String eventName) { return (ActionListener) component.getAttribute(ActionListener.getAttrName(eventName)); }
/** * Returns the controller associated with the specified component, if any. * * @param comp The component whose controller is sought. * @param recurse If true, search up the parent chain until a controller is found. * @return The associated controller, or null if none found. */ public static Object getController(BaseComponent comp, boolean recurse) { return recurse ? comp.findAttribute(Constants.ATTR_COMPOSER) : comp.getAttribute(Constants.ATTR_COMPOSER); }
@Override public void afterInitialized(BaseComponent root) { window = (Window) root; window.setTitle(root.getAttribute("title", "")); btnPrint.setVisible(root.getAttribute("allowPrint", false)); String text = root.getAttribute("text", ""); if (text.startsWith("<html>")) { cmpHtml.setContent(text); } else { cmpText.setLabel(text); } }
@Override public void afterInitialized(BaseComponent root) { window = (Window) root; window.setTitle(StrUtil.formatMessage(root.getAttribute("title", ""))); lblPrompt.setLabel(StrUtil.formatMessage(root.getAttribute("prompt", ""))); LayoutIdentifier dfltLayout = root.getAttribute("dfltLayout", LayoutIdentifier.class); txtLayout.setValue(dfltLayout == null ? null : dfltLayout.name); boolean shared = dfltLayout == null ? LayoutManager.defaultIsShared() : dfltLayout.shared; (shared ? rbShared : rbPrivate).setChecked(true); radioGroup.setVisible(!root.getAttribute("hideScope", false)); allowDups = root.getAttribute("allowDups", true); }
/** * Creates an instance of the design context menu. * * @return New design context menu. */ public static DesignContextMenu create() { return PageUtil.createPage(DesignConstants.RESOURCE_PREFIX + "designContextMenu.fsp", ExecutionContext.getPage()) .get(0).getAttribute("controller", DesignContextMenu.class); }
@Override public TypedValue read(EvaluationContext context, Object target, String name) throws AccessException { Object result = null; if (target instanceof ELContext) { result = ((ELContext) target).getValue(name); } else if (target instanceof BaseComponent) { result = ((BaseComponent) target).getAttribute(name); } return new TypedValue(result); }
@Override public void afterInitialized(BaseComponent root) { window = (Window) root; clipboard = root.getAttribute("clipboard", Clipboard.class); data = clipboard.getData(); restore(); }
/** * Remove this listener from its associated component. */ protected void removeAction() { component.removeEventListener(eventName, this); if (component.getAttribute(attrName) == this) { component.removeAttribute(attrName); } }
/** * Sets the renderer. */ @Override public void afterInitialized(BaseComponent comp) { Document document = comp.getAttribute("document", Document.class); tree.setRenderer(renderer); tree.setModel(new XMLTreeModel(document.getDocumentElement())); }
/** * Display the add component dialog, presenting a list of candidate plugins that may serve as * children to the specified parent element. * * @param parentElement Element to serve as parent to the newly created child element. * @param callback Callback to return the plugin definition. */ public static void getDefinition(ElementBase parentElement, IResponseCallback<PluginDefinition> callback) { show(parentElement, false, (event) -> { if (callback != null) { callback.onComplete(event.getTarget().getAttribute("pluginDefinition", PluginDefinition.class)); } }); }
/** * Display the add component dialog, presenting a list of candidate plugins that may serve as * children to the specified parent element. * * @param parentElement Element to serve as parent to the newly created child element. * @param callback Callback to return the newly created child element. */ public static void newChild(ElementBase parentElement, IResponseCallback<ElementBase> callback) { show(parentElement, true, (event) -> { if (callback != null) { callback.onComplete(event.getTarget().getAttribute("childElement", ElementBase.class)); } }); }
/** * If the property grid is closed, instead close the component. * * @param event The close event. */ @EventHandler(value = "close", target = "^") private void onClose(Event event) { if (event.getTarget().getAttribute("controller") == propertyGrid) { editor.close(); doClose(); } }
/** * Set default values for input boxes. */ @Override public void afterInitialized(BaseComponent comp) { root = (Window) comp; DateRange dateRange = (DateRange) comp.getAttribute("dateRange"); startDate.setValue(dateRange.getStartDate()); endDate.setValue(dateRange.getEndDate()); }
/** * Initialize the design menu. */ @Override public void afterInitialized(BaseComponent comp) { this.owner = comp.getAttribute("owner", ElementDesktop.class); shell = owner.getShell(); if (!WebUtil.isDebugEnabled() && !SecurityUtil.hasDebugRole()) { mnuShowMarkup.destroy(); } updateMenus(false); }
/** * Populates the goal types and initializes the input elements with values from the step or * goal. Also, wires change events for all input elements. */ @SuppressWarnings("unchecked") @Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); domainObject = (T) comp.getAttribute("domainObject"); btnOK.setDisabled(true); initControls(); EventUtil.post(new Event("deferredInit", root, null)); }
/** * Prompts to load layout. */ @EventHandler(value = "click", target = "mnuLoadLayout") private void onClick$mnuLoadLayout() { LayoutManager.show(false, shell.getUILayout().getName(), (event) -> { LayoutIdentifier layoutId = event.getTarget().getAttribute("layoutId", LayoutIdentifier.class); if (layoutId != null) { Layout newLayout = new Layout(LayoutParser.parseProperty(layoutId)); shell.buildUI(newLayout); } }); }
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); window = (Window) comp; title = window.getTitle(); scenario = (Scenario) comp.getAttribute("scenario"); model.addAll(scenario.getResources()); model.sort(resourceComparator, true); colResource.setSortComparator(resourceComparator); IModelAndView<Row, IBaseResource> mv = tblResources.getRows().getModelAndView(IBaseResource.class); mv.setRenderer(resourceRenderer); mv.setModel(model); updateCaption(); }