/** * Associates the specified CWF component with this UI element. * * @param component CWF component to associate. */ public void associateComponent(BaseComponent component) { if (component != null) { component.setAttribute(ASSOC_ELEMENT, this); } }
/** * Sets the value of a named attribute. * * @param name The attribute name. * @param value The new value. * @return The previous value of the named attribute, if any. */ @PropertySetter("attr:") private Object _setAttribute(String name, Object value) { return setAttribute(name, value); }
private BaseComponent create() { try { BaseComponent comp = clazz.newInstance(); if (switchVal != null) { comp.setAttribute(SWITCH_ATTR, switchVal); } return comp; } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
/** * Associates a drop renderer with a component. * * @param component BaseComponent to be associated. * @param dropRenderer Drop renderer to associate. */ public static void setDropRenderer(BaseComponent component, IDropRenderer dropRenderer) { if (dropRenderer == null) { component.removeAttribute(DROP_RENDERER_ATTR); } else { component.setAttribute(DROP_RENDERER_ATTR, dropRenderer); } }
/** * Creates an action listener. * * @param component Component receiving the event. * @param action Action to be invoked upon receipt of the event. * @param eventName The name of the event. */ protected ActionListener(BaseComponent component, IAction action, String eventName) { this.component = component; this.action = action; this.eventName = eventName; this.attrName = getAttrName(eventName); ActionUtil.removeAction(component, eventName); component.addEventListener(eventName, this); component.setAttribute(attrName, this); }
@Override public void afterInitialized(BaseComponent root) { menuPopup = (Menupopup) root; root.setAttribute("controller", this); mnuHeader.setImage(DesignConstants.DESIGN_ICON_ACTIVE); clipboard.addListener(mnuHeader); menuPopup.addEventListener("open", (event) -> { onOpen(event); }); }
comp.setAttribute(forVar, each); components.add(comp);
setAttribute(ATTR_CONTROLLER, controller); controllers = controllers == null ? new ArrayList<>() : controllers; controllers.add(controller); setAttribute(ATTR_CONTROLLER + "_" + controllers.size(), controller);
/** * Override the doAfterCompose method to set references to the application context and the * framework and register the controller with the framework. * * @param comp BaseComponent associated with this controller. */ @Override public void afterInitialized(BaseComponent comp) { root = (BaseUIComponent) comp; this.comp = root; comp.setAttribute(Constants.ATTR_COMPOSER, this); comp.addEventListener(ThreadEx.ON_THREAD_COMPLETE, threadCompletionListener); appContext = SpringUtil.getAppContext(); appFramework = FrameworkUtil.getAppFramework(); eventManager = EventManager.getInstance(); initialize(); }
/** * Sets or removes the command target for the specified component. * * @param component The bound component whose command target is being modified. * @param commandTarget If null, any associated command target is removed. Otherwise, this value * is set as the command target. */ private void setCommandTarget(BaseComponent component, BaseComponent commandTarget) { if (commandTarget == null) { commandTarget = (BaseComponent) component.removeAttribute(getTargetAttributeName()); if (commandTarget != null && commandTarget.hasAttribute(ATTR_DUMMY)) { commandTarget.detach(); } } else { component.setAttribute(getTargetAttributeName(), commandTarget); } }
@Override public void afterInitialized(BaseComponent comp) { window = (Window) comp; window.setCloseAction(CloseAction.HIDE); comp.setAttribute("controller", this); bringToFront = comp.getPage().getAttribute(ATTR_BRING_TO_FRONT, true); layoutChangedEvent = new LayoutChangedEvent(comp, null); contextMenu.setListener(comp); clipboard.addListener(comp); comp.getPage().addEventListener("register unregister", layoutListener); }
/** * Initializes the property grid. * * @param comp The root component. */ @Override public void afterInitialized(BaseComponent comp) { window = (Window) comp; changeEvent = new ChangeEvent(window, null); @SuppressWarnings("rawtypes") IModelAndView<Row, PropertyEditorBase> mv = gridProperties.getRows().getModelAndView(PropertyEditorBase.class); mv.setRenderer(rowRenderer); mv.setModel(model); comp.setAttribute("controller", this); this.embedded = comp.getAttribute("embedded", false); setTarget(comp.getAttribute("target", ElementBase.class)); if (window.getParent() != null) { window.setClosable(false); window.setWidth("100%"); window.setHeight("100%"); window.setSizable(false); window.addClass("cwf-propertygrid-embedded"); toolbar.setVisible(embedded); } btnOK.setVisible(!embedded); btnCancel.setVisible(!embedded); }