/* (non-Javadoc) * @see com.fullmetalgalaxy.client.board.BoardLayer#show() */ @Override public void show() { for (BoardLayer layer : this) { layer.show(); } // zoom setZoom(GameEngine.model().getZoomDisplayed()); }
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); }
@Override public void onModelUpdate(GameEngine p_modelSender) { m_name.setText(p_modelSender.getGame().getName()); m_description.setText(p_modelSender.getGame().getDescription()); m_maxPlayerCount.setItemSelected(p_modelSender.getGame().getMaxNumberOfPlayer() - 2, true); }