List of usage examples for com.google.gwt.user.client.ui TabPanel getWidgetCount
public int getWidgetCount()
From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java
License:Apache License
public static void clearChildren(TabPanel tp) { for (int i = tp.getWidgetCount() - 1; i >= 0; i--) { tp.remove(i);/*from www. j a v a 2 s . c o m*/ } }
From source file:com.ponysdk.ui.terminal.ui.PTTabPanel.java
License:Apache License
@Override public void add(final PTInstruction add, final UIService uiService) { final Widget w = asWidget(add.getObjectID(), uiService); final TabPanel tabPanel = uiObject; final int beforeIndex = add.getInt(PROPERTY.BEFORE_INDEX); if (add.containsKey(PROPERTY.TAB_TEXT)) { tabPanel.insert(w, add.getString(PROPERTY.TAB_TEXT), beforeIndex); } else if (add.containsKey(PROPERTY.TAB_WIDGET)) { final PTWidget<?> ptWidget = (PTWidget<?>) uiService.getPTObject(add.getLong(PROPERTY.TAB_WIDGET)); tabPanel.insert(w, ptWidget.cast(), beforeIndex); }// w ww.j a va 2 s .c om if (tabPanel.getWidgetCount() == 1) { tabPanel.selectTab(0); } }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.TabPanelRenderer.java
License:Apache License
public UIObject render(ComponentGVO component, String uuid, String parent, String context) { TabPanel uiObject = null; if (component != null) { if (component instanceof TabPanelGVO) { TabPanelGVO gvo = (TabPanelGVO) component; if (gvo.getMenu() != null) { final ComponentGVO finalComponentGVO = component; final String finalUuid = uuid; final String finalParent = parent; uiObject = new TabPanel() { @Override/*from w ww. jav a 2 s. c o m*/ public void onBrowserEvent(Event event) { if (event.getTypeInt() == Event.ONCONTEXTMENU) { DOM.eventPreventDefault(event); applyContextMenu(event, finalComponentGVO, finalUuid, finalParent); } super.onBrowserEvent(event); } @Override protected void setElement(Element elem) { super.setElement(elem); sinkEvents(Event.ONCONTEXTMENU); } }; } else { uiObject = new TabPanel(); } uiObject.setAnimationEnabled(gvo.isAnimationEnabled()); RendererHelper.fillIn(component, uiObject, uuid, parent, context); TabGVO[] tabs = gvo.getTabs(); if (tabs != null) { for (int i = 0; i < tabs.length; i++) { TabGVO tabGVO = tabs[i]; // since the panel renderer is used, the title (not null) will create a titledPanel. // The tab already has the title so that is overkill String title = tabGVO.getTitle(); tabGVO.setTitle(null); UIObject tabUI = renderChildComponent(tabGVO, uuid, parent, context); tabGVO.setTitle(title); if (tabUI instanceof Widget) { uiObject.add((Widget) tabUI, title); setTabVisibility(uiObject, i, tabGVO.getVisible(), tabUI); int tabCount = uiObject.getTabBar().getTabCount(); UIObject tabComponent = (UIObject) uiObject.getTabBar().getTab(tabCount - 1); RendererHelper.addAttributesRequiredByEventHandling(tabGVO, tabComponent, uuid, parent, context); RendererHelper.addEvents(tabGVO, tabComponent, uuid); } } } if (uiObject.getWidgetCount() > 0) { uiObject.selectTab(0); } } } return uiObject; }
From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.SetPropertyExecute.java
License:Apache License
private void processProperty(UIObject uiObject, BuiltInComponentGVO builtInComponentGVO, SetPropertyGVO setProperty) {//from w ww . jav a 2 s .co m if (QAMLConstants.PROPERTY_ENABLED.equals(setProperty.getProperty()) || QAMLConstants.PROPERTY_DISABLED.equals(setProperty.getProperty())) { boolean value = Boolean.valueOf(setProperty.getValue()).booleanValue(); if (QAMLConstants.PROPERTY_DISABLED.equals(setProperty.getProperty())) { value = !value; } if (uiObject instanceof HasEnabled) { HasEnabled hasEnabled = (HasEnabled) uiObject; hasEnabled.setEnabled(value); } else if (uiObject instanceof HasWidgets) { SetMaskHelper.setMaskEnable(uiObject.getElement().getAttribute(QAMLConstants.PROPERTY_ID), value, true); DOM.setElementPropertyBoolean(uiObject.getElement(), QAMLConstants.PROPERTY_DISABLED, !value); } else if (uiObject instanceof QSuggestBox) { QSuggestBox suggestField = (QSuggestBox) uiObject; suggestField.getTextBox().setEnabled(value); } else if (uiObject instanceof SpreadsheetCell) { SpreadsheetCell cell = (SpreadsheetCell) uiObject; cell.setEditable(value); } } else if (QAMLConstants.PROPERTY_EDITABLE.equals(setProperty.getProperty())) { boolean editable = Boolean.valueOf(setProperty.getValue()).booleanValue(); HasEditable hasEditable = null; if (uiObject instanceof HasEditable) { hasEditable = (HasEditable) uiObject; } else if (uiObject instanceof TextBoxBase) { TextBoxBase textboxBase = (TextBoxBase) uiObject; if (textboxBase.getParent() instanceof HasEditable) { hasEditable = (HasEditable) textboxBase.getParent(); } else { textboxBase.setReadOnly(!editable); } } if (hasEditable != null) { hasEditable.setEditable(editable); } } else if (QAMLConstants.PROPERTY_VISIBLE.equals(setProperty.getProperty())) { boolean value = Boolean.valueOf(setProperty.getValue()).booleanValue(); if (uiObject instanceof HasVisible) { ((HasVisible) uiObject).processVisible(value); } else if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject; boolean resolved = false; String uuid = builtInComponentGVO.getComponentIdUUID(); if (uuid != null) { boolean containsColumn = uuid.contains("."); if (containsColumn) { String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", ""); hasDataGridMethods.setColumnVisible(columnId, value); resolved = true; } } if (!resolved) { uiObject.setVisible(value); hasDataGridMethods.redraw(); } } else { uiObject.setVisible(value); if (uiObject instanceof Panel) { Panel p = (Panel) uiObject; Widget parent = p.getParent(); if (parent != null && parent instanceof DeckPanel) { DeckPanel deckPanel = (DeckPanel) parent; int widgetIndex = deckPanel.getWidgetIndex(p); if (widgetIndex != -1) { if (deckPanel.getParent() != null && deckPanel.getParent().getParent() != null && deckPanel.getParent().getParent() instanceof TabPanel) { TabPanel tabs = ((TabPanel) (deckPanel.getParent().getParent())); TabPanelRenderer.setTabVisibility(tabs, widgetIndex, value, uiObject); } } } } } } else if (QAMLConstants.PROPERTY_HEIGHT.equals(setProperty.getProperty())) { try { String height = setProperty.getValue(); if (!QAMLUtil.containsUnitIdentifier(height)) { height += QAMLUtil.DEFAULT_UNIT; } uiObject.setHeight(height); } catch (Exception e) { ClientApplicationContext.getInstance().log("Set Property on height failed", "Please check value of height (" + setProperty.getValue() + ")", true); } } else if (QAMLConstants.PROPERTY_WIDTH.equals(setProperty.getProperty())) { try { String width = setProperty.getValue(); if (!QAMLUtil.containsUnitIdentifier(width)) { width += QAMLUtil.DEFAULT_UNIT; } uiObject.setWidth(width); } catch (Exception e) { ClientApplicationContext.getInstance().log("Set Property on width failed", "Please check value of width (" + setProperty.getValue() + ")", true); } } else if (QAMLConstants.PROPERTY_TOOLTIP.equals(setProperty.getProperty())) { uiObject.setTitle(setProperty.getValue()); } else if (QAMLConstants.PROPERTY_TITLE.equals(setProperty.getProperty())) { if (uiObject instanceof CaptionPanel) { CaptionPanel p = (CaptionPanel) uiObject; p.setCaptionText(setProperty.getValue()); } } else if (QAMLConstants.PROPERTY_DISPLAYNAME.equals(setProperty.getProperty())) { if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject; String uuid = builtInComponentGVO.getComponentIdUUID(); if (uuid != null) { boolean containsColumn = uuid.contains("."); if (containsColumn) { String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", ""); String value = setProperty.getValue(); hasDataGridMethods.setColumnLabel(columnId, value); } } } else if (uiObject instanceof PushButton) { ((PushButton) uiObject).getUpFace().setText(setProperty.getValue()); ((PushButton) uiObject).getDownFace().setText(setProperty.getValue()); } else if (uiObject instanceof HasText) { HasText t = (HasText) uiObject; t.setText(setProperty.getValue()); } else if (uiObject instanceof VerticalPanel) { VerticalPanel vp = (VerticalPanel) uiObject; Widget tabPanelWidget = vp.getParent().getParent().getParent(); if (tabPanelWidget instanceof TabPanel) { TabPanel tp = (TabPanel) tabPanelWidget; TabBar tb = tp.getTabBar(); int tabCount = tp.getWidgetCount(); for (int i = 0; i < tabCount; i++) { Widget w = tp.getWidget(i); if (w == vp) { tb.setTabText(i, setProperty.getValue()); } } } } else if (uiObject instanceof QWindowPanel) { QWindowPanel p = (QWindowPanel) uiObject; p.setCaption(setProperty.getValue()); } } else if (QAMLConstants.PROPERTY_SELECTED_ROW.equals(setProperty.getProperty())) { if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject; try { int rowNr = Integer.parseInt(setProperty.getValue()); hasDataGridMethods.selectRow(rowNr); } catch (Exception e) { ClientApplicationContext.getInstance() .log("Set property on the datagrid selected row: the value (" + setProperty.getValue() + ") cannot be translated into an integer", e); } } } else if (QAMLConstants.PROPERTY_SELECTED.equals(setProperty.getProperty())) { if (uiObject instanceof CheckBox) { boolean value = Boolean.valueOf(setProperty.getValue()).booleanValue(); ((CheckBox) (uiObject)).setValue(value); } else if (uiObject instanceof ListBox) { ListBox listBox = (ListBox) uiObject; int size = listBox.getItemCount(); boolean selected = false; for (int i = 0; i < size && !selected; i++) { if (listBox.getValue(i).equals(setProperty.getValue())) { selected = true; listBox.setSelectedIndex(i); } } } } else if (QAMLConstants.PROPERTY_CURRENT_PAGE.equals(setProperty.getProperty())) { if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods dataGridSortableTable = (HasDataGridMethods) uiObject; try { if (setProperty.getValue() != null) { dataGridSortableTable.setCurrentPage(Integer.parseInt(setProperty.getValue())); } } catch (Exception e) { e.printStackTrace(); } } } else if (QAMLConstants.PROPERTY_PAGESIZE.equals(setProperty.getProperty())) { if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods dataGridSortableTable = (HasDataGridMethods) uiObject; try { if (setProperty.getValue() != null) { dataGridSortableTable.setPageSize(Integer.parseInt(setProperty.getValue())); } } catch (Exception e) { e.printStackTrace(); } } } else if (QAMLConstants.PROPERTY_MAX_TICKS.equals(setProperty.getProperty())) { if (uiObject instanceof QSliderBar) { QSliderBar slider = (QSliderBar) uiObject; slider.setMaxValue(Double.valueOf(setProperty.getValue())); } } else if (QAMLConstants.PROPERTY_MIN_TICKS.equals(setProperty.getProperty())) { if (uiObject instanceof QSliderBar) { QSliderBar slider = (QSliderBar) uiObject; slider.setMinValue(Double.valueOf(setProperty.getValue())); } } else if (QAMLConstants.PROPERTY_TICKSIZE.equals(setProperty.getProperty())) { if (uiObject instanceof QSliderBar) { QSliderBar slider = (QSliderBar) uiObject; slider.setStepSize(Integer.valueOf(setProperty.getValue())); } } else if (QAMLConstants.PROPERTY_TICK_LABELS.equals(setProperty.getProperty())) { if (uiObject instanceof QSliderBar) { QSliderBar slider = (QSliderBar) uiObject; slider.setTickLabels(Integer.valueOf(setProperty.getValue())); } } }
From source file:com.qualogy.qafe.gwt.client.vo.handlers.SetPropertyHandler.java
License:Apache License
private void handleDisplayName(UIObject uiObject, BuiltInComponentGVO builtInComponentGVO, String value) { if (uiObject instanceof HasDataGridMethods) { HasDataGridMethods hasDataGridMethods = (HasDataGridMethods) uiObject; String uuid = builtInComponentGVO.getComponentIdUUID(); if (uuid != null) { boolean containsColumn = uuid.contains("."); if (containsColumn) { String columnId = uuid.replaceFirst(".+\\.", "").replaceFirst("\\|.+", ""); hasDataGridMethods.setColumnLabel(columnId, value); }// ww w .java 2s.co m } } else if (uiObject instanceof PushButton) { ((PushButton) uiObject).getUpFace().setText(value); ((PushButton) uiObject).getDownFace().setText(value); } else if (uiObject instanceof HasText) { HasText t = (HasText) uiObject; t.setText(value); } else if (uiObject instanceof VerticalPanel) { VerticalPanel vp = (VerticalPanel) uiObject; Widget tabPanelWidget = vp.getParent().getParent().getParent(); if (tabPanelWidget instanceof TabPanel) { TabPanel tp = (TabPanel) tabPanelWidget; TabBar tb = tp.getTabBar(); int tabCount = tp.getWidgetCount(); for (int i = 0; i < tabCount; i++) { Widget w = tp.getWidget(i); if (w == vp) { tb.setTabText(i, value); } } } } else if (uiObject instanceof QWindowPanel) { QWindowPanel p = (QWindowPanel) uiObject; p.setCaption(value); } }
From source file:io.pelle.mango.client.gwt.modules.property.PropertyModuleUI.java
License:Open Source License
public PropertyModuleUI(PropertyModule module) { super(module, PropertyModule.UI_MODULE_ID); title = new HTML(MangoClientWeb.getInstance().getMessages().properties()); title.addStyleName(GwtStyles.TITLE); container.add(title);//from w w w . j a va 2s. c o m TabPanel categories = new TabPanel(); categories.setWidth("70%"); for (IPropertyCategory category : getModule().getRootCategory().getCategories()) { FlowPanel categoryPanel = new FlowPanel(); categoryPanel.getElement().getStyle().setMarginTop(1, Unit.EM); categories.add(categoryPanel, category.getName()); createProperties(categoryPanel, category); } if (categories.getWidgetCount() > 0) { categories.selectTab(0); container.add(categories); } }
From source file:org.dataconservancy.dcs.access.client.ui.UploadCollectionDialog.java
License:Apache License
public UploadCollectionDialog(final TabPanel files, final TabPanel dus, final List<String> fileids, final List<String> duids, final List<String> colids, String fileUploadUrl) { for (int i = 0; i < 3; i++) { files.setVisible(true);/* www . j ava 2s . c o m*/ String id = nextFileId(); fileids.add(id); files.add(new FileEditor(id, "test", "test"), id); files.selectTab(files.getWidgetCount() - 1); } for (int i = 0; i < 3; i++) { dus.setVisible(true); String id = nextDeliverableUnitId(); duids.add(id); dus.add(new DeliverableUnitEditor(id, fileids, duids, colids, null), id); dus.selectTab(dus.getWidgetCount() - 1); } }
From source file:org.freemedsoftware.gwt.client.Util.java
License:Open Source License
/** * Close all tabs from main window after logout * // ww w. jav a 2 s .c o m */ public static synchronized void closeAllTabs() { TabPanel t = CurrentState.getTabPanel(); while (t.getWidgetCount() > 1) { ScreenInterface screen = (ScreenInterface) t.getWidget(1); // Special handling for PatientScreen if (screen instanceof PatientScreen) { HashMap<Integer, PatientScreen> map = CurrentState.getPatientScreenMap(); Integer oldId = ((PatientScreen) screen).getPatient(); if (map.get(oldId) != null) { map.remove(oldId); } } screen.closeScreen(); } t.selectTab(0); }
From source file:org.pepstock.jem.gwt.client.commons.AbstractTabPanelInspector.java
License:Open Source License
@Override public final Panel getContent() { // gets tabpanel TabPanel panel = getTabPanel(); panel.setWidth(Sizes.toString(super.getAvailableWidth())); // calls all ResizeCapable with the right width and height for (int i = 0; i < panel.getWidgetCount(); i++) { Widget w = panel.getWidget(i);// w ww . j a v a 2s . com if (w instanceof ResizeCapable) { ResizeCapable rc = (ResizeCapable) w; rc.onResize(getAvailableWidth(), getAvailableHeight()); } } //adds tab panel VerticalPanel mainContainer = new VerticalPanel(); mainContainer.add(panel); return mainContainer; }