List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:com.fullmetalgalaxy.client.game.context.MAppContext.java
License:Open Source License
public MAppContext() { super();/* ww w . ja va 2 s .co m*/ AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this); VerticalPanel vpanel = new VerticalPanel(); vpanel.add(m_panelAction); vpanel.setCellHorizontalAlignment(m_panelAction, HasHorizontalAlignment.ALIGN_RIGHT); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.add(m_panelExtra); hpanel.setCellHeight(m_panelExtra, "100%"); m_panelExtra.setHeight("100%"); hpanel.add(m_panelMiniMap); vpanel.add(hpanel); m_panelAction.add(new WgtContextAction()); m_panelAction.setStylePrimaryName("fmp-context-action"); m_panelMiniMap.setStylePrimaryName("fmp-context-minimap"); m_panelMiniMap.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); m_panelMiniMap.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // m_panelMiniMap.addStyleName( "transparent50" ); m_panelExtra.add(new WgtContextExtra()); m_panelExtra.setStylePrimaryName("fmp-context-extra"); // m_panelExtra.addStyleName( "transparent50" ); initWidget(vpanel); hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); }
From source file:com.fullmetalgalaxy.client.game.context.WgtContextAction.java
License:Open Source License
/** * /*from w w w .ja v a 2 s . c o m*/ */ public WgtContextAction() { m_btnOk.addClickHandler(this); m_btnOk.setTitle(MAppBoard.s_messages.validAction()); m_btnOk.setStyleName("fmp-PushButton32"); m_btnCancel.addClickHandler(this); m_btnCancel.setTitle(MAppBoard.s_messages.cancelAction()); m_btnCancel.setStyleName("fmp-PushButton32"); m_btnRepairTurret.addClickHandler(this); m_btnRepairTurret.setTitle(MAppBoard.s_messages.repairTurret()); m_btnRepairTurret.setStyleName("fmp-PushButton32"); m_btnTakeOff.addClickHandler(this); m_btnTakeOff.setTitle(MAppBoard.s_messages.takeOff()); m_btnTakeOff.setStyleName("fmp-PushButton32"); m_btnFire.addClickHandler(this); m_btnFire.setTitle(MAppBoard.s_messages.fire()); m_btnFire.setStyleName("fmp-PushButton32"); m_btnControl.addClickHandler(this); m_btnControl.setTitle(MAppBoard.s_messages.control()); m_btnControl.setStyleName("fmp-PushButton32"); m_btnFireCoverOn.addClickHandler(this); m_btnFireCoverOn.setTitle(MAppBoard.s_messages.displayFireCover()); m_btnFireCoverOn.setStyleName("fmp-PushButton32"); m_btnFireCoverOff.addClickHandler(this); m_btnFireCoverOff.setTitle(MAppBoard.s_messages.hideFireCover()); m_btnFireCoverOff.setStyleName("fmp-PushButton32"); m_btnEndTurn.addClickHandler(this); m_btnEndTurn.setTitle(MAppBoard.s_messages.endTurn()); m_btnEndTurn.setStyleName("fmp-PushButton32"); m_btnZoomIn.addClickHandler(this); m_btnZoomIn.setTitle(MAppBoard.s_messages.tacticalZoom()); m_btnZoomIn.setStyleName("fmp-PushButton32"); m_btnZoomOut.addClickHandler(this); m_btnZoomOut.setTitle(MAppBoard.s_messages.strategyZoom()); m_btnZoomOut.setStyleName("fmp-PushButton32"); m_btnGridOn.addClickHandler(this); m_btnGridOn.setTitle(MAppBoard.s_messages.displayGrid()); m_btnGridOn.setStyleName("fmp-PushButton32"); m_btnGridOff.addClickHandler(this); m_btnGridOff.setTitle(MAppBoard.s_messages.hideGrid()); m_btnGridOff.setStyleName("fmp-PushButton32"); m_btnRegister.addClickHandler(this); m_btnRegister.setTitle(MAppBoard.s_messages.joinGame()); m_btnRegister.setStyleName("fmp-PushButton32"); m_btnPractice.addClickHandler(this); m_btnPractice.setTitle(MAppBoard.s_messages.trainningMode()); m_btnPractice.setStyleName("fmp-PushButton32"); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.register32())); hPanel.add(new Label(MAppBoard.s_messages.joinThisGame())); m_pnlRegister = new FocusPanel(hPanel); m_pnlRegister.addClickHandler(this); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.pause32())); hPanel.add(new Label(MAppBoard.s_messages.waitGameStarting())); m_pnlWait = new FocusPanel(hPanel); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.takeOff32())); hPanel.add(new Label(MAppBoard.s_messages.mustLandFreighter())); m_pnlLand = new FocusPanel(hPanel); m_pnlLand.addClickHandler(this); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.takeOff32())); hPanel.add(new Label(MAppBoard.s_messages.mustDeployUnits())); m_pnlDeploy = new FocusPanel(hPanel); m_pnlDeploy.addClickHandler(this); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.pause32())); hPanel.add(new Label(MAppBoard.s_messages.pauseGameAllowNewPlayer())); m_pnlPause = new FocusPanel(hPanel); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.endTurn32())); hPanel.add(new Label(MAppBoard.s_messages.mustEndYourTurn())); m_pnlEndTurn = new FocusPanel(hPanel); m_pnlEndTurn.addClickHandler(this); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.takeOff32())); hPanel.add(new Label(MAppBoard.s_messages.SelectFreighterToTakeOff())); m_pnlTakeOff = new FocusPanel(hPanel); m_pnlTakeOff.addClickHandler(this); hPanel = new HorizontalPanel(); hPanel.add(new Image(Icons.s_instance.practice32())); hPanel.add(new Label(MAppBoard.s_messages.trainningMode())); hPanel.add(m_btnPracticeCancel); m_btnPracticeCancel.addClickHandler(this); hPanel.add(m_btnPracticeOk); m_btnPracticeOk.addClickHandler(this); m_pnlPractice = new FocusPanel(hPanel); m_iconAction.setTitle(MAppBoard.s_messages.costInPA()); m_lblAction.setStyleName("fmp-status-text"); // subscribe all needed models update event AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this); m_panel.setSize("100%", "100%"); m_panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); m_panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); initWidget(m_panel); }
From source file:com.fullmetalgalaxy.client.game.status.WgtGameStatus.java
License:Open Source License
/** * //from www. ja v a 2 s. c o m */ public WgtGameStatus() { // subscribe all needed models update event AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this); m_panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // game name m_lblGameName.setStyleName("fmp-status-title"); m_panel.add(m_lblGameName); // game turn Panel hPanel = new HorizontalPanel(); m_iconTime.setUrl("/images/clear.cache.gif"); hPanel.add(m_iconTime); m_lblTurn.setStyleName("fmp-status-text"); m_lblTurn.setTitle("Tour actuel / Nombre total de tours"); hPanel.add(m_lblTurn); m_lblDate.setText(""); m_lblDate.setStyleName("fmp-status-text"); m_lblDate.setTitle("Date de fin de tour"); hPanel.add(m_lblDate); // game tide hPanel.add(m_iconMoon); m_iconMoon.setTitle(MAppBoard.s_messages.tide()); hPanel.add(m_lblMoon); m_lblMoon.setTitle(MAppBoard.s_messages.tide()); m_lblMoon.setStyleName("fmp-status-text"); hPanel.add(m_panelTide); m_panel.setStyleName("fmp-status-game"); m_panel.add(hPanel); initWidget(m_panel); }
From source file:com.fullmetalgalaxy.client.game.status.WgtPlayerInfo.java
License:Open Source License
/** * /* w ww . j a va 2s. c om*/ */ public WgtPlayerInfo(EbRegistration p_registration) { m_registration = p_registration; Game game = GameEngine.model().getGame(); m_panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // player name and color(s) // ======================== Panel hPanel = new HorizontalPanel(); EnuColor color = m_registration.getEnuColor(); int colorIndex = 0; for (colorIndex = 0; colorIndex < EnuColor.getTotalNumberOfColor(); colorIndex++) { if (color.isColored(EnuColor.getColorFromIndex(colorIndex))) { Image image = BoardIcons.icon16(EnuColor.getColorFromIndex(colorIndex).getValue()).createImage(); image.setTitle( Messages.getSingleColorString(AppMain.instance().getMyAccount().getId(), color.getValue())); hPanel.add(image); } } Label lbl = null; if (m_registration.haveAccount()) { lbl = new Label(m_registration.getAccount().getPseudo()); } else { lbl = new Label("???"); } lbl.setStyleName("fmp-status-text"); hPanel.add(lbl); m_panel.add(hPanel); // action points // ============= hPanel = new HorizontalPanel(); hPanel.add(m_iconAction); m_iconAction.setTitle(MAppBoard.s_messages.remainingActionPoint()); hPanel.add(m_lblAction); m_lblAction.setTitle(MAppBoard.s_messages.remainingActionPoint()); m_lblAction.setHTML(" : " + m_registration.getPtAction() + "/" + (game.getEbConfigGameTime().getActionPtMaxReserve() + ((m_registration.getEnuColor().getNbColor() - 1) * game.getEbConfigGameTime().getActionPtMaxPerExtraShip()))); if (game.isParallel()) { Date nextActionIncrement = game.estimateTimeStepDate(game.getCurrentTimeStep() + 1); m_lblAction.setTitle(MAppBoard.s_messages.nextPA(m_registration.getActionInc(game), ClientUtil .formatTimeElapsed(nextActionIncrement.getTime() - SharedMethods.currentTimeMillis()))); } m_panel.add(hPanel); // set style name now resfreshStyle(); // m_vPanel.setWidth( "100%" ); // m_vPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); initWidget(m_panel); }
From source file:com.fullmetalgalaxy.client.MAppMessagesStack.java
License:Open Source License
public void showWarning(String p_msg) { Panel panel = new HorizontalPanel(); Image image = new Image(Icons.s_instance.cancel32()); panel.add(image);//from ww w .ja va2 s.c o m panel.add(new Label(p_msg)); showMessage(panel); }
From source file:com.fullmetalgalaxy.client.widget.WgtGameHeaderAdvanced.java
License:Open Source License
/** * /* ww w.j a va2 s.c o 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
/** * //from w w w. j a v a2 s. c om */ 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 w w . j a v a2 s . 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 a va 2s . com 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);//w w w . j a va2s. co m weekDayNameViews.add(label); 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(); }