/** * Shows the component - a shortcut for {@link #setVisible setVisible(true)}. */ public void show() { setVisible(true); }
/** * Hides the component - a shortcut for {@link #setVisible setVisible(false)}. */ public void hide() { setVisible(false); }
private void logout(String message) { timeoutWindow.setVisible(false); securityService.logout(true, null, message); }
/** * Sets the url for the title bar icon. * * @param url Url of the title bar icon. */ public void setIcon(String url) { this.icon.setSrc(url); ((BaseUIComponent) icon.getParent()).setVisible(!StringUtils.isEmpty(url)); }
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 setLabel(Label label, String value, BaseUIComponent associatedComponent) { label.setLabel(value); label.setVisible(value != null && !value.isEmpty()); if (associatedComponent != null) { associatedComponent.setVisible(label.isVisible()); } }
/** * 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()); }
/** * Override to set the visibility of wrapped components. Invoked when visibility or activation * states change. * * @param visible The current visibility state. * @param activated The current activation state. */ protected void updateVisibility(boolean visible, boolean activated) { if (!getDefinition().isInternal()) { getOuterComponent().setVisible(visible && activated); } }
/** * 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(); } }
/** * Displays a message to client. * * @param message Message to display to client. If null, message label is hidden. * @param isError If true, highlight the message to indicate an error. */ public void showMessage(String message, boolean isError) { showBusy(null); message = StrUtil.formatMessage(message); boolean show = message != null; if (lblMessage != null) { lblMessage.setVisible(show); lblMessage.setLabel(show ? message : ""); lblMessage.toggleClass("alert-danger", "alert-warning", isError); } if (hideOnShowMessage != null) { hideOnShowMessage.setVisible(!show); } }
/** * 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); }
/** * 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(); } } }
@Override public void afterInitialized(BaseComponent root) { window = (Window) root; shared = defaultIsShared(); boolean manage = root.getAttribute("manage", false); window.setTitle(StrUtil.formatMessage(manage ? CAP_LAYOUT_MANAGE : CAP_LAYOUT_LOAD)); lblPrompt.setLabel(StrUtil.formatMessage(manage ? MSG_LAYOUT_MANAGE : MSG_LAYOUT_LOAD)); modelAndView = lstLayouts.getModelAndView(String.class); modelAndView.setRenderer(renderer); pnlSelect.setVisible(!manage); tbManage.setVisible(manage); ((Radiobutton) radioGroup.getChildAt(shared ? 0 : 1)).setChecked(true); pnlScope.addClass(manage ? "pull-right" : "pull-left"); upload.bind(btnImport); refresh(root.getAttribute("dflt", "")); }
((BaseUIComponent) window.getFirstChild()).setVisible(false); window.setTitle(StrUtil.formatMessage("@cwf.shell.designer.property.grid.noselection")); disableButtons(true); ((BaseUIComponent) window.getFirstChild()).setVisible(true); window.setTitle(StrUtil.formatMessage("@cwf.shell.designer.property.grid.title", title));
/** * 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); }