@PostConstruct private void initializeModelAndDialog() { Table model = createModel(); if (model != null) { setModel(model); } final Optional<ITradingOffice> optOffice = city.getPlayer().findTradingOffice(city.getCity()); Preconditions.checkArgument(optOffice.isPresent(), "Ther must be a trading office present."); final ITradingOffice office = optOffice.get(); HBox box = new HBox(); box.setSpacing(15); box.setLayoutX(2*FRAME_BORDER); box.setLayoutY(CLOSE_BTN_Y_POS); Text label = new Text(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.AutomaticTradingOverviewDialog.office.manager", new Object[]{}, locale.getCurrentLocal())); label.getStyleClass().add("dialogText"); box.getChildren().add(label); OpenPatricianLargeWaxButton hireButton = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.AutomaticTradingOverviewDialog.hire", new Object[]{}, locale.getCurrentLocal())); hireButton.getStyleClass().add("actionButton"); hireButton.textProperty().bind(new HireButtonTextBinding(office)); hireButton.onActionProperty().bind(new HireActionBinding(office)); box.getChildren().add(hireButton); getContent().add(box); } private Table createModel() {
public OpenPatricianLargeWaxButtonSkin(final OpenPatricianLargeWaxButton button) { super(button); InputStream is = getClass().getResourceAsStream("sealingWaxFlattend_long.png"); Image img = new Image(is); final ImageView imageView = new ImageView(img); final Label label = new Label(); label.textProperty().bind(button.textProperty()); label.idProperty().bind(button.idProperty()); label.getStyleClass().add("OpenPatricianLargeWaxButtonLabeled"); label.onMouseClickedProperty().bind(button.onActionProperty()); imageView.onMouseReleasedProperty().bind(button.onActionProperty()); StackPane stack = new StackPane(); stack.getChildren().addAll(imageView, label); Group group = new Group(stack); group.setManaged(false); button.setPrefHeight(img.getHeight()); button.setPrefWidth(img.getWidth()); getChildren().add(group); }