/** * Sets the visibility and selection state of the tab. */ @Override protected void updateVisibility(boolean visible, boolean activated) { tab.setVisible(visible); tab.setSelected(visible && activated); }
/** * Sets the caption label. * * @param value The caption label. */ public void setLabel(String value) { tab.setLabel(value); }
/** * Sets the currently selected tab. * * @param selectedTab The tab to select (may be null). */ public void setSelectedTab(Tab selectedTab) { validateIsChild(selectedTab); if (this.selectedTab != null) { this.selectedTab._setSelected(false, false); } this.selectedTab = selectedTab; if (selectedTab != null) { selectedTab._setSelected(true, false); } }
Tab tab = new Tab(); tab.addStyle("overflow", "auto"); String label = StrUtil.getLabel("cwf.help.tab." + viewType.name().toLowerCase() + ".label"); tab.setLabel(label == null ? viewType.name() : label); tab.addChild(newView.getContainer()); tab.setVisible(viewType != HelpViewType.HISTORY); tvNavigator.addChild(tab, pos); return newView;
@Override public void bringToFront() { setSelected(true); super.bringToFront(); }
/** * Handles change events from the client. * * @param event A change event. */ @EventHandler(value = "change", syncToClient = false, mode = "init") private void _onChange(ChangeEvent event) { _setSelected(defaultify(event.getValue(Boolean.class), true), true); event = new ChangeEvent(this.getParent(), event.getData(), this); EventUtil.send(event); }
/** * Resets the viewer to its baseline state. All registered help sets are removed, the history is * cleared, and all views are hidden. */ private void reset() { tvNavigator.setVisible(false); lblLoading.setVisible(true); helpSets.clear(); history.clear(); for (Tab tab : tvNavigator.getChildren(Tab.class)) { tab.setVisible(false); } }
/** * Handles close events from the client. * * @param event A close event. */ @EventHandler(value = "close", syncToClient = false, mode = "init") private void _onClose(Event event) { close(); }
/** * Select the tab associated with the view. Fires the onSelect event on the tab. * * @param view The help view. */ private void selectView(HelpViewBase view) { view.getContainer().getAncestor(Tab.class).setSelected(true); view.onSelect(); }
/** * Updated the list box selection when the history selection changes. * * @see org.carewebframework.help.viewer.HelpViewBase#onTopicSelected(HelpTopic) */ @Override public void onTopicSelected(HelpTopic topic) { Listitem item = (Listitem) lstHistory.getChildAt(history.getPosition()); lstHistory.setSelectedItem(item); if (item != null) { getContainer().getAncestor(Tab.class).setVisible(true); item.scrollIntoView(); } }
/** * Returns the help view associated with the specified view type. If the view does not exist and * doCreate is true and the view type is supported, a new view is created. Otherwise, null is * returned. * * @param viewType The view type. * @param doCreate If true, create if does not already exist. * @param visible Determines visibility of view. * @return A help view (possibly null). */ private HelpViewBase findView(HelpViewType viewType, boolean doCreate, boolean visible) { HelpViewBase result = null; for (HelpViewBase view : views) { if (view.getViewType().equals(viewType)) { result = view; break; } } result = result != null ? result : doCreate ? createView(viewType) : null; if (result != null) { result.getContainer().getAncestor(Tab.class).setVisible(visible); } return result; }
/** * Sets the selection state of the tab. * * @param selected The selection state of the tab. */ @PropertySetter(value = "selected", defaultValue = "false", description = "The selection state of the tab.") public void setSelected(boolean selected) { _setSelected(selected, true); }