public void createItemTab() { Tab itemTab = new Tab("Item"); final ItemProperty item = new ItemProperty(); VBox main = ViewLayout.getMainVBox("Add Item", "Details"); GridPane itemForm = new GridPane(); itemForm.setHgap(ViewLayout.H_SPACE); itemForm.setVgap(ViewLayout.V_SPACE); Label itemCodeLabel = new Label("Item Code"); itemCodeLabel.setPrefWidth(ViewLayout.LABEL_WIDTH); final ViewIntegerBox itemCodeBox = new ViewIntegerBox(item.get().getItemCode(), item.get().itemCodeProperty()); Label itemNameLabel = new Label("Item Name"); itemNameLabel.setPrefWidth(ViewLayout.LABEL_WIDTH); final ItemComboBox itemNameBox = new ItemComboBox("Item Name", item); Label itemRemarksLabel = new Label("Remarks"); itemRemarksLabel.setPrefWidth(ViewLayout.LABEL_WIDTH); final TextBox itemRemarksTextBox = new TextBox("Remarks", item.get().remarksProperty()); Button itemButton = new Button("Submit"); itemButton.getStyleClass().add("submit-button"); itemButton.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { if (itemNameBox.getText().trim().length() > 0) { if (itemRemarksTextBox.getText().trim().length() == 0) { item.get().setRemarks(item.get().getItemName()); } PersistValidationDetails pvd = ServiceManager.getValidationDetailsService( "Item", item.get(), PersistType.UPDATE); pvd.restart(); pvd.setOnSucceeded( new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent e) { item.get().clean(); } }); } else { Alert.showAlert( Context.getWindowStage(), "Error", "Error", "Please enter item name."); } } }); itemForm.add(itemCodeLabel, 0, 0); itemForm.add(itemCodeBox, 1, 0); itemForm.add(itemNameLabel, 0, 1); itemForm.add(itemNameBox, 1, 1); itemForm.add(itemRemarksLabel, 0, 2); itemForm.add(itemRemarksTextBox, 1, 2); itemForm.add(itemButton, 1, 3); main.getChildren().add(itemForm); itemTab.setContent(ControlsUtil.makeScrollable(main)); itemTab.setClosable(false); getTabs().add(itemTab); }