List of usage examples for com.google.gwt.user.client.ui DeckPanel getWidgetIndex
public int getWidgetIndex(IsWidget child)
From source file:com.qualogy.qafe.gwt.client.vo.functions.execute.FocusExecute.java
License:Apache License
private void makeParentsVisible(Widget w) { if (w.getParent() != null) { Widget parent = w.getParent();//www . ja va 2 s.c om makeParentsVisible(parent); if (parent instanceof DeckPanel) { DeckPanel dp = (DeckPanel) parent; dp.showWidget(dp.getWidgetIndex(w)); ((TabPanel) dp.getParent().getParent()).selectTab(dp.getWidgetIndex(w)); } } }
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 ww w . j a v a 2 s . c o 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.functions.execute.SetValueExecute.java
License:Apache License
private static void processAttributes(UIObject uiObject, String valueToSet, List<String> attributes, SetValueGVO setValue, DataContainerGVO valueDTC) { if (uiObject != null && attributes != null) { Iterator<String> itr = attributes.iterator(); while (itr.hasNext()) { String attribute = itr.next(); if ("tooltip".equals(attribute)) { if (uiObject instanceof TitledComponent) { TitledComponent titledComponent = (TitledComponent) uiObject; titledComponent.getTitleComponent().setTitle(valueToSet); } else { uiObject.setTitle(valueToSet); }//ww w. jav a 2 s. c o m } else if ("title".equals(attribute)) { if (uiObject instanceof CaptionLayoutPanel) { CaptionLayoutPanel titledPanel = (CaptionLayoutPanel) uiObject; titledPanel.setTitle(valueToSet); } else 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) { deckPanel.showWidget(widgetIndex); } } } } else if ("prompt".equals(attribute)) { if (uiObject instanceof HasPrompt) { HasPrompt hasPrompt = (HasPrompt) uiObject; hasPrompt.setPrompt(valueToSet); } else if (uiObject instanceof CheckBox) { ((CheckBox) uiObject).setText(valueToSet); } } else if ("value".equals(attribute)) { processValue(uiObject, valueToSet, setValue, valueDTC); } } } }
From source file:com.qualogy.qafe.gwt.client.vo.handlers.FocusHandler.java
License:Apache License
private void makeParentVisible(Widget widget) { if (widget == null) { return;/* w w w.j av a 2 s .c o m*/ } Widget parent = widget.getParent(); if (parent == null) { return; } makeParentVisible(parent); if (parent instanceof DeckPanel) { DeckPanel deckPanel = (DeckPanel) parent; int widgetIndex = deckPanel.getWidgetIndex(widget); deckPanel.showWidget(widgetIndex); TabPanel tabPanel = (TabPanel) deckPanel.getParent().getParent(); tabPanel.selectTab(widgetIndex); } }
From source file:com.qualogy.qafe.gwt.client.vo.handlers.SetPropertyHandler.java
License:Apache License
private void handleVisible(UIObject uiObject, BuiltInComponentGVO builtInComponentGVO, String setPropertyValue) { boolean value = Boolean.valueOf(setPropertyValue).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;/*w w w .ja va 2 s.co m*/ } } 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); } } } } } }
From source file:org.apache.solr.explorer.client.plugin.listview.ui.HitBox.java
License:Apache License
public HitBox(SearchResult result, final Hit hit, SolrCore solrCore, List<HitBoxTab> tabs, List<HitBoxLink> links) { SolrCoreConfiguration configuration = solrCore.getConfiguration(); ListViewConfig renderingConfig = configuration.getConfig(ListViewConfig.class); VerticalPanel content = new VerticalPanel(); String titleField = renderingConfig.getTitleFieldName(); String title = (String) hit.get(titleField); if (title == null) { title = renderingConfig.getDefaultTitle(); }/*from w w w. j a va 2 s . com*/ Label titleLabel = new HTML(title); titleLabel.setStyleName("HitTitle"); content.add(titleLabel); String summaryField = renderingConfig.getSummaryFieldName(); String summary = (String) hit.get(summaryField); if (summary == null) { summary = renderingConfig.getDefaultSummary(); } FlowPanel summaryPane = new FlowPanel(); Thumbnail thumbnail = renderingConfig.getThumbnail(); if (thumbnail != null) { Template urlTemplate = thumbnail.getUrlTemplate(); final String thumbnailUrl = urlTemplate.render(new MapModel(hit)); final Image image = new Image(); image.setVisible(false); image.setWidth(thumbnail.getWidth()); image.setHeight(thumbnail.getHeight()); image.setStylePrimaryName("HitThumbnail"); image.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent event) { image.setVisible(true); } }); image.addErrorHandler(new ErrorHandler() { public void onError(ErrorEvent event) { image.removeFromParent(); } }); summaryPane.add(image); // the url of the image needs to be set in a delay so that IE will pick up the load events!!! DeferredCommand.addCommand(new Command() { public void execute() { image.setUrl(thumbnailUrl); } }); } CollapsableLabel descriptionLabel = new CollapsableLabel(summary, true, renderingConfig.getSummaryLength()); descriptionLabel.setStyleName("HitDescription"); summaryPane.add(descriptionLabel); content.add(summaryPane); String urlField = renderingConfig.getUrlFieldName(); String url = (String) hit.get(urlField); if (url == null || url.length() == 0) { url = "<no URL>"; } final String finalUrl = URL.encode(url); final String finalTitle = title; Label urlLabel = new Label(url); urlLabel.setStyleName("HitUrl"); urlLabel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { GWT.log("final url: " + finalUrl, null); if (finalUrl.startsWith("http://") || finalUrl.startsWith("https://")) { Window.open(finalUrl, finalTitle, null); } else { Window.open("http://" + finalUrl, finalTitle, null); } } }); HorizontalPanel toolbar = new HorizontalPanel(); toolbar.setStyleName("Toolbar"); toolbar.add(urlLabel); content.add(toolbar); addGap(toolbar, "2px"); toolbar.add(new Label("-")); addGap(toolbar, "2px"); toolbar.add(new Label("-")); addGap(toolbar, "2px"); final DeckPanel tabContentHolder = new DeckPanel(); // tabContentHolder.setVisible(false); tabContentHolder.setAnimationEnabled(true); final SimplePanel emptyPanel = new SimplePanel(); tabContentHolder.add(emptyPanel); tabContentHolder.showWidget(0); for (HitBoxTab tab : tabs) { if (!tab.isActive() || !tab.isEnabled(result, hit)) { continue; } final Widget tabContent = tab.createWidget(result, hit); tabContentHolder.add(tabContent); final int index = tabContentHolder.getWidgetIndex(tabContent); final SimpleLinkButton link = new SimpleLinkButton(tab.getName()); link.setStyleName("ToolbarLink"); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (shownTabIndex == index) { shownTabIndex = 0; tabContentHolder.showWidget(0); } else { tabContentHolder.showWidget(index); shownTabIndex = index; } // if (button.isDown()) { // tabContentHolder.setVisible(true); // // } else { // tabContentHolder.setVisible(false); // } } }); addGap(toolbar, "5px"); toolbar.add(link); } content.add(tabContentHolder); // tabContentHolder.setVisible(false); for (HitBoxLink link : links) { if (!link.isActive() || !link.isEnabled(hit)) { continue; } SimpleLinkButton button = new SimpleLinkButton(link.getName()); button.setStyleName("ToolbarLink"); button.addClickHandler(link.createHandler(hit)); addGap(toolbar, "5px"); toolbar.add(button); } initWidget(content); setStyleName("HitBox"); }
From source file:org.pentaho.mantle.client.ui.PerspectiveManager.java
License:Open Source License
private void showOpenedPerspective(boolean browserChecked, boolean schedulesChecked) { DeckPanel contentDeck = MantleApplication.getInstance().getContentDeck(); if (MantleApplication.getInstance().getContentDeck() .getWidgetIndex(SolutionBrowserPanel.getInstance()) == -1) { contentDeck.add(SolutionBrowserPanel.getInstance()); }//from w w w .j av a 2s.com // show stuff we've created/configured contentDeck.showWidget(contentDeck.getWidgetIndex(SolutionBrowserPanel.getInstance())); SolutionBrowserPanel.getInstance() .setNavigatorShowing(SolutionBrowserPanel.getInstance().isNavigatorShowing()); setCheckMMenuItem(browserChecked, schedulesChecked); }
From source file:org.pentaho.mantle.client.ui.PerspectiveManager.java
License:Open Source License
private void showSchedulesPerspective() { GWT.runAsync(new RunAsyncCallback() { public void onSuccess() { DeckPanel contentDeck = MantleApplication.getInstance().getContentDeck(); if (MantleApplication.getInstance().getContentDeck() .getWidgetIndex(SchedulesPerspectivePanel.getInstance()) == -1) { contentDeck.add(SchedulesPerspectivePanel.getInstance()); } else { SchedulesPerspectivePanel.getInstance().refresh(); }//from w w w . ja va 2s . c o m contentDeck.showWidget(contentDeck.getWidgetIndex(SchedulesPerspectivePanel.getInstance())); } public void onFailure(Throwable reason) { } }); setCheckMMenuItem(false, true); }
From source file:org.pentaho.mantle.client.ui.PerspectiveManager.java
License:Open Source License
private void showAdminPerspective(boolean browserChecked, boolean schedulesChecked) { DeckPanel contentDeck = MantleApplication.getInstance().getContentDeck(); if (MantleApplication.getInstance().getContentDeck() .getWidgetIndex(MantleXul.getInstance().getAdminPerspective()) == -1) { contentDeck.add(MantleXul.getInstance().getAdminPerspective()); }/*w ww .j a v a2 s . c om*/ contentDeck.showWidget(contentDeck.getWidgetIndex(MantleXul.getInstance().getAdminPerspective())); MantleXul.getInstance().customizeAdminStyle(); MantleXul.getInstance().configureAdminCatTree(); // disable Browser and schedules menuItem setCheckMMenuItem(browserChecked, schedulesChecked); }
From source file:org.pentaho.mantle.client.ui.xul.MantleModel.java
License:Open Source License
@Bindable public void loadSettingsPanel() { GWT.runAsync(new RunAsyncCallback() { public void onSuccess() { DeckPanel contentDeck = MantleXul.getInstance().getAdminContentDeck(); if (contentDeck.getWidgetIndex(ContentCleanerPanel.getInstance()) == -1) { contentDeck.add(ContentCleanerPanel.getInstance()); }//from w w w . j a v a 2 s. c o m contentDeck.showWidget(contentDeck.getWidgetIndex(ContentCleanerPanel.getInstance())); } public void onFailure(Throwable reason) { } }); }