List of usage examples for javafx.event EventHandler EventHandler
EventHandler
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTimeColPickerPane.java
public CFBamJavaFXTimeColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTimeColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamTimeColObj> argDataCollection, ICFBamJavaFXTimeColChosen whenChosen) { super();/*from w w w.j a v a 2 s .c om*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTimeColObj>(); tableColumnId = new TableColumn<ICFBamTimeColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTimeColObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Long>, TableCell<ICFBamTimeColObj, Long>>() { @Override public TableCell<ICFBamTimeColObj, Long> call(TableColumn<ICFBamTimeColObj, Long> arg) { return new CFInt64TableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTimeColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, String>, TableCell<ICFBamTimeColObj, String>>() { @Override public TableCell<ICFBamTimeColObj, String> call(TableColumn<ICFBamTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTimeColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, String>, TableCell<ICFBamTimeColObj, String>>() { @Override public TableCell<ICFBamTimeColObj, String> call(TableColumn<ICFBamTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTimeColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, String>, TableCell<ICFBamTimeColObj, String>>() { @Override public TableCell<ICFBamTimeColObj, String> call(TableColumn<ICFBamTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTimeColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, String>, TableCell<ICFBamTimeColObj, String>>() { @Override public TableCell<ICFBamTimeColObj, String> call(TableColumn<ICFBamTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTimeColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, String>, TableCell<ICFBamTimeColObj, String>>() { @Override public TableCell<ICFBamTimeColObj, String> call(TableColumn<ICFBamTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTimeColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTimeColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Boolean>, TableCell<ICFBamTimeColObj, Boolean>>() { @Override public TableCell<ICFBamTimeColObj, Boolean> call(TableColumn<ICFBamTimeColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTimeColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTimeColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Boolean>, TableCell<ICFBamTimeColObj, Boolean>>() { @Override public TableCell<ICFBamTimeColObj, Boolean> call(TableColumn<ICFBamTimeColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTimeColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTimeColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Boolean>, TableCell<ICFBamTimeColObj, Boolean>>() { @Override public TableCell<ICFBamTimeColObj, Boolean> call(TableColumn<ICFBamTimeColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTimeColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeColObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, String>, TableCell<ICFBamTimeColObj, String>>() { @Override public TableCell<ICFBamTimeColObj, String> call(TableColumn<ICFBamTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamTimeColObj, Calendar>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeColObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Calendar>, TableCell<ICFBamTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTimeColObj, Calendar> call(TableColumn<ICFBamTimeColObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTimeColObj, Calendar>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeColObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Calendar>, TableCell<ICFBamTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTimeColObj, Calendar> call(TableColumn<ICFBamTimeColObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTimeColObj, Calendar>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeColObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Calendar>, TableCell<ICFBamTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTimeColObj, Calendar> call(TableColumn<ICFBamTimeColObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTimeColObj, Calendar>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeColObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, Calendar>, TableCell<ICFBamTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTimeColObj, Calendar> call(TableColumn<ICFBamTimeColObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTimeColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTimeColObj, ICFBamSchemaDefObj> p) { ICFBamTimeColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamTimeColObj, ICFBamSchemaDefObj>, TableCell<ICFBamTimeColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTimeColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTimeColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTimeColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTimeColObj>() { @Override public void changed(ObservableValue<? extends ICFBamTimeColObj> observable, ICFBamTimeColObj oldValue, ICFBamTimeColObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseTimeCol(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTimeColObj selectedInstance = getJavaFXFocusAsTimeCol(); invokeWhenChosen.choseTimeCol(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:statos2_0.MainA.java
@Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle(nameseller + "[" + storename + "]"); primaryStage.show();// ww w . j a va 2 s.com primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { public void handle(WindowEvent we) { updsel(m, 1); } }); GridPane grid = new GridPane(); grid.setHgap(14); grid.setVgap(14); grid.setPadding(new Insets(5, 5, 5, 5)); //System.out.println("****"+m); txg3.setVisible(false); // , 1 sp1.setValueFactory(spfd); spb1.setValueFactory(sfi); sp2.setValueFactory(sfi2); sp3.setValueFactory(sfi3); p1.setId("firstlab"); p2.setId("firstlab"); p3.setId("firstlab"); kasnbn.setId("secondlab"); kasvnbn.setId("secondlab"); sumnbn.setId("secondlab"); vyr.setId("vyr"); sumvnbn.setId("secondlab"); JSONParser jP5 = new JSONParser(); JSONObject jsons5 = new JSONObject(); List<NameValuePair> para5 = new ArrayList<NameValuePair>(); para5.add(new BasicNameValuePair("idm", String.valueOf(m))); jsons5 = jP5.makeHttpRequest(url_cashgetm, "POST", para5); int success = jsons5.getInt("success"); if (!jsons5.isNull("success")) { //res=true; // System.out.println("TRUE"); double all = jsons5.getDouble("all"); double dayall = Double.parseDouble(jsons5.get("dayall").toString()); double daybn = Double.parseDouble(jsons5.get("daybn").toString()); days = dayall + daybn; if (days <= 7999 & days > 0) { smvyr += (days / 100) * 3; } else if (days > 7999) { smvyr += (days / 100) * 4; } vyr.setText(":" + smvyr); sumnbn.setText(all + " ."); sumvnbn.setText(dayall + " / " + daybn); } litg.setText(":"); {// sp1.setVisible(false); spb1.setVisible(false); lb1.setVisible(false); t1.setVisible(false); bt1.setVisible(false); lbb1.setVisible(false); cbx4.setVisible(false); } {// , sp2.setVisible(false); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); } {// sp3.setVisible(false); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); } res.editableProperty().setValue(Boolean.FALSE); t1.editableProperty().setValue(Boolean.FALSE); t2.editableProperty().setValue(Boolean.FALSE); t3.editableProperty().setValue(Boolean.FALSE); titg.editableProperty().setValue(Boolean.FALSE); //cbx1.setItems(GetByTag(TAG_NAME, "1")); //cbx2.setItems(GetByTag(TAG_NAME, "2")); //cbx3.setItems(GetByTag(TAG_NAME, "3")); //cbx4.setItems(GetByTag(TAG_NAME, "4")); //cbx1.valueProperty().addListener(new ); cbx1.setId("comboprod"); cbx2.setId("comboprod"); cbx3.setId("comboprod"); txg3.setPrefSize(70, 80); sp1.setPrefSize(75, 80); sp2.setPrefSize(75, 80); sp3.setPrefSize(75, 80); spb1.setPrefSize(75, 80); lb1.setId("labl"); lb2.setId("labl"); lb3.setId("labl"); lbb1.setId("labl"); t1.setId("textost"); t2.setId("textost"); t3.setId("textost"); bt1.setId("btitg"); bt2.setId("btitg"); bt3.setId("btitg"); cbx4.setId("combbot"); //lb1.setPrefSize(25, 40); //lb2.setPrefSize(25, 40); //lb3.setPrefSize(25, 40); //t1.setPrefSize(150, 40); //t2.setPrefSize(150, 40); //t3.setPrefSize(150, 40); //cbx4.setPrefSize(160,40); //bt2.setPrefSize(40, 40); //bt3.setPrefSize(40, 40); //spb1.setPrefSize(80, 40); //lbb1.setPrefSize(40,40); //bt1.setPrefSize(40, 40); titg.setPrefSize(120, 80); litg.setId("itgl"); res.setPrefSize(300, 300); lb1.setText(""); lb2.setText(""); lb3.setText(""); bt1.setText("+"); bt2.setText("+"); bt3.setText("+"); lbb1.setText(""); bres.setText(""); bitg.setText(""); bdlg.setText(""); bbn.setText("/"); //sp1.setValueFactory(); grid.add(p1, 0, 0); grid.add(p2, 0, 1); grid.add(p3, 0, 2); grid.add(cbx1, 1, 0); grid.add(cbx2, 1, 1); grid.add(cbx3, 1, 2); grid.add(sp1, 2, 0); grid.add(sp2, 2, 1); grid.add(sp3, 2, 2); grid.add(txg3, 2, 2); grid.add(lb1, 3, 0); grid.add(lb2, 3, 1); grid.add(lb3, 3, 2); grid.add(t1, 4, 0); grid.add(t2, 4, 1); grid.add(t3, 4, 2); grid.add(cbx4, 5, 0); grid.add(bt2, 5, 1); grid.add(bt3, 5, 2); grid.add(spb1, 6, 0); grid.add(lbb1, 7, 0); grid.add(bt1, 8, 0); //grid.add(res, 1, 4, 3, 3); grid.add(res, 0, 3, 2, 3); litg.setAlignment(Pos.BASELINE_RIGHT); grid.add(litg, 2, 3); grid.add(titg, 3, 3, 2, 1); grid.add(bitg, 2, 4); grid.add(btcl, 4, 4); grid.add(kasnbn, 10, 0); grid.add(sumnbn, 10, 1); grid.add(kasvnbn, 10, 2); grid.add(sumvnbn, 10, 3); grid.add(vyr, 10, 4); grid.add(close, 10, 8); close.setOnAction(event -> { /** Dialog<Void> dialog = new Dialog<>(); dialog.initModality(Modality.WINDOW_MODAL); dialog.initOwner(primaryStage);//stage here is the stage of your webview //dialog.initStyle(StageStyle.TRANSPARENT); Label loader = new Label("LOADING"); //loader.setContentDisplay(ContentDisplay.DOWN); loader.setGraphic(new ProgressIndicator()); dialog.getDialogPane().setGraphic(loader); DropShadow ds = new DropShadow(); ds.setOffsetX(1.3); ds.setOffsetY(1.3); ds.setColor(Color.DARKGRAY); dialog.getDialogPane().setEffect(ds); //ButtonType btn = new ButtonType("OK",ButtonData.CANCEL_CLOSE); //dialog.getDialogPane().getButtonTypes().add(btn); dialog.show(); runJsons(); dialog.hide(); dialog.close(); **/ Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(""); alert.setHeaderText(" "); alert.setContentText(" ?"); ButtonType buttonTypeOne = new ButtonType(""); ButtonType buttonTypeCancel = new ButtonType("", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeCancel); Optional<ButtonType> result2 = alert.showAndWait(); if (result2.get() == buttonTypeOne) { updsel(m, 1); cashday(m); System.exit(0); } }); btcl.setOnAction(event -> { jsares.clear(); res.setText(""); titg.setText(""); itog = 0; chcount = 1; cbx1.getSelectionModel().clearSelection(); cbx2.getSelectionModel().clearSelection(); cbx3.getSelectionModel().clearSelection(); cbx4.getSelectionModel().clearSelection(); cbx4.setVisible(false); sp1.getValueFactory().setValue(0.0); sp2.getValueFactory().setValue(0); sp3.getValueFactory().setValue(0); spb1.getValueFactory().setValue(0); sp1.setVisible(false); sp2.setVisible(false); sp3.setVisible(false); spb1.setVisible(false); lb1.setVisible(false); lb2.setVisible(false); lb3.setVisible(false); lbb1.setVisible(false); t1.setVisible(false); t2.setVisible(false); t3.setVisible(false); bt1.setVisible(false); bt2.setVisible(false); bt3.setVisible(false); }); bitg.setOnAction(event -> { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(""); alert.setHeaderText(" "); alert.setContentText(" ?"); ButtonType buttonOK = new ButtonType(""); ButtonType buttonCancel = new ButtonType("", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonOK, buttonCancel); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonOK) { alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(""); alert.setHeaderText(" "); alert.setContentText(" "); ButtonType buttonTypeOne = new ButtonType(""); ButtonType buttonTypeTwo = new ButtonType(""); //ButtonType buttonTypeThree = new ButtonType("Three"); ButtonType buttonTypeCancel = new ButtonType("", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeTwo, /*buttonTypeThree,*/ buttonTypeCancel); Optional<ButtonType> result2 = alert.showAndWait(); if (result2.get() == buttonTypeOne) { // ... user chose "One" typepay = ""; finishnal(titg.getText(), res.getText(), 1); } else if (result2.get() == buttonTypeTwo) { // ... user chose "Two" typepay = ""; finishnal(titg.getText(), res.getText(), 2); } /* else if (result2.get() == buttonTypeThree) { // ... user chose "Three" }*/ else { // ... user chose CANCEL or closed the dialog } } else { // ... user chose CANCEL or closed the dialog } }); txg3.setOnMouseClicked(event -> { Dialog dialog = new Dialog(); GridPane gr = new GridPane(); gr.setHgap(3); gr.setVgap(5); gr.setPadding(new Insets(10, 10, 10, 10)); Button b1 = new Button("1"); b1.setPrefSize(50, 50); Button b2 = new Button("2"); b2.setPrefSize(50, 50); Button b3 = new Button("3"); b3.setPrefSize(50, 50); Button b4 = new Button("4"); b4.setPrefSize(50, 50); Button b5 = new Button("5"); b5.setPrefSize(50, 50); Button b6 = new Button("6"); b6.setPrefSize(50, 50); Button b7 = new Button("7"); b7.setPrefSize(50, 50); Button b8 = new Button("8"); b8.setPrefSize(50, 50); Button b9 = new Button("9"); b9.setPrefSize(50, 50); Button b0 = new Button("0"); b0.setPrefSize(50, 50); Button bd = new Button("."); bd.setPrefSize(50, 50); Button bc = new Button("C"); bc.setPrefSize(50, 50); Button bok = new Button(""); bc.setPrefSize(50, 50); Button bno = new Button(""); bc.setPrefSize(50, 50); gr.add(b1, 0, 0); gr.add(b2, 1, 0); gr.add(b3, 2, 0); gr.add(b4, 0, 1); gr.add(b5, 1, 1); gr.add(b6, 2, 1); gr.add(b7, 0, 2); gr.add(b8, 1, 2); gr.add(b9, 2, 2); gr.add(bd, 0, 3); gr.add(b0, 1, 3); gr.add(bc, 2, 3); //gr.add(bok, 0, 4); //gr.add(bno, 3, 4); b1.setOnAction(even -> { txg3.setText(txg3.getText() + "1"); }); b2.setOnAction(even -> { txg3.setText(txg3.getText() + "2"); }); b3.setOnAction(even -> { txg3.setText(txg3.getText() + "3"); }); b4.setOnAction(even -> { txg3.setText(txg3.getText() + "4"); }); b5.setOnAction(even -> { txg3.setText(txg3.getText() + "5"); }); b6.setOnAction(even -> { txg3.setText(txg3.getText() + "6"); }); b7.setOnAction(even -> { txg3.setText(txg3.getText() + "7"); }); b8.setOnAction(even -> { txg3.setText(txg3.getText() + "8"); }); b9.setOnAction(even -> { txg3.setText(txg3.getText() + "9"); }); bc.setOnAction(even -> { txg3.setText(""); }); bd.setOnAction(even -> { txg3.setText(txg3.getText() + "."); }); b0.setOnAction(even -> { txg3.setText(txg3.getText() + "0"); }); ButtonType okk = new ButtonType("OK", ButtonData.OK_DONE); ButtonType no = new ButtonType("", ButtonData.CANCEL_CLOSE); //gr.add(okk, 0, 4); dialog.getDialogPane().setContent(gr); dialog.getDialogPane().getButtonTypes().addAll(no, okk); dialog.setX(350); dialog.setY(260); Optional res = dialog.showAndWait(); runJsons(); // dialog.setResult(ButtonData.CANCEL_CLOSE); //dialog.showAndWait(); }); txg3.lengthProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (newValue.intValue() > oldValue.intValue()) { char ch = txg3.getText().charAt(oldValue.intValue()); // Check if the new character is the number or other's if ((!(ch >= '0' && ch <= '9'))) { // if it's not number then just setText to previous one if (ch == '.') { } else { txg3.setText(txg3.getText().substring(0, txg3.getText().length() - 1)); } } double res; if (cbx3.getSelectionModel().getSelectedIndex() >= 0) { res = Double.parseDouble(txg3.getText()); res = res / 1000; //System.out.println("RES-"+res+"balanc"+balancech(cbx3.getSelectionModel().getSelectedItem().toString())+"BASE"+Double.parseDouble(getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(),MT))); if ((res + balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3)) > Double .parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT))) { txg3.setText(""); Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); } } } } }); cbx1.setOnMouseClicked(new EventHandler() { @Override public void handle(Event event) { spb1.getValueFactory().setValue(0); sp1.getValueFactory().setValue(0.0); runJsons(); cbx1.setItems(GetByTag(TAG_NAME, "1")); //cbx1.getSelectionModel().clearSelection(); int[] remove = new int[cbx1.getItems().size()]; for (int i = 0; i < cbx1.getItems().size(); i++) { //System.out.println("****"+m); if (!isHave(cbx1.getItems().get(i).toString(), 1)) { // } else { } } cbx1.show(); } }); sp1.setOnMouseClicked(event -> { if (cbx1.getSelectionModel().getSelectedItem() != null) { double spres = Double.parseDouble(sp1.getEditor().getText().toString().replace(",", ".")); double salesres = balancech(cbx1.getSelectionModel().getSelectedItem().toString(), 1); double balancestore = Double .parseDouble(getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, MT)); // System.out.println(balancestore+" "+spres+" "+salesres); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); sp1.getValueFactory().setValue(0.0); } } }); sp2.setOnMouseClicked(event -> { if (cbx2.getSelectionModel().getSelectedIndex() >= 0) { double spres = Double.parseDouble(sp2.getEditor().getText().toString()); double salesres = balancech(cbx2.getSelectionModel().getSelectedItem().toString(), 2); double balancestore = Double .parseDouble(getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, MT)); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); sp2.getValueFactory().setValue(0); } } }); spb1.setOnMouseClicked(event -> { if (cbx4.getSelectionModel().getSelectedIndex() >= 0) { double spres = Double.parseDouble(spb1.getEditor().getText().toString()); double salesres = balancech(cbx4.getSelectionModel().getSelectedItem().toString(), 4); double balancestore = Double .parseDouble(getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, MT)); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); spb1.getValueFactory().setValue(0); } } }); sp3.setOnMouseClicked(event -> { if (cbx3.getSelectionModel().getSelectedIndex() >= 0) { double spres = Double.parseDouble(sp3.getEditor().getText().toString()); double salesres = balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3); double balancestore = Double .parseDouble(getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT)); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); sp3.getValueFactory().setValue(0); } } }); cbx4.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx4.getSelectionModel().getSelectedItem().toString(), 4)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx4.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { cbx4.getSelectionModel().clearSelection(); } else { cbx4.getSelectionModel().clearSelection(); } } else { } } } }); cbx1.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx1.getSelectionModel().getSelectedItem().toString(), 1)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx1.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { sp1.setVisible(false); sp1.getValueFactory().setValue(0.0); lb1.setVisible(false); t1.setVisible(false); cbx4.setVisible(false); spb1.setVisible(false); spb1.getValueFactory().setValue(0); lbb1.setVisible(false); bt1.setVisible(false); cbx1.getSelectionModel().clearSelection(); } else { sp1.setVisible(false); sp1.getValueFactory().setValue(0.0); lb1.setVisible(false); t1.setVisible(false); cbx4.setVisible(false); spb1.setVisible(false); spb1.getValueFactory().setValue(0); lbb1.setVisible(false); bt1.setVisible(false); cbx1.getSelectionModel().clearSelection(); } } else { sp2.setVisible(false); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); sp2.getValueFactory().setValue(0); cbx2.getSelectionModel().clearSelection(); txg3.setVisible(false); sp3.setVisible(false); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); sp3.getValueFactory().setValue(0); cbx3.getSelectionModel().clearSelection(); double curbal = Double.parseDouble( getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, MT)) - balancech(cbx1.getSelectionModel().getSelectedItem().toString(), 1); t1.setText(ost + " " + curbal + " ."); cbx4.setItems(GetByTag(TAG_NAME, "4")); sp1.setVisible(true); lb1.setVisible(true); t1.setVisible(true); cbx4.setVisible(true); spb1.setVisible(true); lbb1.setVisible(true); bt1.setVisible(true); if (cbx1.getSelectionModel().getSelectedItem().toString().matches("")) { sp1.setVisible(false); t1.setVisible(false); lb1.setVisible(false); } } } } }); bt1.setOnAction(event -> { if (cbx1.getSelectionModel().getSelectedItem().toString().matches("")) { if (spb1.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else { double bottlprice = Double.parseDouble( getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "price")); int bottlc = spb1.getValueFactory().getValue(); double bottleitg = bottlc * bottlprice; res.setText(res.getText() + printCh2(cbx4.getSelectionModel().getSelectedItem().toString(), "", bottlc, bottlprice) + "\n"); itog = itog + bottleitg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "id")); jsores.put(TCOUNT, bottlc); jsores.put(TRES, bottleitg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID SimpleDateFormat fff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, fff.format(System.currentTimeMillis())); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); cbx4.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); spb1.getValueFactory().setValue(0); sp1.getValueFactory().setValue(0.0); cbx1.getSelectionModel().clearSelection(); cbx4.getSelectionModel().clearSelection(); } } else { if (sp1.getValueFactory().getValue() < 0.5) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else if (cbx4.getSelectionModel().getSelectedItem() == null) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else if (spb1.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } /*else if(cbx4.getSelectionModel().getSelectedItem().toString().matches("")){ Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); }*/else { double liters = sp1.getValueFactory().getValue(); double bottlc = spb1.getValueFactory().getValue(); String sb = cbx4.getSelectionModel().getSelectedItem().toString(); double bottlsz = 0; if (sb.contains("0.5") | sb.contains("0,5")) { bottlsz = 0.5; } else if (sb.contains("1.0") | sb.contains("1,0")) { bottlsz = 1.0; } else if (sb.contains("1.5") | sb.contains("1,5")) { bottlsz = 1.5; } else if (sb.contains("2,0") | sb.contains("2.0") | sb.contains("2")) { bottlsz = 2.0; } else if (sb.contains("3,0") | sb.contains("3.0") | sb.contains("3")) { bottlsz = 3.0; } else if (sb.contains("")) { bottlsz = 0.5; } if ((bottlsz * bottlc) == liters) { double price = Double.parseDouble( getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, TAG_PRICE)); String prodn = cbx1.getSelectionModel().getSelectedItem().toString(); double itg = 0; if (getTwotag(prodn, 1, "sales").matches("1")) { if (liters % 3 == 0) { price = ((liters * price) - ((liters / 3) * price)) / liters; itg = liters * price; } else { itg = liters * price; } } else { itg = liters * price; } double bottlprice = 0; if (sp1.isVisible() & !cbx4.getSelectionModel().getSelectedItem().toString().contains("")) { bottlprice = Double.parseDouble( getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "price")); } else if (sp1.isVisible() & cbx4.getSelectionModel().getSelectedItem().toString().contains("")) { bottlprice = 0; } else if (!sp1.isVisible() & cbx4.getSelectionModel().getSelectedItem().toString().contains("")) { bottlprice = 0; } res.setText(res.getText() + printCh2(cbx1.getSelectionModel().getSelectedItem().toString(), "", liters, price) + "\n"); res.setText(res.getText() + printCh2(cbx4.getSelectionModel().getSelectedItem().toString(), "", bottlc, bottlprice) + "\n"); itog += itg; jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, "id")); jsores.put(TCOUNT, String.valueOf(liters)); jsores.put(TRES, itg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balance1.get(cbx1.getSelectionModel().getSelectedIndex()) - coun)); SimpleDateFormat ff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, ff.format(System.currentTimeMillis())); //jsores.put("seltype","1"); //jsores.put("dolgid","1"); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); double bottleitg = bottlprice * bottlc; itog = itog + bottleitg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "id")); jsores.put(TCOUNT, bottlc); jsores.put(TRES, bottleitg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balanceb.get(cbx4.getSelectionModel().getSelectedIndex()) - counb)); SimpleDateFormat fff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, fff.format(System.currentTimeMillis())); //jsores.put("seltype",1); ! //jsores.put("dolgid",1); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); //System.out.println(jsares); sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); cbx4.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); spb1.getValueFactory().setValue(0); sp1.getValueFactory().setValue(0.0); cbx1.getSelectionModel().clearSelection(); cbx4.getSelectionModel().clearSelection(); } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } } } }); cbx2.setOnMouseClicked(new EventHandler() { @Override public void handle(Event event) { runJsons(); cbx2.setItems(GetByTag(TAG_NAME, "2")); cbx2.show(); } }); cbx2.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx2.getSelectionModel().getSelectedItem().toString(), 2)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx2.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { sp2.setVisible(false); sp2.getValueFactory().setValue(0); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); cbx2.getSelectionModel().clearSelection(); } else { sp2.setVisible(false); sp2.getValueFactory().setValue(0); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); cbx2.getSelectionModel().clearSelection(); } } else { txg3.setVisible(false); sp3.setVisible(!true); lb3.setVisible(!true); t3.setVisible(!true); bt3.setVisible(!true); sp3.getValueFactory().setValue(0); cbx3.getSelectionModel().clearSelection(); cbx4.setVisible(!true); sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); sp1.getValueFactory().setValue(0.0); spb1.getValueFactory().setValue(0); cbx1.getSelectionModel().clearSelection(); sp2.setVisible(true); lb2.setVisible(true); t2.setVisible(true); bt2.setVisible(true); sp2.getValueFactory().setValue(0); //System.out.println("////////"+newValue+"/////"); double curbal = Double.parseDouble( getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, MT)) - balancech(cbx2.getSelectionModel().getSelectedItem().toString(), 2); t2.setText(ost + " " + curbal + " ."); } } } }); bt2.setOnAction(event -> { if (sp2.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else { int coun = Integer.parseInt(sp2.getEditor().getText()); double price = Double.parseDouble( getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, TAG_PRICE)); double itg = coun * price; res.setText(res.getText() + printCh2(cbx2.getSelectionModel().getSelectedItem().toString(), "", coun, price) + "\n"); itog = itog + itg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, TAG_ID)); jsores.put(TCOUNT, String.valueOf(coun)); jsores.put(TRES, itg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balance2.get(cbx2.getSelectionModel().getSelectedIndex()) - coun)); SimpleDateFormat ff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, ff.format(System.currentTimeMillis())); //jsores.put("seltype","1"); !!!!!! //jsores.put("dolgid","1"); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); sp2.setVisible(!true); lb2.setVisible(!true); t2.setVisible(!true); bt2.setVisible(!true); sp2.getValueFactory().setValue(0); cbx2.getSelectionModel().clearSelection(); } }); cbx3.setOnMouseClicked(new EventHandler() { @Override public void handle(Event event) { sp3.getValueFactory().setValue(0); runJsons(); cbx3.setItems(GetByTag(TAG_NAME, "3")); cbx3.show(); } }); cbx3.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx3.getSelectionModel().getSelectedItem().toString(), 3)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx3.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { sp3.setVisible(false); sp3.getValueFactory().setValue(0); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); cbx3.getSelectionModel().clearSelection(); } else { sp3.setVisible(false); sp3.getValueFactory().setValue(0); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); cbx3.getSelectionModel().clearSelection(); } } else { sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); cbx4.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); //spb1.getEditor().setText("0"); //sp1.getEditor().setText("0"); cbx1.getSelectionModel().clearSelection(); sp2.setVisible(!true); lb2.setVisible(!true); t2.setVisible(!true); bt2.setVisible(!true); sp2.getValueFactory().setValue(0); cbx2.getSelectionModel().clearSelection(); sp3.setVisible(true); lb3.setVisible(true); t3.setVisible(true); bt3.setVisible(true); sp3.getValueFactory().setValue(0); if (getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, TAG_ZT) .equals("2")) { double curbal = Double.parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT)) - (balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3)); String pattern = "##0.00"; DecimalFormat decimalFormat = new DecimalFormat(pattern); String format = decimalFormat.format(curbal); t3.setText(ost + " " + format + " ."); lb3.setText(""); sp3.setVisible(false); txg3.setVisible(true); txg3.setText(""); } else { double curbal = Double.parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT)) - balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3); t3.setText(ost + " " + curbal + " ."); lb3.setText(""); txg3.setVisible(false); sp3.setVisible(true); } } } } }); bt3.setOnAction(event -> { int typez = Integer.parseInt(getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, "zt")); if (sp3.isVisible() & sp3.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else if (txg3.isVisible() & txg3.getText().equals("")) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!!"); alert.setContentText(" !"); alert.showAndWait(); } else { double coun = 0; double price = Double.parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, TAG_PRICE)); double itg = 0; double itgcoun = 0; if (lb3.getText().equals("")) { //System.out.println(lb3.getText()); coun = sp3.getValueFactory().getValue(); itg = coun * price; itgcoun = coun; // System.out.println("SPINNER" + coun); res.setText(res.getText() + printCh2(cbx3.getSelectionModel().getSelectedItem().toString(), "", coun, price) + "\n"); } else if (lb3.getText().equals("")) { // System.out.println(lb3.getText()); coun = Double.parseDouble(txg3.getText()); itg = ((price * coun) / 100); // System.out.println("!!!???!!!"+coun+" "+price); res.setText(res.getText() + printCh3(cbx3.getSelectionModel().getSelectedItem().toString(), "", coun, price) + "\n"); itgcoun = (double) coun / 1000; //System.out.println("TEXT" + coun+" "+itgcoun); } String pattern = "##0.0"; DecimalFormat decimalFormat = new DecimalFormat(pattern); String format = decimalFormat.format(itg); itog = itog + itg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, TAG_ID)); jsores.put(TCOUNT, Double.parseDouble(String.valueOf(itgcoun))); jsores.put(TRES, itg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balance3.get(cbx3.getSelectionModel().getSelectedIndex()) - coun)); SimpleDateFormat ff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, ff.format(System.currentTimeMillis())); //jsores.put("seltype","1"); !!!!! //jsores.put("dolgid","1"); jsores.put(TAG_CHECK, checkcheck()); //System.out.println(jsores); jsares.add(jsores); sp3.setVisible(!true); lb3.setVisible(!true); t3.setVisible(!true); bt3.setVisible(!true); sp3.getValueFactory().setValue(0); cbx3.getSelectionModel().clearSelection(); txg3.setVisible(false); // } } }); Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize(); Scene scene = new Scene(grid, sSize.width, sSize.height); primaryStage.setScene(scene); scene.getStylesheets().add(MainA.class.getResource("main.css").toExternalForm()); primaryStage.show(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTimeTypePickerPane.java
public CFBamJavaFXTimeTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTimeTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamTimeTypeObj> argDataCollection, ICFBamJavaFXTimeTypeChosen whenChosen) { super();//from w w w . j a v a 2 s . c om final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTimeTypeObj>(); tableColumnId = new TableColumn<ICFBamTimeTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTimeTypeObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Long>, TableCell<ICFBamTimeTypeObj, Long>>() { @Override public TableCell<ICFBamTimeTypeObj, Long> call(TableColumn<ICFBamTimeTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTimeTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, String>, TableCell<ICFBamTimeTypeObj, String>>() { @Override public TableCell<ICFBamTimeTypeObj, String> call(TableColumn<ICFBamTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTimeTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, String>, TableCell<ICFBamTimeTypeObj, String>>() { @Override public TableCell<ICFBamTimeTypeObj, String> call(TableColumn<ICFBamTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTimeTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, String>, TableCell<ICFBamTimeTypeObj, String>>() { @Override public TableCell<ICFBamTimeTypeObj, String> call(TableColumn<ICFBamTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTimeTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, String>, TableCell<ICFBamTimeTypeObj, String>>() { @Override public TableCell<ICFBamTimeTypeObj, String> call(TableColumn<ICFBamTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTimeTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, String>, TableCell<ICFBamTimeTypeObj, String>>() { @Override public TableCell<ICFBamTimeTypeObj, String> call(TableColumn<ICFBamTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTimeTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTimeTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Boolean>, TableCell<ICFBamTimeTypeObj, Boolean>>() { @Override public TableCell<ICFBamTimeTypeObj, Boolean> call(TableColumn<ICFBamTimeTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTimeTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTimeTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Boolean>, TableCell<ICFBamTimeTypeObj, Boolean>>() { @Override public TableCell<ICFBamTimeTypeObj, Boolean> call(TableColumn<ICFBamTimeTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTimeTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTimeTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Boolean>, TableCell<ICFBamTimeTypeObj, Boolean>>() { @Override public TableCell<ICFBamTimeTypeObj, Boolean> call(TableColumn<ICFBamTimeTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTimeTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTimeTypeObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, String>, TableCell<ICFBamTimeTypeObj, String>>() { @Override public TableCell<ICFBamTimeTypeObj, String> call(TableColumn<ICFBamTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamTimeTypeObj, Calendar>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeTypeObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Calendar>, TableCell<ICFBamTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTimeTypeObj, Calendar> call( TableColumn<ICFBamTimeTypeObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTimeTypeObj, Calendar>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeTypeObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Calendar>, TableCell<ICFBamTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTimeTypeObj, Calendar> call( TableColumn<ICFBamTimeTypeObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTimeTypeObj, Calendar>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeTypeObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Calendar>, TableCell<ICFBamTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTimeTypeObj, Calendar> call( TableColumn<ICFBamTimeTypeObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTimeTypeObj, Calendar>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTimeTypeObj, Calendar> p) { ICFBamTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, Calendar>, TableCell<ICFBamTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTimeTypeObj, Calendar> call( TableColumn<ICFBamTimeTypeObj, Calendar> arg) { return new CFTimeTableCell<ICFBamTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTimeTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTimeTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTimeTypeObj, ICFBamSchemaDefObj> p) { ICFBamTimeTypeObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamTimeTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamTimeTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTimeTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTimeTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTimeTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTimeTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamTimeTypeObj> observable, ICFBamTimeTypeObj oldValue, ICFBamTimeTypeObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseTimeType(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTimeTypeObj selectedInstance = getJavaFXFocusAsTimeType(); invokeWhenChosen.choseTimeType(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTZTimeColPickerPane.java
public CFBamJavaFXTZTimeColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTZTimeColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamTZTimeColObj> argDataCollection, ICFBamJavaFXTZTimeColChosen whenChosen) { super();//from w w w .j a va 2 s.c o m final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTZTimeColObj>(); tableColumnId = new TableColumn<ICFBamTZTimeColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTZTimeColObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Long>, TableCell<ICFBamTZTimeColObj, Long>>() { @Override public TableCell<ICFBamTZTimeColObj, Long> call(TableColumn<ICFBamTZTimeColObj, Long> arg) { return new CFInt64TableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTZTimeColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, String>, TableCell<ICFBamTZTimeColObj, String>>() { @Override public TableCell<ICFBamTZTimeColObj, String> call(TableColumn<ICFBamTZTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTZTimeColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, String>, TableCell<ICFBamTZTimeColObj, String>>() { @Override public TableCell<ICFBamTZTimeColObj, String> call(TableColumn<ICFBamTZTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTZTimeColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, String>, TableCell<ICFBamTZTimeColObj, String>>() { @Override public TableCell<ICFBamTZTimeColObj, String> call(TableColumn<ICFBamTZTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTZTimeColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, String>, TableCell<ICFBamTZTimeColObj, String>>() { @Override public TableCell<ICFBamTZTimeColObj, String> call(TableColumn<ICFBamTZTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTZTimeColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, String>, TableCell<ICFBamTZTimeColObj, String>>() { @Override public TableCell<ICFBamTZTimeColObj, String> call(TableColumn<ICFBamTZTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTZTimeColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTZTimeColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Boolean>, TableCell<ICFBamTZTimeColObj, Boolean>>() { @Override public TableCell<ICFBamTZTimeColObj, Boolean> call( TableColumn<ICFBamTZTimeColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTZTimeColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTZTimeColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Boolean>, TableCell<ICFBamTZTimeColObj, Boolean>>() { @Override public TableCell<ICFBamTZTimeColObj, Boolean> call( TableColumn<ICFBamTZTimeColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTZTimeColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTZTimeColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Boolean>, TableCell<ICFBamTZTimeColObj, Boolean>>() { @Override public TableCell<ICFBamTZTimeColObj, Boolean> call( TableColumn<ICFBamTZTimeColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTZTimeColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeColObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, String>, TableCell<ICFBamTZTimeColObj, String>>() { @Override public TableCell<ICFBamTZTimeColObj, String> call(TableColumn<ICFBamTZTimeColObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamTZTimeColObj, Calendar>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeColObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Calendar>, TableCell<ICFBamTZTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeColObj, Calendar> call( TableColumn<ICFBamTZTimeColObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTZTimeColObj, Calendar>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeColObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Calendar>, TableCell<ICFBamTZTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeColObj, Calendar> call( TableColumn<ICFBamTZTimeColObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTZTimeColObj, Calendar>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeColObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Calendar>, TableCell<ICFBamTZTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeColObj, Calendar> call( TableColumn<ICFBamTZTimeColObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTZTimeColObj, Calendar>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeColObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, Calendar>, TableCell<ICFBamTZTimeColObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeColObj, Calendar> call( TableColumn<ICFBamTZTimeColObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTZTimeColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTZTimeColObj, ICFBamSchemaDefObj> p) { ICFBamTZTimeColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamTZTimeColObj, ICFBamSchemaDefObj>, TableCell<ICFBamTZTimeColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTZTimeColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTZTimeColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTZTimeColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTZTimeColObj>() { @Override public void changed(ObservableValue<? extends ICFBamTZTimeColObj> observable, ICFBamTZTimeColObj oldValue, ICFBamTZTimeColObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseTZTimeCol(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZTimeColObj selectedInstance = getJavaFXFocusAsTZTimeCol(); invokeWhenChosen.choseTZTimeCol(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXRelationColListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddRelationCol = new CFButton(); buttonAddRelationCol.setMinWidth(200); buttonAddRelationCol.setText("Add RelationCol"); buttonAddRelationCol.setOnAction(new EventHandler<ActionEvent>() { @Override/* w ww . j a v a2 s . c om*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamRelationColObj obj = (ICFBamRelationColObj) schemaObj.getRelationColTableObj() .newInstance(); ICFBamRelationColEditObj edit = (ICFBamRelationColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamRelationObj container = (ICFBamRelationObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerRelation(container); CFBorderPane frame = javafxSchema.getRelationColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXRelationColPaneCommon jpanelCommon = (ICFBamJavaFXRelationColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAddRelationCol); buttonMoveUpSelected = new CFButton(); buttonMoveUpSelected.setMinWidth(200); buttonMoveUpSelected.setText("Move Up Selected"); buttonMoveUpSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); if (selectedInstance != null) { if (null != selectedInstance.getOptionalLookupPrev()) { selectedInstance.moveUp(); refreshMe(); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonMoveUpSelected); buttonMoveDownSelected = new CFButton(); buttonMoveDownSelected.setMinWidth(200); buttonMoveDownSelected.setText("Move Down Selected"); buttonMoveDownSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); if (selectedInstance != null) { if (null != selectedInstance.getOptionalLookupNext()) { selectedInstance.moveDown(); refreshMe(); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonMoveDownSelected); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("RELC".equals(classCode)) { CFBorderPane frame = javafxSchema.getRelationColFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXRelationColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamRelationColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("RELC".equals(classCode)) { CFBorderPane frame = javafxSchema.getRelationColFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXRelationColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamRelationColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("RELC".equals(classCode)) { CFBorderPane frame = javafxSchema.getRelationColFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXRelationColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamRelationColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXIndexListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddIndex = new CFButton(); buttonAddIndex.setMinWidth(200); buttonAddIndex.setText("Add Index"); buttonAddIndex.setOnAction(new EventHandler<ActionEvent>() { @Override/* ww w .java2 s .co m*/ public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamIndexObj obj = (ICFBamIndexObj) schemaObj.getIndexTableObj().newInstance(); ICFBamIndexEditObj edit = (ICFBamIndexEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerIdxTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); CFBorderPane frame = javafxSchema.getIndexFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXIndexPaneCommon jpanelCommon = (ICFBamJavaFXIndexPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAddIndex); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamIndexObj selectedInstance = getJavaFXFocusAsIndex(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("IDXD".equals(classCode)) { CFBorderPane frame = javafxSchema.getIndexFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXIndexPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamIndexObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamIndexObj selectedInstance = getJavaFXFocusAsIndex(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("IDXD".equals(classCode)) { CFBorderPane frame = javafxSchema.getIndexFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXIndexPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamIndexObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamIndexObj selectedInstance = getJavaFXFocusAsIndex(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("IDXD".equals(classCode)) { CFBorderPane frame = javafxSchema.getIndexFactory().newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXIndexPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamIndexObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTZTimeTypePickerPane.java
public CFBamJavaFXTZTimeTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTZTimeTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamTZTimeTypeObj> argDataCollection, ICFBamJavaFXTZTimeTypeChosen whenChosen) { super();/* w ww. ja v a2 s. c o m*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTZTimeTypeObj>(); tableColumnId = new TableColumn<ICFBamTZTimeTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTZTimeTypeObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Long>, TableCell<ICFBamTZTimeTypeObj, Long>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Long> call(TableColumn<ICFBamTZTimeTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTZTimeTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, String>, TableCell<ICFBamTZTimeTypeObj, String>>() { @Override public TableCell<ICFBamTZTimeTypeObj, String> call( TableColumn<ICFBamTZTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTZTimeTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, String>, TableCell<ICFBamTZTimeTypeObj, String>>() { @Override public TableCell<ICFBamTZTimeTypeObj, String> call( TableColumn<ICFBamTZTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTZTimeTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, String>, TableCell<ICFBamTZTimeTypeObj, String>>() { @Override public TableCell<ICFBamTZTimeTypeObj, String> call( TableColumn<ICFBamTZTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTZTimeTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, String>, TableCell<ICFBamTZTimeTypeObj, String>>() { @Override public TableCell<ICFBamTZTimeTypeObj, String> call( TableColumn<ICFBamTZTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTZTimeTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, String>, TableCell<ICFBamTZTimeTypeObj, String>>() { @Override public TableCell<ICFBamTZTimeTypeObj, String> call( TableColumn<ICFBamTZTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTZTimeTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTZTimeTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Boolean>, TableCell<ICFBamTZTimeTypeObj, Boolean>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Boolean> call( TableColumn<ICFBamTZTimeTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTZTimeTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTZTimeTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Boolean>, TableCell<ICFBamTZTimeTypeObj, Boolean>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Boolean> call( TableColumn<ICFBamTZTimeTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTZTimeTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTZTimeTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Boolean>, TableCell<ICFBamTZTimeTypeObj, Boolean>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Boolean> call( TableColumn<ICFBamTZTimeTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTZTimeTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTZTimeTypeObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, String>, TableCell<ICFBamTZTimeTypeObj, String>>() { @Override public TableCell<ICFBamTZTimeTypeObj, String> call( TableColumn<ICFBamTZTimeTypeObj, String> arg) { return new CFStringTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamTZTimeTypeObj, Calendar>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeTypeObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Calendar>, TableCell<ICFBamTZTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Calendar> call( TableColumn<ICFBamTZTimeTypeObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTZTimeTypeObj, Calendar>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeTypeObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Calendar>, TableCell<ICFBamTZTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Calendar> call( TableColumn<ICFBamTZTimeTypeObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTZTimeTypeObj, Calendar>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeTypeObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Calendar>, TableCell<ICFBamTZTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Calendar> call( TableColumn<ICFBamTZTimeTypeObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTZTimeTypeObj, Calendar>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamTZTimeTypeObj, Calendar> p) { ICFBamTZTimeDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, Calendar>, TableCell<ICFBamTZTimeTypeObj, Calendar>>() { @Override public TableCell<ICFBamTZTimeTypeObj, Calendar> call( TableColumn<ICFBamTZTimeTypeObj, Calendar> arg) { return new CFTZTimeTableCell<ICFBamTZTimeTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj> p) { ICFBamTZTimeTypeObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTZTimeTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTZTimeTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamTZTimeTypeObj> observable, ICFBamTZTimeTypeObj oldValue, ICFBamTZTimeTypeObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseTZTimeType(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTZTimeTypeObj selectedInstance = getJavaFXFocusAsTZTimeType(); invokeWhenChosen.choseTZTimeType(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXBlobColListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddBlobCol = new CFButton(); buttonAddBlobCol.setMinWidth(200); buttonAddBlobCol.setText("Add BlobCol"); buttonAddBlobCol.setOnAction(new EventHandler<ActionEvent>() { @Override//from w ww . j a va 2s .c o m public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamBlobColObj obj = (ICFBamBlobColObj) schemaObj.getBlobColTableObj().newInstance(); ICFBamBlobColEditObj edit = (ICFBamBlobColEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerTable(container); CFBorderPane frame = javafxSchema.getBlobColFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXBlobColPaneCommon jpanelCommon = (ICFBamJavaFXBlobColPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAddBlobCol); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamBlobColObj selectedInstance = getJavaFXFocusAsBlobCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("BLBC".equals(classCode)) { CFBorderPane frame = javafxSchema.getBlobColFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXBlobColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamBlobColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamBlobColObj selectedInstance = getJavaFXFocusAsBlobCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("BLBC".equals(classCode)) { CFBorderPane frame = javafxSchema.getBlobColFactory().newViewEditForm(cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXBlobColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamBlobColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamBlobColObj selectedInstance = getJavaFXFocusAsBlobCol(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("BLBC".equals(classCode)) { CFBorderPane frame = javafxSchema.getBlobColFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXBlobColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamBlobColObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXBlobTypeListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); buttonAddBlobType = new CFButton(); buttonAddBlobType.setMinWidth(200); buttonAddBlobType.setText("Add BlobType"); buttonAddBlobType.setOnAction(new EventHandler<ActionEvent>() { @Override// ww w .java2s. co m public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamBlobTypeObj obj = (ICFBamBlobTypeObj) schemaObj.getBlobTypeTableObj().newInstance(); ICFBamBlobTypeEditObj edit = (ICFBamBlobTypeEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerSchemaDef(container); CFBorderPane frame = javafxSchema.getBlobTypeFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamJavaFXBlobTypePaneCommon jpanelCommon = (ICFBamJavaFXBlobTypePaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAddBlobType); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamBlobTypeObj selectedInstance = getJavaFXFocusAsBlobType(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("BLBT".equals(classCode)) { CFBorderPane frame = javafxSchema.getBlobTypeFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXBlobTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamBlobTypeObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamBlobTypeObj selectedInstance = getJavaFXFocusAsBlobType(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("BLBT".equals(classCode)) { CFBorderPane frame = javafxSchema.getBlobTypeFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXBlobTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamBlobTypeObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamBlobTypeObj selectedInstance = getJavaFXFocusAsBlobType(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("BLBT".equals(classCode)) { CFBorderPane frame = javafxSchema.getBlobTypeFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXBlobTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamBlobTypeObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXUuidDefPickerPane.java
public CFBamJavaFXUuidDefPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamUuidDefObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamUuidDefObj> argDataCollection, ICFBamJavaFXUuidDefChosen whenChosen) { super();/* w w w. j ava 2 s .c o m*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamUuidDefObj>(); tableColumnObjKind = new TableColumn<ICFBamUuidDefObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String classCode = obj.getClassCode(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(classCode); return (observable); } } }); tableColumnObjKind.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamUuidDefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUuidDefObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, Long>, TableCell<ICFBamUuidDefObj, Long>>() { @Override public TableCell<ICFBamUuidDefObj, Long> call(TableColumn<ICFBamUuidDefObj, Long> arg) { return new CFInt64TableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamUuidDefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamUuidDefObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamUuidDefObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamUuidDefObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamUuidDefObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamUuidDefObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidDefObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, Boolean>, TableCell<ICFBamUuidDefObj, Boolean>>() { @Override public TableCell<ICFBamUuidDefObj, Boolean> call(TableColumn<ICFBamUuidDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamUuidDefObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidDefObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, Boolean>, TableCell<ICFBamUuidDefObj, Boolean>>() { @Override public TableCell<ICFBamUuidDefObj, Boolean> call(TableColumn<ICFBamUuidDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamUuidDefObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidDefObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, Boolean>, TableCell<ICFBamUuidDefObj, Boolean>>() { @Override public TableCell<ICFBamUuidDefObj, Boolean> call(TableColumn<ICFBamUuidDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamUuidDefObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidDefObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, String>, TableCell<ICFBamUuidDefObj, String>>() { @Override public TableCell<ICFBamUuidDefObj, String> call(TableColumn<ICFBamUuidDefObj, String> arg) { return new CFStringTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamUuidDefObj, UUID>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidDefObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, UUID>, TableCell<ICFBamUuidDefObj, UUID>>() { @Override public TableCell<ICFBamUuidDefObj, UUID> call(TableColumn<ICFBamUuidDefObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamUuidDefObj, UUID>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidDefObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, UUID>, TableCell<ICFBamUuidDefObj, UUID>>() { @Override public TableCell<ICFBamUuidDefObj, UUID> call(TableColumn<ICFBamUuidDefObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamUuidDefObj, UUID>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidDefObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, UUID>, TableCell<ICFBamUuidDefObj, UUID>>() { @Override public TableCell<ICFBamUuidDefObj, UUID> call(TableColumn<ICFBamUuidDefObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamUuidDefObj, UUID>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidDefObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, UUID>, TableCell<ICFBamUuidDefObj, UUID>>() { @Override public TableCell<ICFBamUuidDefObj, UUID> call(TableColumn<ICFBamUuidDefObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidDefObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamUuidDefObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidDefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamUuidDefObj, ICFBamSchemaDefObj> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamUuidDefObj, ICFBamSchemaDefObj>, TableCell<ICFBamUuidDefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamUuidDefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamUuidDefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamUuidDefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamUuidDefObj>() { @Override public void changed(ObservableValue<? extends ICFBamUuidDefObj> observable, ICFBamUuidDefObj oldValue, ICFBamUuidDefObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseUuidDef(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef(); invokeWhenChosen.choseUuidDef(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }