List of usage examples for com.google.gwt.user.client.ui TabLayoutPanel TabLayoutPanel
public TabLayoutPanel(double barHeight, Unit barUnit)
From source file:cc.kune.core.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel.java
License:GNU Affero Public License
/** * Creates the dialog.//from w w w. j av a 2 s.com */ private void createDialog() { final Builder builder = new BasicTopDialog.Builder(dialogId, autohide, modal, direction).autoscroll(true) .icon(iconCls).firstButtonId(firstBtnId).firstButtonTitle(firstBtnTitle).sndButtonTitle(sndBtnTitle) .sndButtonId(sndBtnId).title(title); if (width != NO_SIZE) { builder.width(String.valueOf(width + 20) + "px"); } if (height != NO_SIZE) { builder.height(String.valueOf(height + 20) + "px"); } dialog = builder.build(); if (icon != null) { dialog.setTitleIcon(icon); } messageErrorBar = new MessageToolbar(images, errorLabelId); tabPanel = new TabLayoutPanel(25, Unit.PX); // tabPanel.addStyleName("oc-noselect"); dialog.getInnerPanel().add(tabPanel); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(final SelectionEvent<Integer> event) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { dialog.showCentered(); } }); } }); provCollection.createAll(); if (width != NO_SIZE) { tabPanel.setWidth(String.valueOf(width) + "px"); } if (height != NO_SIZE) { tabPanel.setHeight(String.valueOf(height) + "px"); } tabPanel.addStyleName("k-tabpanel-aditionalpadding"); tabPanel.addStyleName("k-tabs"); dialog.getFirstBtn().addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { hide(); } }); }
From source file:com.akjava.gwt.subplayer.client.SubPlayer.java
License:Apache License
@Override public void onModuleLoad() { //pre load resource ImageResource icon = Binder.INSTANCE.loadanime(); loadImg = new Image(icon); loadImg.setVisible(false);/*from ww w . jav a 2s.com*/ loadImg.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { RootPanel.get().remove(loadImg); loadImg.setVisible(true); } }); RootPanel.get().add(loadImg); preference = new SubPlayerPreference(); preference.initialize(); tab = new TabLayoutPanel(2, Unit.EM); tab.setHeight("500px"); VerticalPanel root = new VerticalPanel(); root.setWidth("100%"); root.setHeight("100%"); //root.setHeight("200px"); DockLayoutPanel doc = new DockLayoutPanel(Unit.PX); doc.addSouth(new HTMLPanel( "<div align='center'>Subtitle TTS Player by <a href='http://www.akjava.com'>akjava.com</a></div>"), 40); doc.add(tab); RootLayoutPanel.get().add(doc); //RootLayoutPanel.get().add(new Label("hello")); tab.add(root, "PLAY"); noSubtitle = new Label("Subtitle is empty.load from Load tab"); noSubtitle.setStyleName("nosubtitle"); root.add(noSubtitle); loadPanel = new LoadPanel(); loadPanel.setWidth("100%"); loadPanel.setHeight("100%"); tab.add(loadPanel, "LOAD"); loadPanel.setText(preference.getSrtText()); itemPanel = new VerticalPanel(); itemPanel.setSpacing(8); itemPanelScroll = new ScrollPanel(itemPanel); itemPanelScroll.setWidth("100%"); itemPanelScroll.setHeight("350px"); root.add(itemPanelScroll); /* for(int i=0;i<5;i++){ String text=i+" hello world\n"; for(int j=0;j<i;j++){ text+="line\n"; } HTMLPanel label=new HTMLPanel(text.replace("\n", "<br/>")); FocusPanel panel=new FocusPanel(label); panel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { unselectAll(); setlectWidget((Widget) event.getSource()); } }); //label.setHeight("100px"); itemPanel.add(panel); }*/ playerWidget = new PlayerWidget(this); root.add(playerWidget); DisclosurePanel ds = new DisclosurePanel("show subtitle time [start] - [end]"); timeLabel = new Label(); ds.add(timeLabel); //ds.add(new Label("0:0:0 - 0:0:12")); root.add(ds); selectWidgetHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { unselectAll(); setlectWidget((Widget) event.getSource()); } }; DisclosurePanel vs = new DisclosurePanel("Voice Settings"); root.add(vs); voiceSettings = new VoiceSettings(); vs.add(voiceSettings); //load data from preferences //if empty load mode. if (!loadPanel.getText().isEmpty()) { loadSrt(preference.getSrtSelectIndex()); } else { tab.selectTab(1); } }
From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.AdminConsole.java
License:Apache License
public AdminConsole(DashboardController controller) { this.controller = controller; tabPanel = new TabLayoutPanel(2.5, Unit.EM); tabPanel.setAnimationDuration(200);//from www .ja v a2 s . c o m // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX); HTML metricGroupText = new HTML("METRIC GROUPS"); tabPanel.add(new MetricsTab(controller), metricGroupText); HTML rolesText = new HTML("ROLES"); tabPanel.add(new RolesTab(controller), rolesText); // Add a tab HTML moreInfo = new HTML("CHARTS"); tabPanel.add(new ChartsTab(controller), moreInfo); // Return the content tabPanel.selectTab(0); // tabPanel.ensureDebugId("cwTabPanel"); HorizontalPanel buttonPanel = new HorizontalPanel(); // buttonPanel.setWidth("20%"); buttonPanel.setSpacing(4); Image image = new Image(MdConstants.IMG_OK_CHECK); image.setSize("24px", "24px"); PushButton saveButton = new PushButton(image); saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { AdminConsole.this.hide(); } }); image = new Image(MdConstants.IMG_CANCEL_X); image.setSize("24px", "24px"); PushButton closeButton = new PushButton(image); closeButton.setTitle("Cancel"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { AdminConsole.this.hide(); } }); buttonPanel.add(saveButton); buttonPanel.add(closeButton); VerticalPanel mainPanel = new VerticalPanel(); // mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); mainPanel.add(tabPanel); mainPanel.add(buttonPanel); mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER); tabPanel.setHeight("400px"); tabPanel.setWidth("700px"); this.setHeight("400px"); this.setWidth("550px"); this.setText("Admin Console"); this.setWidget(mainPanel); this.setModal(true); this.setGlassEnabled(true); this.center(); }
From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartWidget.java
License:Apache License
public ChartWidget(DashboardController dashboardController, DashboardSettings dashboardSettings, ChartSettings chartSettings) {//from w w w .j a v a 2s.c o m this.controller = dashboardController; String id = "chartWidget" + widgetId++; this.getElement().setId(id); tabPanel = new TabLayoutPanel(28, Unit.PX); tabPanel.setAnimationDuration(100); // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX); // tabPanel.ensureDebugId("cwTabPanel"); this.setText("New Chart"); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setSpacing(4); Image image = new Image(MdConstants.IMG_OK_CHECK); image.getElement().setId(id + "OkButtonImage"); image.setSize("24px", "24px"); PushButton okButton = new PushButton(image); okButton.getElement().setId(this.getElement().getId() + "OkButton"); okButton.setTitle("Build Chart"); okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { clickOkButton(); } }); image = new Image(MdConstants.IMG_CANCEL_X); image.setSize("24px", "24px"); image.getElement().setId(id + "CloseButtonImage"); PushButton closeButton = new PushButton(image); closeButton.getElement().setId(this.getElement().getId() + "CloseButton"); closeButton.setTitle("Cancel"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { controller.getWidgetController().removeWidget(ChartWidget.this); } }); buttonPanel.add(okButton); buttonPanel.add(closeButton); // HTML metricGroupText = new HTML("EDIT"); chartEditorPanel = new ChartEditorPanel(this, controller, dashboardSettings, chartSettings); // When there is a value for chart settings, it means it was loaded form the server. // Click Ok button programatically to load chart if (chartSettings != null) { clickOkButton(); setText(chartSettings.getTitle()); } Image editImage = new Image(MdConstants.IMG_PENCIL); editImage.getElement().setId("editTabImage"); editImage.setSize("16px", "16px"); editImage.getElement().setId("editImage"); tabPanel.add(chartEditorPanel, editImage); // HTML rolesText = new HTML("VIEW"); Image viewImage = new Image(MdConstants.IMG_VIEW_EYE); viewImage.getElement().setId("viewTabImage"); viewImage.setSize("16px", "16px"); // chartViewerPanel = new ChartViewerPanel(id); chartContainer = new VerticalPanel(); // Initialize this to an empty panel chartViewPanel = new EmptyChartPanel(); // chartViewPanel.setBorderWidth(2); chartViewPanel.setSpacing(2); chartViewPanel.setWidth("100%"); // chartContainer.setBorderWidth(2); chartContainer.setSpacing(2); chartContainer.setWidth("100%"); chartContainer.setHeight("100%"); chartContainer.add(chartViewPanel); tabPanel.add(chartContainer, viewImage); // Return the content tabPanel.selectTab(0); tabPanel.getElement().setId(id + "TabPanel"); tabPanel.setHeight("455px"); tabPanel.setWidth("505px"); this.setHeight("530"); this.setWidth("500px"); VerticalPanel mainPanel = new VerticalPanel(); mainPanel.add(tabPanel); mainPanel.add(buttonPanel); mainPanel.setCellVerticalAlignment(buttonPanel, HasVerticalAlignment.ALIGN_MIDDLE); mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER); mainPanel.setWidth("100%"); mainPanel.setHeight("100%"); this.setWidget(mainPanel); this.setModal(false); }
From source file:com.ephesoft.dcma.gwt.home.client.view.LandingView.java
License:Open Source License
/** * To build the Landing Page.// w w w. j a v a 2 s . co m * * @return FocusPanel */ public FocusPanel buildLandingPage() { focusPanel = new FocusPanel(); flowpanel = new DockLayoutPanel(Unit.PCT); flowpanel.setHeight(HUNDRED_PERCENT); flowpanel.addStyleName(CoreCommonConstants.MAIN_CONTAINER_CSS); HorizontalPanel horCapPanel = new HorizontalPanel(); VerticalPanel innerVerPanel = new VerticalPanel(); innerVerPanel.setWidth(CoreCommonConstants._100_PERCENTAGE); VerticalPanel capPanel = new VerticalPanel(); capPanel.setStyleName(CoreCommonConstants.TOP_PANEL_CSS); HorizontalPanel title = new HorizontalPanel(); title.setBorderWidth(0); title.setSize(HUNDRED_PERCENT, HUNDRED_PERCENT); Label titleLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_BATCH_ALERTS)); title.add(titleLabel); titleLabel.addStyleName(CoreCommonConstants.HEADER_BOLD_TEXT_CSS); capPanel.add(titleLabel); HorizontalPanel simPanel = new HorizontalPanel(); simPanel.setSize(HUNDRED_PERCENT, HUNDRED_PERCENT); Label pendingForReviewLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PEND_FOR_REVIEW) + ": "); pendingForReviewLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS); pendingForReviewLabelValue = new Label(""); Label pendingForValidationLabel = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PEND_FOR_VALIDATION) + ": "); pendingForValidationLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS); pendingForValidationLabelValue = new Label(""); Label totalBatchCount = new Label( LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_TOTAL_BATCHES) + ": "); totalBatchCount.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS); totalBatchValue = new Label(BatchListConstants.EMPTY_STRING); Label pipe = new Label(BatchListConstants.EMPTY_STRING); pipe.setStyleName("pipe"); simPanel.add(totalBatchCount); simPanel.add(totalBatchValue); simPanel.add(pipe); simPanel.add(pendingForReviewLabel); simPanel.add(pendingForReviewLabelValue); simPanel.add(pendingForValidationLabel); simPanel.add(pendingForValidationLabelValue); simPanel.setCellWidth(pendingForReviewLabel, "7%"); simPanel.setCellWidth(pendingForReviewLabelValue, "2%"); simPanel.setCellWidth(pendingForValidationLabel, "7%"); simPanel.setCellWidth(pendingForValidationLabelValue, "20%"); simPanel.setCellWidth(totalBatchCount, "5%"); simPanel.setCellWidth(totalBatchValue, "2%"); simPanel.setCellWidth(pipe, "1%"); capPanel.add(simPanel); capPanel.setWidth(HUNDRED_PERCENT); innerVerPanel.add(capPanel); Label dummyLabel = new Label(); dummyLabel.setHeight("40px"); innerVerPanel.add(dummyLabel); HorizontalPanel buttonTextPanel = new HorizontalPanel(); buttonTextPanel.add(dummyLabel); buttonTextPanel.setCellWidth(dummyLabel, "20%"); innerVerPanel.add(buttonTextPanel); horCapPanel.add(innerVerPanel); horCapPanel.setCellHorizontalAlignment(innerVerPanel, HasAlignment.ALIGN_LEFT); horCapPanel.setWidth(HUNDRED_PERCENT); flowpanel.addNorth(horCapPanel, BatchListConstants.FIFTEEN); reviewTable = new ReviewValidateTable(true); reviewValidateTabLayoutPanel = new TabLayoutPanel(BatchListConstants.FIVE, Unit.PCT); reviewValidateTabLayoutPanel.setWidth(CoreCommonConstants._100_PERCENTAGE); reviewValidateTabLayoutPanel.add(reviewTable.getMainPanel()); validateTable = new ReviewValidateTable(false); reviewValidateTabLayoutPanel.add(validateTable.getMainPanel(), ""); flowpanel.add(reviewValidateTabLayoutPanel); focusPanel.add(flowpanel); focusPanel.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent arg0) { presenter.getController().getEventBus().fireEvent(new BatchListKeyDownEvent(arg0)); } }); return focusPanel; }
From source file:com.github.tdesjardins.ol3.demo.client.GwtOL3Playground.java
License:Apache License
@Override public void onModuleLoad() { // choose your example TabLayoutPanel tabs = new TabLayoutPanel(27, Style.Unit.PX); for (OL3ExampleType example : OL3ExampleType.values()) { tabs.add(new LazyExampleWidget(example), example.name().replace("Example", "")); }//from w w w .j a va 2 s .co m RootLayoutPanel.get().add(tabs); }
From source file:com.github.tdesjardins.ol3.demo.client.GwtOLPlayground.java
License:Apache License
@Override public void onModuleLoad() { Map<String, Integer> exampleIndexMap = new HashMap<>(); // choose your example TabLayoutPanel tabs = new TabLayoutPanel(27, Style.Unit.PX); int index = 0; for (OLExampleType example : OLExampleType.values()) { tabs.add(new LazyExampleWidget(example), example.name().replace("Example", "")); exampleIndexMap.put(example.name(), index); index++;//from ww w . j a va 2 s. c o m } RootLayoutPanel.get().add(tabs); String token = History.getToken(); if (token != null && exampleIndexMap.containsKey(token)) { tabs.selectTab(exampleIndexMap.get(token)); } }
From source file:com.google.gwt.examples.TabLayoutPanelExample.java
License:Apache License
public void onModuleLoad() { // Create a three-item tab panel, with the tab area 1.5em tall. TabLayoutPanel p = new TabLayoutPanel(1.5, Unit.EM); p.add(new HTML("this"), "[this]"); p.add(new HTML("that"), "[that]"); p.add(new HTML("the other"), "[the other]"); // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for // resize events on the window to ensure that its children are informed of // possible size changes. RootLayoutPanel rp = RootLayoutPanel.get(); rp.add(p);//from ww w . ja v a 2s .c o m }
From source file:com.google.gwt.gadgets.sample.traveler.client.TravelerGadget.java
License:Apache License
private void buildUi(TravelerPreferences prefs) { String serverUrl = prefs.serverUrl().getValue(); if (serverUrl == null || "".equals(serverUrl)) { String specUrl = GadgetsUtil.getUrlParameters("url"); String staticContentUrl = specUrl.substring(0, specUrl.lastIndexOf('/')); serverUrl = staticContentUrl.substring(0, staticContentUrl.lastIndexOf('/')); }// w w w . j a v a 2s . co m if (!serverUrl.endsWith("/")) { serverUrl += "/"; } travelerServletClient = new TravelerServletClient(serverUrl); errorNotifier = ErrorNotifier.getErrorNotifier(); // Building personal tab final ResponseReceivedHandler<Object> refreshWhenDone = new ResponseReceivedHandler<Object>() { public void onResponseReceived(ResponseReceivedEvent<Object> event) { Response<Object> response = event.getResponse(); if (response.getStatusCode() == 200) { refreshPersonalMap(); } else { errorNotifier.showError(response.getStatusCode(), response.getText()); } } }; LocationHandler createHandler = new LocationHandler() { public void handle(Location location) { travelerServletClient.saveLocation(location, refreshWhenDone); } }; LocationHandler deleteHandler = new LocationHandler() { public void handle(Location location) { travelerServletClient.deleteLocation(location, refreshWhenDone); } }; personalMap = new TravelMap(createHandler, deleteHandler); refreshPersonalMap(); // Building friends tab String noPhotoUrl = serverUrl + NO_PHOTO_NAME; final PersonBrowser browser = new PersonBrowser(people, FRIENDS_DOCK_HEIGHT, noPhotoUrl); final TravelMap friendsMap = new TravelMap(); browser.setPersonClickedHandler(new PersonClickedHandler() { public void handle(String id) { friendsMap.clear(); travelerServletClient.getUsersLocations(id, new ResponseReceivedHandler<JsArray<Location>>() { public void onResponseReceived(ResponseReceivedEvent<JsArray<Location>> event) { Response<JsArray<Location>> response = event.getResponse(); if (response.getStatusCode() == 200) { friendsMap.zoomOut(); friendsMap.showLocation(response.getData()); } else { errorNotifier.showError(response.getStatusCode(), response.getText()); } } }); } }); DockLayoutPanel friendsTab = new DockLayoutPanel(Unit.PX); friendsTab.addNorth(browser, FRIENDS_DOCK_HEIGHT); friendsTab.add(friendsMap); // Building top level panel final TabLayoutPanel tabs = new TabLayoutPanel(1.5, Unit.EM); tabs.add(personalMap, "My Map"); tabs.add(friendsTab, "Friends"); tabs.setSize("100%", "100%"); tabs.addSelectionHandler(new SelectionHandler<Integer>() { public void onSelection(SelectionEvent<Integer> event) { Widget widget = tabs.getWidget(event.getSelectedItem()); if (widget instanceof RequiresResize) { ((RequiresResize) widget).onResize(); } } }); RootLayoutPanel.get().add(tabs); }
From source file:com.google.gwt.gwtai.demo.client.GwtAI.java
License:Apache License
/** * This is the entry point method.// w w w . j a v a2 s . com */ public void onModuleLoad() { TabLayoutPanel tabPanel = new TabLayoutPanel(30, Unit.PX); tabPanel.setWidth("600px"); tabPanel.add(new CounterAppletTab(), "Counter"); tabPanel.add(new StopWatchAppletTab(), "Stop Watch"); tabPanel.add(new TrayIconAppletTab(), "Tray Icon"); tabPanel.add(createCallbackApplet(), "CallbackApplet"); tabPanel.selectTab(0); RootLayoutPanel.get().add(tabPanel); }