List of usage examples for com.google.gwt.user.client.ui DeckPanel add
@Override public void add(Widget w)
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 ww w .j av a 2s .c om*/ 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./*from w w w. java 2 s. co 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: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 w w w . j a v a 2 s .com*/ 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 w w w . j a v a 2 s. co 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(); }//from w w w . j ava 2s .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); // selection/*w ww. j a v a2 s . com*/ 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); // 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);/*from w w w. j a v a 2 s . co m*/ 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; } }
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()); }// www . ja va2 s . 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 . j a v a 2 s .com 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()); }/*from w ww .jav a 2s . c om*/ contentDeck.showWidget(contentDeck.getWidgetIndex(MantleXul.getInstance().getAdminPerspective())); MantleXul.getInstance().customizeAdminStyle(); MantleXul.getInstance().configureAdminCatTree(); // disable Browser and schedules menuItem setCheckMMenuItem(browserChecked, schedulesChecked); }