List of usage examples for com.google.gwt.user.client.ui DeckPanel showWidget
public void showWidget(int index)
From source file:com.google.appinventor.client.editor.simple.components.MockButtonBase.java
License:Open Source License
/** * Creates a new MockButtonBase component. * * @param editor editor of source file the component belongs to *//*from www.j a va 2s. c o m*/ MockButtonBase(SimpleEditor editor, String type, ImageResource icon) { super(editor, type, icon); // Initialize mock button UI buttonWidget = new Button(); buttonWidget.addStyleName("ode-SimpleMockButton"); image = new Image(); image.addErrorHandler(new ErrorHandler() { @Override public void onError(ErrorEvent event) { if (imagePropValue != null && !imagePropValue.isEmpty()) { OdeLog.elog("Error occurred while loading image " + imagePropValue); } refreshForm(); } }); image.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { refreshForm(); } }); DeckPanel deckPanel = new DeckPanel(); deckPanel.setStylePrimaryName("ode-SimpleMockComponent"); deckPanel.add(buttonWidget); deckPanel.add(image); deckPanel.showWidget(0); initComponent(deckPanel); }
From source file:com.mcherm.zithiacharsheet.client.ZithiaCharsheetEntryPoint.java
License:Apache License
/** * This is the entry point method./*www. j a v a2 s.c o m*/ */ public void onModuleLoad() { // -- Create widgets -- final DeckPanel mainPanel = new DeckPanel(); RootPanel.get("charsheet").add(mainPanel); // -- Set up the card in the deck for showing the list -- mainPanel.add(new CharacterList(new CharacterList.ButtonActions() { public void onGoButton(CharacterMetadata metadata) { mainPanel.showWidget(1); // Show the character sheet zithiaCharsheet.setCharacterId(metadata.getId(), new FailureAction() { public void onFailure(Throwable caught) { Window.alert("Load of character failed: " + caught); mainPanel.showWidget(0); } }); } public void onNewButton() { mainPanel.showWidget(1); // Show the character sheet // FIXME: Maybe we need to empty it out; for now we won't. zithiaCharsheet.saveAsNewCharacter(); } })); mainPanel.add(zithiaCharsheet); mainPanel.showWidget(0); // Show the select list }
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();//w w w . j av a 2s . c o m 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.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. j a va2 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;//from w w w .ja va 2 s .c om } 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:edu.caltech.ipac.firefly.core.layout.AbstractLayoutManager.java
protected Widget makeCenter() { final DockPanel resultsView = new DockPanel(); resultsView.setSize("100%", "100%"); final BaseRegion content = new BaseRegion(CONTENT_REGION); Widget w = content.getDisplay();//from ww w .j ava2s . c o m w.setWidth("100%"); addRegion(content); final Region query = getForm(); final Region results = getResult(); final Region title = getSearchTitle(); final Region desc = getSearchDesc(); GwtUtil.ImageButton img = GwtUtil.makeImageButton("images/disclosurePanelClosed.png", "Return to search", new ClickHandler() { public void onClick(ClickEvent event) { Application.getInstance().processRequest(new Request(SearchCmd.COMMAND_NAME)); } }); boolean backToArrow = Application.getInstance().getProperties() .getBooleanProperty("BackToSearch.arrow.show", true); boolean searchDescLine = Application.getInstance().getProperties().getBooleanProperty("BackToSearch.show", true); final HorizontalPanel ttdesc = new HorizontalPanel(); if (title != null && searchDescLine) { ttdesc.setWidth("100%"); if (backToArrow) { ttdesc.add(img); } ttdesc.add(title.getDisplay()); ttdesc.add(desc.getDisplay()); ttdesc.setCellWidth(desc.getDisplay(), "100%"); ttdesc.add(layoutSelector); WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() { public void eventNotify(WebEvent ev) { ttdesc.setVisible(Application.getInstance().hasSearchResult()); } }); } // final Region download = getDownload(); VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); if (query.getDisplay() != null) { vp.add(query.getDisplay()); } if (searchDescLine) vp.add(ttdesc); resultsView.add(vp, DockPanel.NORTH); resultsView.setCellHeight(vp, "10px"); resultsView.add(results.getDisplay(), DockPanel.CENTER); resultsView.add(content.getDisplay(), DockPanel.SOUTH); WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() { public void eventNotify(WebEvent ev) { Region source = (Region) ev.getSource(); if (DROPDOWN_REGION.equals(source.getId()) || RESULT_REGION.equals(source.getId())) { content.hide(); resultsView.setCellHeight(results.getDisplay(), "100%"); resultsView.setCellHeight(content.getDisplay(), ""); } else if (CONTENT_REGION.equals(source.getId())) { query.hide(); results.hide(); resultsView.setCellHeight(content.getDisplay(), "100%"); resultsView.setCellHeight(results.getDisplay(), ""); } } }); Region popoutRegion = getRegion(POPOUT_REGION); // SimplePanel popoutView = new SimplePanel(); // popoutView.add(popoutRegion.getDisplay()); final DeckPanel center = new DeckPanel(); center.add(resultsView); center.add(popoutRegion.getDisplay()); WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() { public void eventNotify(WebEvent ev) { Region source = (Region) ev.getSource(); if (POPOUT_REGION.equals(source.getId())) { center.showWidget(1); } else if (RESULT_REGION.equals(source.getId())) { center.showWidget(0); } } }); WebEventManager.getAppEvManager().addListener(Name.REGION_HIDE, new WebEventListener() { public void eventNotify(WebEvent ev) { Region source = (Region) ev.getSource(); if (POPOUT_REGION.equals(source.getId())) { center.showWidget(0); } } }); center.showWidget(0); return center; }
From source file:edu.caltech.ipac.firefly.core.layout.IrsaLayoutManager.java
public void layout(String rootId) { AllPlots.getInstance().setToolBarIsPopup(false); init();//from ww w . j a v a 2 s. c o m Region menuBar = getRegion(LayoutManager.MENU_REGION); Region appIcon = getRegion(LayoutManager.APP_ICON_REGION); Region adtlIcon = getRegion(LayoutManager.ADDTL_ICON_REGION); Region visTB = getRegion(LayoutManager.VIS_TOOLBAR_REGION); Region visRO = getRegion(LayoutManager.VIS_READOUT_REGION); Region visPV = getRegion(LayoutManager.VIS_PREVIEW_REGION); Widget pvOrIcoArea = visPV.getDisplay(); if (adtlIcon != null) { final DeckPanel previewOrAddlIcon = new DeckPanel(); previewOrAddlIcon.add(adtlIcon.getDisplay()); // idx 0 previewOrAddlIcon.add(visPV.getDisplay()); // idx 1 WebEventManager.getAppEvManager().addListener(Name.REGION_SHOW, new WebEventListener() { public void eventNotify(WebEvent ev) { Region source = (Region) ev.getSource(); if (VIS_PREVIEW_REGION.equals(source.getId())) { previewOrAddlIcon.showWidget(1); } else if (ADDTL_ICON_REGION.equals(source.getId())) { previewOrAddlIcon.showWidget(0); } else if (RESULT_REGION.equals(source.getId())) { // do nothing } } }); WebEventManager.getAppEvManager().addListener(Name.REGION_HIDE, new WebEventListener() { public void eventNotify(WebEvent ev) { Region source = (Region) ev.getSource(); if (VIS_PREVIEW_REGION.equals(source.getId())) { previewOrAddlIcon.showWidget(0); } } }); pvOrIcoArea = previewOrAddlIcon; } Widget readout = visRO == null ? new Label("") : visRO.getDisplay(); readout.setSize("100%", "100%"); HTMLPanel appBanner = new HTMLPanel("<div id='container' style='width:100%'>\n" + "<div id='app-icon' style='background: url(images/ipac_bar.jpg);height:75px;width:75px;float:left;'></div>\n" + "<div id='alt-app-icon' style='background: url(images/ipac_bar.jpg);height:75px;width:148px;float:right;'></div>\n" + "<div style='position:absolute;left:75px;right:148px;min-width:820px'>\n" + "<div id='readout' style='background: url(images/ipac_bar.jpg);height:45px;width:100%;'></div>\n" + "<div id='menu-bar' style='background: url(images/ipac_bar.jpg);height:30px;width:100%'></div>\n" + "</div>\n"); appBanner.add(menuBar.getDisplay(), "menu-bar"); appBanner.add(readout, "readout"); appBanner.add(appIcon.getDisplay(), "app-icon"); appBanner.add(pvOrIcoArea, "alt-app-icon"); // // now.. add the menu to the top Toolbar toolbar = Application.getInstance().getToolBar(); GwtUtil.setStyles(toolbar, "width", "100%", "position", "absolute"); GwtUtil.setStyles(toolbar.getDropdown(), "zIndex", "10", "position", "absolute"); getMenu().setDisplay(toolbar); mainPanel.add(appBanner, DockPanel.NORTH); mainPanel.setCellHeight(appBanner, "1px"); mainPanel.add(toolbar.getDropdown(), DockPanel.NORTH); mainPanel.setCellHeight(toolbar.getDropdown(), "1px"); // mainPanel.setCellHeight(toolbar.getDropDownComponent(), "1px"); mainPanel.add(visTB.getDisplay(), DockPanel.NORTH); mainPanel.setCellHeight(visTB.getDisplay(), "1px"); mainPanel.setSize("100%", "100%"); // making results area. Widget center = makeCenter(); mainPanel.add(center, DockPanel.CENTER); GwtUtil.setStyles(center, "position", "absolute", "left", "10px", "right", "10px", "top", "120px", "bottom", "1px"); if (rootId != null) { RootPanel root = RootPanel.get(rootId); if (root == null) { throw new RuntimeException("Application is not setup correctly; unable to find " + rootId); } root.add(mainPanel); GwtUtil.setStyles(root, "position", "absolute", "top", topOffset + "px", "left", "1px", "right", "1px", "bottom", "1px", "minWidth", getMinWidth() + "px", "minHeight", getMinHeight() + "px"); } else { RootPanel.get().add(mainPanel); } Image icon = Application.getInstance().getCreator().getMissionIcon(); if (icon != null) { icon.setSize("75px", "75px"); getRegion(APP_ICON_REGION).setDisplay(icon); } }
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(); }// w w w . java2s .c o m 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.jboss.bpm.console.client.process.ProcessDetailView.java
License:Open Source License
public ProcessDetailView() { //TODO -Rikkola- // super("Process details"); super.setStyleName("bpm-detail-panel"); grid = new PropertyGrid(new String[] { "ID:", "Key:", "Name:", "Suspended:", "Package:", "Description:" }); // properties final DeckPanel deck = new DeckPanel(); deck.add(grid);//w w w . j a va 2 s. c o m // selection final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false); dropBox.setStyleName("bpm-operation-ui"); dropBox.addItem("Properties"); // deployment info if (ServerPlugins.has("org.jboss.bpm.console.server.plugin.ProcessEnginePlugin")) { dropBox.addItem("Deployment"); deploymentPanel = new DeploymentPanel(); deck.add(deploymentPanel); } dropBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { deck.showWidget(dropBox.getSelectedIndex()); } }); //TODO: -Rikkola- // this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT); this.add(deck); deck.showWidget(dropBox.getSelectedIndex()); this.add(deck); }
From source file:org.jboss.bpm.console.client.task.TaskDetailView.java
License:Open Source License
public void initialize() { if (!this.initialzed) { grid = new PropertyGrid(new String[] { "ID:", "Process:", "Name:", "Assignee:", "Description:" }); if (openView) { // properties final DeckPanel deck = new DeckPanel(); deck.add(grid);/*from w w w.j a v a 2 s . c o m*/ // participants participantPanel = new ParticipantPanel(); participantPanel.setController(controller); // selection final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox( false); dropBox.setStyleName("bpm-operation-ui"); dropBox.addItem("Properties"); dropBox.addItem("Participants"); dropBox.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { deck.showWidget(dropBox.getSelectedIndex()); } }); deck.add(participantPanel); // TODO: -Rikkola- // this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT); this.add(deck); deck.showWidget(dropBox.getSelectedIndex()); } else { SimplePanel p = new SimplePanel(); p.add(grid); this.add(p); } this.initialzed = true; } }