protected PropertyEditorCustom() { super(new Popupbox()); //editor.setAutodrop(false); editor.setReadonly(true); editor.setPlaceholder(StrUtil.getLabel("cwf.shell.designer.propedit.custom.component.prompt")); editor.addEventListener(OpenEvent.class, (event) -> { doOpen(); }); editor.addEventListener(CloseEvent.class, (event) -> { doClose(); }); popup = new Popup(); editor.addChild(popup); }
/** * Sets the open state of the popup box. * * @param open The open state of the popup box. */ @PropertySetter(value = "open", defaultValue = "false", description = "True if the popup box is open.") public void setOpen(boolean open) { _setOpen(open, true); }
/** * If popup specified as a child, set it as the associated popup component. * * @see org.fujion.component.BaseComponent#onAttach(org.fujion.component.Page) */ @Override protected void onAttach(Page page) { super.onAttach(page); if (getChildCount() > 0) { setPopup((Popup) getFirstChild()); } }
/** * If popup specified as a child, set it as the associated popup component. * * @see org.fujion.component.BaseComponent#afterAddChild(org.fujion.component.BaseComponent) */ @Override protected void afterAddChild(BaseComponent child) { super.afterAddChild(child); if (getPage() != null) { setPopup((Popup) child); } }
/** * Close the input box. */ @Override public void close() { super.close(); update(false); }
/** * Sets the popup associated with the popup box. */ @Override public void setPopup(Popup popup) { BaseComponent child = this.getFirstChild(); if (child != null && child != popup) { throw new IllegalArgumentException("You may not set a popup reference when a child popup is present"); } if (popup != getPopup()) { open = false; } super.setPopup(popup); }
/** * Add a new node. */ @EventHandler(value = "click", target = "btnAdd") private void onClick$btnAdd() { if (childClass != null) { addTreenode(PluginDefinition.getDefinition(childClass)); } else { AddComponent.getDefinition(getTargetElement(), (def) -> { addTreenode(def); editor.focus(); editor.open(); }); } }
/** * 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(); } }
/** * Handles popup open and close events from the client. * * @param event A popup open or close event. */ @EventHandler(value = { "popupopen", "popupclose" }, mode = "init") private void _onOpen(Event event) { boolean open = "popupopen".equals(event.getType()); if (open != this.open) { _setOpen(open, false); event = open ? new OpenEvent(this, event.getData()) : new CloseEvent(this, event.getData()); EventUtil.send(event); } }