List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add
@Override public void add(Widget w)
From source file:com.fullmetalgalaxy.client.widget.WgtGameHeaderAdvanced.java
License:Open Source License
/** * /*w w w. j a v a 2 s .co m*/ */ public WgtGameHeaderAdvanced() { super(); VerticalPanel vpanel = new VerticalPanel(); vpanel.add(new Label("Mot de passe si partie priv :")); m_password.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> p_event) { GameEngine.model().getGame().setPassword(m_password.getText()); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); vpanel.add(m_password); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(new Label("Partie d'entrainement (ne compte pas au classement) :")); m_training.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> p_event) { GameEngine.model().getGame() .setGameType(m_training.getValue() ? GameType.Initiation : GameType.Initiation); } }); hPanel.add(m_training); vpanel.add(hPanel); hPanel = new HorizontalPanel(); hPanel.add(new Label("quipes :")); m_maxTeamAllowed.addItem("Pas d'quipe", "0"); for (int i = 2; i < Company.values().length; i++) { m_maxTeamAllowed.addItem("" + i); } m_maxTeamAllowed.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent p_event) { int i = 0; try { i = Integer.parseInt(m_maxTeamAllowed.getValue(m_maxTeamAllowed.getSelectedIndex())); } catch (NumberFormatException e) { } GameEngine.model().getGame().setMaxTeamAllowed(i); } }); // init team count selection if (GameEngine.model().getGame().getMaxTeamAllowed() == 0) { m_maxTeamAllowed.setItemSelected(0, true); } else { m_maxTeamAllowed.setItemSelected(GameEngine.model().getGame().getMaxTeamAllowed() - 1, true); } hPanel.add(m_maxTeamAllowed); vpanel.add(hPanel); // fill UI onModelUpdate(GameEngine.model()); m_dpanel.add(vpanel); initWidget(m_dpanel); // receive all model change AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this); }
From source file:com.fullmetalgalaxy.client.widget.WgtGameHeaderInfo.java
License:Open Source License
/** * /* w w w. j a v a 2s. co m*/ */ public WgtGameHeaderInfo() { super(); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(new Label("Nom :")); m_name.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> p_event) { GameEngine.model().getGame().setName(m_name.getText()); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); hPanel.add(m_name); m_panel.add(hPanel); m_panel.add(new Label("Description :")); m_description.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> p_event) { GameEngine.model().getGame().setDescription(m_description.getText()); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); m_panel.add(m_description); hPanel = new HorizontalPanel(); hPanel.add(new Label("Nombre maxi de joueur :")); m_maxPlayerCount.addItem("2"); m_maxPlayerCount.addItem("3"); m_maxPlayerCount.addItem("4"); m_maxPlayerCount.addItem("5"); m_maxPlayerCount.addItem("6"); m_maxPlayerCount.addItem("7"); m_maxPlayerCount.addItem("8"); m_maxPlayerCount.addItem("9"); m_maxPlayerCount.addItem("10"); m_maxPlayerCount.addItem("11"); m_maxPlayerCount.addItem("12"); m_maxPlayerCount.setVisibleItemCount(1); m_maxPlayerCount.setItemSelected(2, true); m_maxPlayerCount.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent p_event) { GameEngine.model().getGame().setMaxNumberOfPlayer(m_maxPlayerCount.getSelectedIndex() + 2); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); hPanel.add(m_maxPlayerCount); m_panel.add(hPanel); // fill UI onModelUpdate(GameEngine.model()); initWidget(m_panel); // receive all model change AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this); }
From source file:com.github.a2g.core.objectmodel.MasterPanel.java
License:Apache License
public MasterPanel(int width, int height, ColorEnum back) { // create all the host panels, that we want to arrange. hostForCommandLine = new HostingPanelForHtml4(); hostForInventory = new HostingPanelForHtml4(); hostForVerbs = new HostingPanelForHtml4(); hostForScene = new HostingPanelForHtml4(); hostForDialogTree = new HostingPanelForHtml4(); hostForLoading = new HostingPanelForHtml4(); hostForTitleCard = new HostingPanelForHtml4(); // will be constructed from two vertical stacks. AbsolutePanel stackForSceneAndLoading = new AbsolutePanel(); AbsolutePanel stackForDialogTreeInvAndCommand = new AbsolutePanel(); stackForDialogTreeInvAndCommand.getElement().getStyle().setProperty("backgroundColor", back.toString()); stackForSceneAndLoading.getElement().getStyle().setProperty("backgroundColor", back.toString()); {/*from w ww . j av a 2s . c o m*/ HorizontalPanel verbsAndInventory = new HorizontalPanel(); verbsAndInventory.add(hostForVerbs); verbsAndInventory.add(hostForInventory); VerticalPanel commandLineAndVerbsAndInventory = new VerticalPanel(); commandLineAndVerbsAndInventory.add(hostForCommandLine); commandLineAndVerbsAndInventory.add(verbsAndInventory); stackForDialogTreeInvAndCommand.add(commandLineAndVerbsAndInventory); stackForDialogTreeInvAndCommand.add(hostForDialogTree); } { stackForSceneAndLoading.add(hostForScene); stackForSceneAndLoading.add(hostForLoading); stackForSceneAndLoading.add(hostForTitleCard); } this.add(stackForSceneAndLoading); this.add(stackForDialogTreeInvAndCommand); }
From source file:com.github.gwt.sample.showcase.client.contents.LeftMenuTreeViewModel.java
License:Apache License
/** * Initialize the top level categories in the tree. *//*from w w w.j ava 2 s . co m*/ private void initializeTree() { List<Category> catList = categories.getList(); // DateTimeBox. { Category category = new Category("DateTimeBox"); catList.add(category); HorizontalPanel widgets = new HorizontalPanel(); widgets.setWidth("100%"); widgets.setHeight("100%"); widgets.setTitle("DateTimeBox"); DateTimeBox dateTimeBox = new DateTimeBox(); dateTimeBox.setTitle("DateTimeBox"); widgets.add(dateTimeBox); category.addExample(widgets); } // ClearBox. { Category category = new Category("ClearBox"); catList.add(category); } // DateTimePicker { Category category = new Category("DateTimePicker"); catList.add(category); } // CellGrid { Category category = new Category("CellGrid"); catList.add(category); } // LayerPanel { Category category = new Category("LayerPanel"); catList.add(category); } }
From source file:com.github.gwt.user.client.ui.grids.days.DaysOfWeekView.java
License:Apache License
public DaysOfWeekView() { HorizontalPanel panel = new HorizontalPanel(); panel.setStyleName(RESOURCES.style().daysOfWeekView()); // Set up the day labels. for (int i = 0; i < CalendarUtil.DAYS_IN_WEEK; i++) { Label label = new Label(); panel.add(label); weekDayNameViews.add(label);/*from w w w.j a va 2 s.c o m*/ int shift = CalendarUtil.getStartingDayOfWeek(); int dayIdx = i + shift < CalendarUtil.DAYS_IN_WEEK ? i + shift : i + shift - CalendarUtil.DAYS_IN_WEEK; if (CalendarUtil.isWeekend(dayIdx)) { label.setStyleName(RESOURCES.style().weekendLabel()); } else { label.setStyleName(RESOURCES.style().weekdayLabel()); } } initWidget(panel); setWeekDayNameLabelsText(); }
From source file:com.github.gwtbootstrap.client.ui.SimplePager.java
License:Apache License
/** * Construct a {@link SimplePager} with the specified resources. * * @param location/*from w w w .j a va 2s .c om*/ * the location of the text relative to the buttons * @param resources * the {@link Resources} to use * @param showFastForwardButton * if true, show a fast-forward button that advances by a larger * increment than a single page * @param fastForwardRows * the number of rows to jump when fast forwarding * @param showLastPageButton * if true, show a button to go the the last page * @param imageButtonConstants * Constants that contain the image button names */ public SimplePager(TextLocation location, Resources resources, boolean showFastForwardButton, final int fastForwardRows, boolean showLastPageButton, ImageButtonsConstants imageButtonConstants) { this.resources = resources; this.fastForwardRows = fastForwardRows; this.style = this.resources.simplePagerStyle(); this.style.ensureInjected(); // Create the buttons. firstPage = new Button(); firstPage.setType(ButtonType.LINK); firstPage.setIcon(IconType.FAST_BACKWARD); firstPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { firstPage(); } }); firstPageTooltip = new Tooltip(imageButtonConstants.firstPage()); firstPageTooltip.setWidget(firstPage); firstPageTooltip.setPlacement(tooltipPlacement); firstPageTooltip.setShowDelay(tooltipDelay); nextPage = new Button(); nextPage.setType(ButtonType.LINK); nextPage.setIcon(IconType.STEP_FORWARD); nextPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { nextPage(); } }); nextPageTooltip = new Tooltip(imageButtonConstants.nextPage()); nextPageTooltip.setWidget(nextPage); nextPageTooltip.setPlacement(tooltipPlacement); nextPageTooltip.setShowDelay(tooltipDelay); prevPage = new Button(); prevPage.setType(ButtonType.LINK); prevPage.setIcon(IconType.STEP_BACKWARD); prevPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { previousPage(); } }); prevPageTooltip = new Tooltip(imageButtonConstants.prevPage()); prevPageTooltip.setWidget(prevPage); prevPageTooltip.setPlacement(tooltipPlacement); prevPageTooltip.setShowDelay(tooltipDelay); if (showLastPageButton) { lastPage = new Button(); lastPage.setType(ButtonType.LINK); lastPage.setIcon(IconType.FAST_FORWARD); lastPage.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { lastPage(); } }); lastPageTooltip = new Tooltip(imageButtonConstants.lastPage()); lastPageTooltip.setWidget(lastPage); lastPageTooltip.setPlacement(tooltipPlacement); lastPageTooltip.setShowDelay(tooltipDelay); } else { lastPage = null; lastPageTooltip = null; } if (showFastForwardButton) { fastForward = new Button(); fastForward.setType(ButtonType.LINK); fastForward.setIcon(IconType.FORWARD); fastForward.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { setPage(getPage() + getFastForwardPages()); } }); fastForwardTooltip = new Tooltip(imageButtonConstants.fastForward()); fastForwardTooltip.setWidget(fastForward); fastForwardTooltip.setPlacement(tooltipPlacement); fastForwardTooltip.setShowDelay(tooltipDelay); } else { fastForward = null; fastForwardTooltip = null; } // Construct the widget. HorizontalPanel layout = new HorizontalPanel(); layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(layout); if (location == TextLocation.LEFT) { layout.add(label); } layout.add(firstPage); layout.add(prevPage); if (location == TextLocation.CENTER) { layout.add(label); } layout.add(nextPage); if (showFastForwardButton) { layout.add(fastForward); } if (showLastPageButton) { layout.add(lastPage); } layout.add(firstPageTooltip); layout.add(prevPageTooltip); layout.add(nextPageTooltip); if (showFastForwardButton) { layout.add(fastForwardTooltip); } if (showLastPageButton) { layout.add(lastPageTooltip); } if (location == TextLocation.RIGHT) { layout.add(label); } // Add style names to the cells. firstPage.getElement().getParentElement().addClassName(style.button()); prevPage.getElement().getParentElement().addClassName(style.button()); label.getElement().getParentElement().addClassName(style.pageDetails()); nextPage.getElement().getParentElement().addClassName(style.button()); if (showFastForwardButton) { fastForward.getElement().getParentElement().addClassName(style.button()); } if (showLastPageButton) { lastPage.getElement().getParentElement().addClassName(style.button()); } // Disable the buttons by default. setDisplay(null); }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.AbstractMenuDialog.java
License:Open Source License
/** * Add two widgets to a horizontal panel * @param leftWidget/* w w w . ja v a 2 s . c o m*/ * @param rightWidget * @return the horizontal panel containing both widgets */ protected HorizontalPanel createHorizontalHolder(Widget leftWidget, Widget rightWidget) { HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setSpacing(10); hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hpanel.add(leftWidget); hpanel.add(rightWidget); return hpanel; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.DeleteProjectDialogWidget.java
License:Open Source License
private HorizontalPanel createHorizontalHolder(Widget leftWidget, Widget rightWidget) { HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setSpacing(10);//from ww w . ja v a 2 s . c o m hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hpanel.add(leftWidget); hpanel.add(rightWidget); return hpanel; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java
License:Open Source License
/** * Helper Method to add two widgets to a horizontal panel * TODO Refactor To Utility Class// w ww. j av a 2 s .c o m * @param leftWidget * @param rightWidget * @return */ private HorizontalPanel createHorizontalHolder(Widget leftWidget, Widget rightWidget) { HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setSpacing(10); hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hpanel.add(leftWidget); hpanel.add(rightWidget); return hpanel; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.Toolbar.java
License:Open Source License
/** * Builds the main toolbar.//ww w . jav a2s . co m * * @return the main toolbar */ private HorizontalPanel buildToolBar() { HorizontalPanel toolbarPanel = new HorizontalPanel(); toolbarPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); toolbarPanel.setStyleName("lab-Toolbar"); toolbarPanel.add(buildButton(resources.blankFile(), "New Project", new CreateNewProjectDialogWidget().openDialogForNewProjectCommand())); toolbarPanel.add(buildButton(resources.openIcon(), "Open Project", createBlankCommand())); toolbarPanel.add(buildButton(resources.saveIcon(), "Save Project", createBlankCommand())); toolbarPanel.add(buildSeparator()); toolbarPanel.add(buildButton(resources.refreshIcon(), "Refresh", createBlankCommand())); toolbarPanel.add(buildSeparator()); toolbarPanel.add(buildButton(resources.copyIcon(), "Clone Project", (new GitCloneDialogWidget().openDialogForGITCloneCommand()))); toolbarPanel.add(buildSeparator()); toolbarPanel .add(buildButton(resources.uploadIcon(), "Deploy Project", (new DeployDialog().openMenuDialog()))); return toolbarPanel; }