/** * Sets the width. This is synchronized with the width style setting. * * @param width The width. */ @PropertySetter(value = "width", description = "The component's width.") public void setWidth(String width) { width = trimify(width); if (!areEqual(width, this.width)) { this.width = width; addStyle("width", width); } }
/** * 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); }
public SavedState(BaseUIComponent component) { this.component = component; hint = component.getHint(); contextMenu = component.getContext(); component.setAttribute(SAVED_STATE, this); component.addClass("cwf-designmode-active"); }
/** * Create a drilldown event listener for the specified component. * * @param component The component to which the event listener will be attached. * @param dataObject Data object for the drilldown. * @param drillDownDisplayClass Dialog class for the drilldown display. */ public DrillDownListener(BaseUIComponent component, T dataObject, Class<?> drillDownDisplayClass) { super(); this.component = component; this.dataObject = dataObject; this.drillDownDisplayClass = drillDownDisplayClass; component.addEventListener(ClickEvent.class, this); component.addStyle("cursor", "pointer"); }
/** * Creates a busy message covering the specified target. A busy message consists of a mask the * covers and prevents interaction with the target component and a message centered within the * mask. * * @param target The target of the busy message. * @param message The message to be displayed. If null, any existing message is removed. */ public static void busy(BaseUIComponent target, String message) { if (message == null || message.isEmpty()) { target.removeMask(); } else { target.addMask(message); } }
/** * 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(); } }
/** * 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()); }
/** * Hides the component - a shortcut for {@link #setVisible setVisible(false)}. */ public void hide() { setVisible(false); }
private void updateClass() { String sclass = state == State.COUNTDOWN ? SCLASS_COUNTDOWN : SCLASS_IDLE; sclass = "mode:" + mode.format(sclass); if (shutdown) { sclass += " cwf-sessionmonitor-shutdown"; } timeoutWindow.addClass(sclass); timeoutWindow.setVisible(mode != Mode.BASELINE || state != State.INITIAL); }
private void _close(boolean cancel) { if (!cancel && !doCommit()) { return; } root.setAttribute("cancelled", cancel); root.detach(); }
/** * Render detail view for the specified patient. * * @param patient Patient whose detail view is to be rendered. */ @Override public BaseUIComponent render(Patient patient) { BaseUIComponent root = new Div(); root.addClass("fujion-layout-vertical text-center"); root.addStyle("align-items", "center"); if (confirmAccess(patient, root)) { renderDemographics(patient, root); } return root; }
/** * Applies the current color setting to the target component. If the target implements a custom * method for performing this operation, that method will be invoked. Otherwise, the background * color of the target is set. Override this method to provide alternate implementations. * * @param comp Component to receive the color setting. */ protected void applyColor(BaseUIComponent comp) { if (comp instanceof BaseLabeledComponent) { comp.invoke(comp.sub("lbl"), "css", "color", getColor()); } else if (comp != null) { comp.addStyle("background-color", getColor()); } }
/** * Sets the panel style to use for the desktop. * * @param style The panel style. */ public void setStyle(ThemeUtil.PanelStyle style) { this.style = style; desktopOuter.addClass("cwf-desktop " + style.getThemeClass()); }
/** * Removes a style. * * @param name The style name (e.g., "color"). * @return The value of the removed style, or null if none. */ public String removeStyle(String name) { return addStyle(name, null); }
/** * 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()); } }
private void addHeader(String text) { Label header = new Label(text); header.addClass("cwf-patientheader-header"); pnlDetail.addChild(header); }
/** * 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); } }
/** * Updates the visibility of menu items * * @param enabled The enabled status. */ private void updateMenus(boolean enabled) { menu.setImage(enabled ? DesignConstants.DESIGN_ICON_ACTIVE : DesignConstants.DESIGN_ICON_INACTIVE); mnuDesignMode.addStyle("border-bottom", enabled ? "2px solid lightgray" : null); menu.setHint( StrUtil.formatMessage(enabled ? DesignConstants.DESIGN_HINT_ACTIVE : DesignConstants.DESIGN_HINT_INACTIVE)); BaseUIComponent child = (BaseUIComponent) menu.getFirstChild(); while (child != null) { child.setVisible(enabled || child == mnuDesignMode); child = (BaseUIComponent) child.getNextSibling(); } } }
/** * Sets focus to the editor component. */ public void setFocus() { editor.setFocus(true); }