/** * Associates context-sensitive help topic with a component. Any existing association is * replaced. * * @param component Component to be associated. * @param helpContext The help target. * @param commandTarget The command target. */ public static void associateCSH(BaseUIComponent component, HelpContext helpContext, BaseUIComponent commandTarget) { if (component != null) { component.setAttribute(CSH_TARGET, helpContext); CommandUtil.associateCommand("help", component, commandTarget); } }
/** * Register a component with the container. The container will control the visibility of the * component according to when it is active/inactive. * * @param component BaseComponent to register. */ public void registerComponent(BaseUIComponent component) { if (registeredComponents == null) { registeredComponents = new ArrayList<>(); } registeredComponents.add(component); component.setAttribute(Constants.ATTR_CONTAINER, this); component.setAttribute(Constants.ATTR_VISIBLE, component.isVisible()); component.setVisible(isVisible()); }
private void _close(boolean cancel) { if (!cancel && !doCommit()) { return; } root.setAttribute("cancelled", cancel); root.detach(); }
public SavedState(BaseUIComponent component) { this.component = component; hint = component.getHint(); contextMenu = component.getContext(); component.setAttribute(SAVED_STATE, this); component.addClass("cwf-designmode-active"); }
/** * Send invitations to the selected participants, then close the dialog. */ @EventHandler(value = "click", target = "@btnInvite") private void onClick$btnInvite() { List<IPublisherInfo> invitees = getInvitees(); chatService.invite(sessionId, invitees, false); root.setAttribute("invitees", invitees); root.detach(); }
/** * Bind a component to this command and action. * * @param component The component to be bound. * @param action The action to be executed when the command is invoked. */ /*package*/void bind(BaseUIComponent component, IAction action) { BaseUIComponent dummy = new Div(); dummy.setAttribute(ATTR_DUMMY, true); dummy.setVisible(false); dummy.setParent(component.getPage()); ActionUtil.addAction(dummy, action, CommandEvent.TYPE); bind(component, dummy); }
/** * Sets the visibility of the contained resource and any registered components. * * @param visible Visibility state to set */ @Override protected void updateVisibility(boolean visible, boolean activated) { super.updateVisibility(visible, activated); if (registeredComponents != null) { for (BaseUIComponent component : registeredComponents) { if (!visible) { component.setAttribute(Constants.ATTR_VISIBLE, component.isVisible()); component.setVisible(false); } else { component.setVisible((Boolean) component.getAttribute(Constants.ATTR_VISIBLE)); } } } if (visible) { checkBusy(); } }
/** * Apply/remove the design context menu to/from the specified component. If applying the design * context menu, any existing context menu is saved. When removing the context menu, any saved * context menu is restored. * * @param component Component to which to apply/remove the design context menu. * @param contextMenu The design menu if design mode is activated, or null if it is not. */ protected void setDesignContextMenu(BaseUIComponent component, Menupopup contextMenu) { component.setAttribute(CONTEXT_MENU, contextMenu); if (contextMenu == null) { SavedState.restore(component); applyHint(); } else { new SavedState(component); component.setContext(contextMenu); component.setHint(getDefinition().getName()); } }
@EventHandler(value = "click", target = "@btnDelete") private void onClick$btnDelete() { IBaseResource resource = getSelectedResource(); DialogUtil.confirm("Delete " + FhirUtil.getResourceIdPath(resource, true) + "?", "Delete Resource", (confirm) -> { if (confirm) { try { fhirService.deleteResource(resource); model.remove(resource); root.setAttribute("modified", true); updateCaption(); displayResource(); } catch (Exception e) { DialogUtil.showError("Error deleting resource:\n\n" + CWFUtil.formatExceptionForDisplay(e)); } } }); }