List of usage examples for com.google.gwt.user.client.ui TabPanel TabPanel
public TabPanel()
From source file:asquare.gwt.tests.history.client.Demo.java
License:Apache License
public void onModuleLoad() { TabCollection tabSet = new TabCollection(); tabSet.add("grains", "Grains", createGrains()); tabSet.add("vegetables", "Vegetables", createVegetables()); tabSet.add("fruit", "Fruit", createFruit()); tabSet.add("stimulants", "Stimulants", createStimulants()); TabPanel tabPanel = new TabPanel(); for (int i = 0; i < tabSet.size(); i++) { tabPanel.add(tabSet.getWidget(i), tabSet.getDescription(i)); }//from w ww. j a v a2 s . c o m String initialTabToken = History.getToken(); if (initialTabToken.length() == 0) { initialTabToken = tabSet.getToken(0); } TabController controller = new TabController(tabSet, tabPanel, initialTabToken); tabPanel.addSelectionHandler(controller); History.addValueChangeHandler(controller); RootPanel.get().add(tabPanel); }
From source file:asquare.gwt.tk.demo.client.Demo.java
License:Apache License
public void onModuleLoad() { TabCollection tabs = new TabCollection(); tabs.add("dropdown", "Drop Down Panel", new DropDownPanelPanel()); tabs.add("debug", "Debug Utilities", new DebugPanel()); tabs.add("misc", "Misc", new MiscPanel()); BorderPanel outer = new BorderPanel(); DOM.setAttribute(outer.getElement(), "id", "main"); final TabPanel tabPanel = new TabPanel(); tabPanel.setWidth("100%"); for (int i = 0; i < tabs.size(); i++) { tabPanel.add(tabs.getWidget(i), tabs.getDescription(i)); }/*from w ww . j a v a2s . co m*/ outer.add(tabPanel); String initialTabToken = History.getToken(); if (initialTabToken.length() == 0) { initialTabToken = tabs.getToken(0); } TabController controller = new TabController(tabs, tabPanel, initialTabToken); tabPanel.addTabListener(controller); History.addHistoryListener(controller); RootPanel.get().add(outer); Debug.enableSilently(); }
From source file:ch.heftix.mailxel.client.OnDemandTabPanel.java
License:Open Source License
public void add(final Widget w, final String tabText) { if (null == single) { single = w;//from w w w. j ava2 s. c o m singleTabText = tabText; super.add(w); } else { if (null == tabPanel) { // morph to tab Panel tabPanel = new TabPanel(); remove(single); tabPanel.add(single, singleTabText); add(tabPanel); } tabPanel.add(w, tabText); tabPanel.selectTab(tabPanel.getWidgetCount() - 1); } }
From source file:cl.uai.client.toolbar.MarkingToolBar.java
License:Open Source License
/** * Creates the interface//from w w w .j a v a 2s .c o m */ public MarkingToolBar() { logger.fine("Entering MarkingToolbar"); grade = new DraftGrade(); markingButtons = new MarkingButtons(); markingButtons.setVisible(false); examButtons = new ExamButtons(true); examButtons.setVisible(true); extraButtons = new ExamButtons(false); extraButtons.setVisible(true); viewButtons = new ViewButtons(); viewButtons.setVisible(false); chatButtons = new ChatButtons(); chatButtons.setVisible(false); helpButtons = new HelpButtons(); helpButtons.setVisible(false); tabButtonsPanel = new TabPanel(); tabButtonsPanel.addStyleName(Resources.INSTANCE.css().tabbuttons()); tabButtonsPanel.add(markingButtons, MarkingInterface.messages.Mark().toUpperCase()); tabButtonsPanel.add(examButtons, MarkingInterface.messages.Exam().toUpperCase()); tabButtonsPanel.add(viewButtons, MarkingInterface.messages.View().toUpperCase()); tabButtonsPanel.add(chatButtons, MarkingInterface.messages.Collaboration().toUpperCase()); tabButtonsPanel.add(helpButtons, MarkingInterface.messages.Help().toUpperCase()); buttonsPanel = new HorizontalPanel(); buttonsPanel.setVisible(false); buttonsPanel.addStyleName(Resources.INSTANCE.css().buttonspanel()); buttonsPanel.add(tabButtonsPanel); buttonsPanel.setCellHorizontalAlignment(markingButtons, HasHorizontalAlignment.ALIGN_LEFT); buttonsPanel.setCellWidth(markingButtons, "50%"); SubmissionGradeData sdata = MarkingInterface.submissionData; if (sdata != null && EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_MARKER_TRAINING && EMarkingConfiguration.isChatEnabled()) { buttonsPanel.add(new HTML("Hola, ac habran estadisticas de correccin")); buttonsPanel.setCellWidth(markingButtons, "30%"); } buttonsPanel.add(grade); buttonsPanel.setCellVerticalAlignment(grade, HasVerticalAlignment.ALIGN_MIDDLE); buttonsPanel.setCellHorizontalAlignment(grade, HasHorizontalAlignment.ALIGN_RIGHT); buttonsPanel.setCellWidth(grade, "10%"); extraButtons = new ExamButtons(false); extraButtons.getFinishMarkingButton().setVisible(true); extraButtons.getSaveAndJumpToNextButton().setVisible(true); extraButtons.getSaveChangesButton().setVisible(true); buttonsPanel.add(extraButtons); buttonsPanel.setCellVerticalAlignment(extraButtons, HasVerticalAlignment.ALIGN_MIDDLE); buttonsPanel.setCellHorizontalAlignment(extraButtons, HasHorizontalAlignment.ALIGN_RIGHT); buttonsPanel.setCellWidth(extraButtons, "40%"); this.initWidget(buttonsPanel); }
From source file:com.akjava.gwt.hangout.apilist.client.APILists.java
License:Apache License
@Override protected void init(TestPreference preferences) { //create css/*w ww .j a v a 2s . com*/ StyleInjector.inject(".bold{font-weight:bold;color:#666;}"); ScriptElement script = createScriptElement("http://hangoutsapi.appspot.com/static/hangout.js", null); HTML html = new HTML(); html.getElement().insertFirst(script); RootPanel.get().add(html); TabPanel tab = new TabPanel(); RootPanel.get().add(tab); ParticipantsPanel participantsPanel = new ParticipantsPanel(); tab.add(participantsPanel, "Participants"); HangoutPanel hangoutPanel = new HangoutPanel(); tab.add(hangoutPanel, "Hangout"); NoticePanel noticePanel = new NoticePanel(); tab.add(noticePanel, "Notice"); ActiveSpeakerPanel activeSpeakerPanel = new ActiveSpeakerPanel(); tab.add(activeSpeakerPanel, "Speaker"); LayoutPanel laytouPanel = new LayoutPanel(); tab.add(laytouPanel, "layout"); StatePanel statePanel = new StatePanel(); tab.add(statePanel, "state"); AVPanel avPanel = new AVPanel(); tab.add(avPanel, "AV"); tab.selectTab(0); }
From source file:com.allen_sauer.gwt.dnd.demo.client.example.resetcache.ResetCacheExample.java
License:Apache License
public ResetCacheExample(PickupDragController dragController) { super(dragController); addStyleName(CSS_DEMO_CACHE_EXAMPLE); // some colors to go with each tab String[] colors = { "#AAAAFF", "#AAFFAA", "#FFAAAA", "#FFFFAA", "#FFAAFF", "#AAFFFF", }; // use the containing panel as this composite's widget AbsolutePanel containingPanel = new AbsolutePanel(); containingPanel.setPixelSize(600, 300); setWidget(containingPanel);/*from w w w. j a v a 2 s. c o m*/ // create a tab panel and populate with a few tabs TabPanel tabPanel = new TabPanel(); tabPanel.addStyleName(CSS_DEMO_CACHE_EXAMPLE_TAB_PANEL); tabPanel.setPixelSize(300, 200); containingPanel.add(tabPanel, 40, 20); for (int i = 0; i < colors.length; i++) { // create a simple panel for the tab content AbsolutePanel contentPanel = new AbsolutePanel(); contentPanel.setHeight("200px"); contentPanel.getElement().getStyle().setProperty("backgroundColor", colors[i]); // create a tab widget HTML tabWidget = new HTML("Tab #" + (i + 1)); tabWidget.setWordWrap(false); tabWidget.getElement().getStyle().setProperty("backgroundColor", colors[i]); tabPanel.add(contentPanel, tabWidget); // add drop controller to allow automatic tab selection and dropping on tab TabSelectingDropController tabSelectingDropController = new TabSelectingDropController(tabWidget, tabPanel, i); dragController.registerDropController(tabSelectingDropController); // create a sample draggable Widget draggableLabel = new Label("Drag me to another tab"); draggableLabel.getElement().getStyle().setProperty("backgroundColor", colors[i]); draggableLabel.addStyleName(CSS_DEMO_CACHE_EXAMPLE_DRAGGABLE); // make label draggable dragController.makeDraggable(draggableLabel); // determine random location within target panel int left = Random.nextInt(200); int top = Random.nextInt(150); contentPanel.add(draggableLabel, left, top); // create a drop controller for the content panel AbsolutePositionDropController contentPanelDropController = new AbsolutePositionDropController( contentPanel); dragController.registerDropController(contentPanelDropController); } tabPanel.selectTab(0); // create a drop controller for the containing panel containerDropController = new AbsolutePositionDropController(containingPanel); dragController.registerDropController(containerDropController); }
From source file:com.apress.progwt.client.college.gui.CollegeEntry.java
License:Apache License
/** * What is displayed when the user expands us. * // w w w . j av a 2 s .co m * @return */ private Widget getInfoPanel() { VerticalPanel infoPanel = new VerticalPanel(); TabPanel infoTabs = new TabPanel(); infoTabs.add(getThoughts(), "Thoughts"); infoTabs.add(getRatings(), "Ratings"); infoTabs.selectTab(1); infoPanel.add(infoTabs); infoPanel.add(getButtons()); return infoPanel; }
From source file:com.bramosystems.oss.player.showcase.client.ControlPane.java
License:Apache License
public ControlPane() { animator = new Animation() { @Override//from w ww . jav a2s .c om protected void onUpdate(double progress) { onAnimatorUpdate(progress); } }; playlistPane = PlaylistPane.singleton; playerLog = new PlayerLogPane(); tp = new TabPanel(); tp.add(playlistPane, "Playlist"); tp.add(playerLog, "Player Log"); tp.addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { @Override public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { if ((event.getItem() == selectedTab) || !fullState) { toggle(); } selectedTab = event.getItem(); } }); initWidget(tp); }
From source file:com.dawg6.web.dhcalc.client.SavePanel.java
License:Open Source License
public SavePanel() { CaptionPanel captionPanel = new CaptionPanel("Save/Load"); initWidget(captionPanel);/*w w w. ja v a 2 s . com*/ FlexTable flexTable_3 = new FlexTable(); flexTable_3.setCellPadding(2); captionPanel.setContentWidget(flexTable_3); tabPanel = new TabPanel(); flexTable_3.setWidget(0, 0, tabPanel); browserPanel = new FlexTable(); browserPanel.setCellPadding(2); if (Storage.isLocalStorageSupported()) { tabPanel.add(browserPanel, "Browser Storage", false); } storageList = new ListBox(); browserPanel.setWidget(0, 0, storageList); storageList.setWidth("100%"); storageList.setVisibleItemCount(5); nameField = new TextBox(); nameField.setVisibleLength(30); nameField.setText("Enter a Name"); browserPanel.setWidget(1, 0, nameField); Button btnNewButton = new Button("New button"); browserPanel.setWidget(1, 1, btnNewButton); btnNewButton.setText("Add"); btnNewButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { addLocalStorage(); } }); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(5); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); browserPanel.setWidget(2, 0, horizontalPanel); Button button_6 = new Button("New button"); button_6.setText("Save"); horizontalPanel.add(button_6); button_6.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveLocalStorage(); } }); Button button_5 = new Button("New button"); horizontalPanel.add(button_5); button_5.setText("Restore"); button_5.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { restoreLocalStorage(); } }); Button button_2 = new Button("New button"); horizontalPanel.add(button_2); button_2.setText("Delete"); button_2.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteLocalStorage(); } }); Button btnNewButton_1 = new Button("New button"); horizontalPanel.add(btnNewButton_1); btnNewButton_1.setText("Rename"); btnNewButton_1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { renameLocalStorage(); } }); browserPanel.getFlexCellFormatter().setColSpan(0, 0, 1); browserPanel.getFlexCellFormatter().setColSpan(2, 0, 1); browserPanel.getFlexCellFormatter().setColSpan(0, 0, 2); browserPanel.getFlexCellFormatter().setColSpan(2, 0, 2); browserPanel.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER); filePanel = new FlexTable(); filePanel.setCellPadding(2); tabPanel.add(filePanel, "Local File", false); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); filePanel.setWidget(0, 0, horizontalPanel_1); loadPanel = new FormPanel(); loadPanel.setMethod(FormPanel.METHOD_POST); loadPanel.setEncoding(FormPanel.ENCODING_MULTIPART); loadPanel.setAction("loadData"); horizontalPanel_1.add(loadPanel); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); loadPanel.setWidget(horizontalPanel_2); horizontalPanel_2.setSize("100%", "100%"); fileUpload = new FileUpload(); fileUpload.setName("file"); horizontalPanel_2.add(fileUpload); clientKey = new Hidden("client"); horizontalPanel_2.add(clientKey); filePanel.getFlexCellFormatter().setColSpan(0, 0, 1); Button button = new Button("Save Data..."); filePanel.setWidget(1, 0, button); button.setText("Save File"); Button button_1 = new Button("Load Data..."); filePanel.setWidget(1, 1, button_1); button_1.setText("Load File"); filePanel.getFlexCellFormatter().setColSpan(0, 0, 2); filePanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); filePanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); button_1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadFile(); } }); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { saveFile(); } }); textPanel = new FlexTable(); textPanel.setCellPadding(2); tabPanel.add(textPanel, "Copy/Paste", false); textArea = new TextArea(); textArea.setText( "Paste previously saved form data here and click \"Restore.\" Or press \"Current\" to paste current Form data."); textArea.setVisibleLines(5); textPanel.setWidget(0, 0, textArea); textArea.setSize("100%", ""); Button button_3 = new Button("Save Data..."); button_3.setText("Current"); textPanel.setWidget(1, 0, button_3); textArea.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { textArea.selectAll(); } }); nameField.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { nameField.selectAll(); } }); button_3.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { FormData data = listener.getFormData(); JSONObject obj = JsonUtil.toJSONObject(data); textArea.setText(JsonUtil.formatJsonText(obj.toString())); textArea.selectAll(); } } }); Button button_4 = new Button("Load Data..."); button_4.setText("Restore"); button_4.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (listener != null) { String text = textArea.getText(); FormData data = JsonUtil.parseFormData(text); listener.setFormData(data); textArea.setText(""); } } }); textPanel.setWidget(1, 1, button_4); textPanel.getFlexCellFormatter().setColSpan(0, 0, 2); textPanel.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER); textPanel.getCellFormatter().setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_CENTER); flexTable_3.getFlexCellFormatter().setColSpan(0, 0, 1); storageList.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int i = storageList.getSelectedIndex(); if (i >= 0) { String name = storageList.getItemText(i); if (name != null) nameField.setText(name); } } }); }
From source file:com.dimdim.conference.ui.common.client.layout.MultipleListsControlDialog.java
License:Open Source License
protected Widget getContent() { int size = lists.size(); TabPanel tabPanel = new TabPanel(); for (int i = 0; i < size; i++) { DefaultList list = (DefaultList) lists.elementAt(i); ListControlPanel w = list.getListControlPanel(); if (w != null) { this.memberControlPanels.addElement(w); tabPanel.add(w, w.getPanelLabel()); }/*from w w w . j ava2 s . c om*/ } tabPanel.selectTab(0); return tabPanel; }