List of usage examples for javafx.scene.control Button Button
public Button(String text)
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddSememePopup.java
private AddSememePopup() { super();/* ww w . jav a 2s .com*/ BorderPane root = new BorderPane(); VBox topItems = new VBox(); topItems.setFillWidth(true); title_ = new Label("Create new sememe instance"); title_.getStyleClass().add("titleLabel"); title_.setAlignment(Pos.CENTER); title_.prefWidthProperty().bind(topItems.widthProperty()); topItems.getChildren().add(title_); VBox.setMargin(title_, new Insets(10, 10, 10, 10)); gp_ = new GridPane(); gp_.setHgap(10.0); gp_.setVgap(10.0); VBox.setMargin(gp_, new Insets(5, 5, 5, 5)); topItems.getChildren().add(gp_); Label referencedComponent = new Label("Referenced Component"); referencedComponent.getStyleClass().add("boldLabel"); gp_.add(referencedComponent, 0, 0); unselectableComponentLabel_ = new CopyableLabel(); unselectableComponentLabel_.setWrapText(true); AppContext.getService(DragRegistry.class).setupDragOnly(unselectableComponentLabel_, () -> { if (editRefex_ == null) { return focusNid_ + ""; } else { return Get.identifierService().getConceptNid(editRefex_.getSememe().getAssemblageSequence()) + ""; } }); //delay adding till we know which row Label assemblageConceptLabel = new Label("Assemblage Concept"); assemblageConceptLabel.getStyleClass().add("boldLabel"); gp_.add(assemblageConceptLabel, 0, 1); selectableConcept_ = new ConceptNode(null, true, refexDropDownOptions, null); selectableConcept_.getConceptProperty().addListener(new ChangeListener<ConceptSnapshot>() { @Override public void changed(ObservableValue<? extends ConceptSnapshot> observable, ConceptSnapshot oldValue, ConceptSnapshot newValue) { if (createRefexFocus_ != null && createRefexFocus_ == ViewFocus.REFERENCED_COMPONENT) { if (selectableConcept_.isValid().get()) { //Its a valid concept, but is it a valid assemblage concept? try { assemblageInfo_ = DynamicSememeUsageDescription .read(selectableConcept_.getConceptNoWait().getNid()); assemblageIsValid_.set(true); if (assemblageInfo_.getReferencedComponentTypeRestriction() != null) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeNid(focusNid_), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //don't need coordinates for component type validator if (result.length() > 0) { selectableConcept_.isValid() .setInvalid("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction() .toString() + ", which doesn't match the referenced component."); logger_.info("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction().toString() + ", which doesn't match the referenced component."); assemblageIsValid_.set(false); } } } catch (Exception e) { selectableConcept_.isValid().setInvalid( "The selected concept is not properly constructed for use as an Assemblage concept"); logger_.info("Concept not a valid concept for a sememe assemblage", e); assemblageIsValid_.set(false); } } else { assemblageInfo_ = null; assemblageIsValid_.set(false); } buildDataFields(assemblageIsValid_.get(), null); } } }); selectableComponent_ = new TextField(); selectableComponentNodeValid_ = new ValidBooleanBinding() { { setComputeOnInvalidate(true); bind(selectableComponent_.textProperty()); invalidate(); } @Override protected boolean computeValue() { if (createRefexFocus_ != null && createRefexFocus_ == ViewFocus.ASSEMBLAGE && !conceptNodeIsConceptType_) { //If the assembly nid was what was set - the component node may vary - validate if we are using the text field String value = selectableComponent_.getText().trim(); if (value.length() > 0) { try { if (Utility.isUUID(value)) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeUUID(UUID.fromString(value)), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else if (Utility.isInt(value)) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeNid(Integer.parseInt(value)), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else { setInvalidReason( "Value cannot be parsed as a component identifier. Must be a UUID or a valid NID"); return false; } } catch (Exception e) { logger_.error("Error checking component type validation", e); setInvalidReason("Unexpected error validating entry"); return false; } } else { setInvalidReason("Component identifier is required"); return false; } } clearInvalidReason(); return true; } }; selectableComponentNode_ = ErrorMarkerUtils.setupErrorMarker(selectableComponent_, null, selectableComponentNodeValid_); //delay adding concept / component till we know if / where ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); cc.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(referencedComponent)); gp_.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp_.getColumnConstraints().add(cc); Label l = new Label("Data Fields"); l.getStyleClass().add("boldLabel"); VBox.setMargin(l, new Insets(5, 5, 5, 5)); topItems.getChildren().add(l); root.setTop(topItems); sp_ = new ScrollPane(); sp_.visibleProperty().bind(assemblageIsValid_); sp_.setFitToHeight(true); sp_.setFitToWidth(true); root.setCenter(sp_); allValid_ = new UpdateableBooleanBinding() { { addBinding(assemblageIsValid_, selectableConcept_.isValid(), selectableComponentNodeValid_); } @Override protected boolean computeValue() { if (assemblageIsValid_.get() && (conceptNodeIsConceptType_ ? selectableConcept_.isValid().get() : selectableComponentNodeValid_.get())) { boolean allDataValid = true; for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { if (ssp.get().length() > 0) { allDataValid = false; break; } } if (allDataValid) { clearInvalidReason(); return true; } } setInvalidReason("All errors must be corrected before save is allowed"); return false; } }; GridPane bottomRow = new GridPane(); //spacer col bottomRow.add(new Region(), 0, 0); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction((action) -> { close(); }); GridPane.setMargin(cancelButton, new Insets(5, 20, 5, 0)); GridPane.setHalignment(cancelButton, HPos.RIGHT); bottomRow.add(cancelButton, 1, 0); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(allValid_.not()); saveButton.setOnAction((action) -> { doSave(); }); Node wrappedSave = ErrorMarkerUtils.setupDisabledInfoMarker(saveButton, allValid_.getReasonWhyInvalid()); GridPane.setMargin(wrappedSave, new Insets(5, 0, 5, 20)); bottomRow.add(wrappedSave, 2, 0); //spacer col bottomRow.add(new Region(), 3, 0); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); root.setBottom(bottomRow); Scene scene = new Scene(root); scene.getStylesheets().add(AddSememePopup.class.getResource("/isaac-shared-styles.css").toString()); setScene(scene); }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java
private AddRefexPopup() { super();/*from w w w. ja v a2s . c o m*/ BorderPane root = new BorderPane(); VBox topItems = new VBox(); topItems.setFillWidth(true); title_ = new Label("Create new sememe instance"); title_.getStyleClass().add("titleLabel"); title_.setAlignment(Pos.CENTER); title_.prefWidthProperty().bind(topItems.widthProperty()); topItems.getChildren().add(title_); VBox.setMargin(title_, new Insets(10, 10, 10, 10)); gp_ = new GridPane(); gp_.setHgap(10.0); gp_.setVgap(10.0); VBox.setMargin(gp_, new Insets(5, 5, 5, 5)); topItems.getChildren().add(gp_); Label referencedComponent = new Label("Referenced Component"); referencedComponent.getStyleClass().add("boldLabel"); gp_.add(referencedComponent, 0, 0); unselectableComponentLabel_ = new CopyableLabel(); unselectableComponentLabel_.setWrapText(true); AppContext.getService(DragRegistry.class).setupDragOnly(unselectableComponentLabel_, () -> { if (editRefex_ == null) { if (createRefexFocus_.getComponentNid() != null) { return createRefexFocus_.getComponentNid() + ""; } else { return createRefexFocus_.getAssemblyNid() + ""; } } else { return editRefex_.getRefex().getAssemblageNid() + ""; } }); //delay adding till we know which row Label assemblageConceptLabel = new Label("Assemblage Concept"); assemblageConceptLabel.getStyleClass().add("boldLabel"); gp_.add(assemblageConceptLabel, 0, 1); selectableConcept_ = new ConceptNode(null, true, refexDropDownOptions, null); selectableConcept_.getConceptProperty().addListener(new ChangeListener<ConceptVersionBI>() { @Override public void changed(ObservableValue<? extends ConceptVersionBI> observable, ConceptVersionBI oldValue, ConceptVersionBI newValue) { if (createRefexFocus_ != null && createRefexFocus_.getComponentNid() != null) { if (selectableConcept_.isValid().get()) { //Its a valid concept, but is it a valid assemblage concept? try { assemblageInfo_ = RefexDynamicUsageDescriptionBuilder .readRefexDynamicUsageDescriptionConcept( selectableConcept_.getConceptNoWait().getNid()); assemblageIsValid_.set(true); if (assemblageInfo_.getReferencedComponentTypeRestriction() != null) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn( new RefexDynamicNid(createRefexFocus_.getComponentNid()), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { selectableConcept_.isValid() .setInvalid("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction() .toString() + ", which doesn't match the referenced component."); logger_.info("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction().toString() + ", which doesn't match the referenced component."); assemblageIsValid_.set(false); } } } catch (Exception e) { selectableConcept_.isValid().setInvalid( "The selected concept is not properly constructed for use as an Assemblage concept"); logger_.info("Concept not a valid concept for a sememe assemblage", e); assemblageIsValid_.set(false); } } else { assemblageInfo_ = null; assemblageIsValid_.set(false); } buildDataFields(assemblageIsValid_.get(), null); } } }); selectableComponent_ = new TextField(); selectableComponentNodeValid_ = new ValidBooleanBinding() { { setComputeOnInvalidate(true); bind(selectableComponent_.textProperty()); invalidate(); } @Override protected boolean computeValue() { if (createRefexFocus_ != null && createRefexFocus_.getAssemblyNid() != null && !conceptNodeIsConceptType_) { //If the assembly nid was what was set - the component node may vary - validate if we are using the text field String value = selectableComponent_.getText().trim(); if (value.length() > 0) { try { if (Utility.isUUID(value)) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new RefexDynamicUUID(UUID.fromString(value)), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else if (Utility.isInt(value)) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new RefexDynamicNid(Integer.parseInt(value)), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else { setInvalidReason( "Value cannot be parsed as a component identifier. Must be a UUID or a valid NID"); return false; } } catch (Exception e) { logger_.error("Error checking component type validation", e); setInvalidReason("Unexpected error validating entry"); return false; } } else { setInvalidReason("Component identifier is required"); return false; } } clearInvalidReason(); return true; } }; selectableComponentNode_ = ErrorMarkerUtils.setupErrorMarker(selectableComponent_, null, selectableComponentNodeValid_); //delay adding concept / component till we know if / where ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); cc.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(referencedComponent)); gp_.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp_.getColumnConstraints().add(cc); Label l = new Label("Data Fields"); l.getStyleClass().add("boldLabel"); VBox.setMargin(l, new Insets(5, 5, 5, 5)); topItems.getChildren().add(l); root.setTop(topItems); sp_ = new ScrollPane(); sp_.visibleProperty().bind(assemblageIsValid_); sp_.setFitToHeight(true); sp_.setFitToWidth(true); root.setCenter(sp_); allValid_ = new UpdateableBooleanBinding() { { addBinding(assemblageIsValid_, selectableConcept_.isValid(), selectableComponentNodeValid_); } @Override protected boolean computeValue() { if (assemblageIsValid_.get() && (conceptNodeIsConceptType_ ? selectableConcept_.isValid().get() : selectableComponentNodeValid_.get())) { boolean allDataValid = true; for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { if (ssp.get().length() > 0) { allDataValid = false; break; } } if (allDataValid) { clearInvalidReason(); return true; } } setInvalidReason("All errors must be corrected before save is allowed"); return false; } }; GridPane bottomRow = new GridPane(); //spacer col bottomRow.add(new Region(), 0, 0); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction((action) -> { close(); }); GridPane.setMargin(cancelButton, new Insets(5, 20, 5, 0)); GridPane.setHalignment(cancelButton, HPos.RIGHT); bottomRow.add(cancelButton, 1, 0); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(allValid_.not()); saveButton.setOnAction((action) -> { doSave(); }); Node wrappedSave = ErrorMarkerUtils.setupDisabledInfoMarker(saveButton, allValid_.getReasonWhyInvalid()); GridPane.setMargin(wrappedSave, new Insets(5, 0, 5, 20)); bottomRow.add(wrappedSave, 2, 0); //spacer col bottomRow.add(new Region(), 3, 0); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); root.setBottom(bottomRow); Scene scene = new Scene(root); scene.getStylesheets().add(AddRefexPopup.class.getResource("/isaac-shared-styles.css").toString()); setScene(scene); }
From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java
private void showAlert(String text) { Stage dialogStage = new Stage(); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.setScene(new Scene(VBoxBuilder.create().children(new Text(text), new Button("Ok")) .alignment(Pos.CENTER).padding(new Insets(5)).build())); dialogStage.show();/*from w w w. j a v a 2 s .c o m*/ }
From source file:UI.MainStageController.java
/** * shows the correlation table in the analysis view *//*w w w . j a va 2 s. co m*/ @FXML private void displayCorrelationTable() { //Delete whatever's been in the table before TableView<String[]> analysisTable = new TableView<>(); //We want to display correlations and p-Values of every node combination double[][] correlationMatrix = AnalysisData.getCorrelationMatrix().getData(); double[][] pValueMatrix = AnalysisData.getPValueMatrix().getData(); LinkedList<TaxonNode> taxonList = SampleComparison.getUnifiedTaxonList(LoadedData.getSamplesToAnalyze(), AnalysisData.getLevelOfAnalysis()); //Table will consist of strings String[][] tableValues = new String[correlationMatrix.length][correlationMatrix[0].length + 1]; //Add the values as formatted strings for (int i = 0; i < tableValues.length; i++) { tableValues[i][0] = taxonList.get(i).getName(); for (int j = 1; j < tableValues[0].length; j++) { tableValues[i][j] = String.format("%.3f", correlationMatrix[i][j - 1]).replace(",", ".") + "\n(" + String.format("%.2f", pValueMatrix[i][j - 1]).replace(",", ".") + ")"; } } for (int i = 0; i < tableValues[0].length; i++) { String columnTitle; if (i > 0) { columnTitle = taxonList.get(i - 1).getName(); } else { columnTitle = ""; } TableColumn<String[], String> column = new TableColumn<>(columnTitle); final int columnIndex = i; column.setCellValueFactory(cellData -> { String[] row = cellData.getValue(); return new SimpleStringProperty(row[columnIndex]); }); analysisTable.getColumns().add(column); //First column contains taxon names and should be italic if (i == 0) column.setStyle("-fx-font-style:italic;"); } for (int i = 0; i < tableValues.length; i++) { analysisTable.getItems().add(tableValues[i]); } //Display table on a new stage Stage tableStage = new Stage(); tableStage.setTitle("Correlation Table"); BorderPane tablePane = new BorderPane(); Button exportCorrelationsButton = new Button("Save correlation table to CSV"); Button exportPValuesButton = new Button("Save p-value table to CSV"); exportCorrelationsButton.setOnAction(e -> exportTableToCSV(tableValues, false)); exportPValuesButton.setOnAction(e -> exportTableToCSV(tableValues, true)); HBox exportBox = new HBox(exportCorrelationsButton, exportPValuesButton); exportBox.setPadding(new Insets(10)); exportBox.setSpacing(10); tablePane.setTop(exportBox); tablePane.setCenter(analysisTable); Scene tableScene = new Scene(tablePane); tableStage.setScene(tableScene); tableStage.show(); }
From source file:FeeBooster.java
private GridPane unsignedTxGrid(Transaction tx) { // Setup Grid GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER);//from w w w . j a v a 2 s . c om grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); // Instructions Text Text instructions = new Text("Below is the unsiged version of the fee boosted transaction. You can sign " + "this here or copy this transaction and sign it in your wallet"); grid.add(instructions, 0, 0); // Put unsigned transaction in text area byte[] unsignedTxBytes = Transaction.serialize(tx, true); TextArea unsignedTxTxt = new TextArea(Utils.bytesToHex(unsignedTxBytes)); unsignedTxTxt.setWrapText(true); grid.add(unsignedTxTxt, 0, 1); // Radio buttons for sign here or sign elsewhere /*VBox signRadioVbox = new VBox(); ToggleGroup signRadioGroup = new ToggleGroup(); RadioButton signHereRadio = new RadioButton("Sign Here"); signHereRadio.setToggleGroup(signRadioGroup); signRadioVbox.getChildren().add(signHereRadio); RadioButton signWalletRadio = new RadioButton("Sign in my wallet"); signWalletRadio.setToggleGroup(signRadioGroup); signWalletRadio.setSelected(true); signRadioVbox.getChildren().add(signWalletRadio); grid.add(signRadioVbox, 0, 3); */ // Add Next Button Button nextBtn = new Button("Next"); nextBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //if(signHereRadio.isSelected()) // stage.setScene(new Scene(signTxGrid(tx), 800, 500)); //else if(signWalletRadio.isSelected()) if (sceneCursor == scenes.size() - 1) { Scene scene = new Scene(broadcastTxGrid(tx), 900, 500); scenes.add(scene); sceneCursor++; stage.setScene(scene); } else { sceneCursor++; stage.setScene(scenes.get(sceneCursor)); } } }); HBox btnHbox = new HBox(10); // Back Button Button backBtn = new Button("Back"); backBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { sceneCursor--; stage.setScene(scenes.get(sceneCursor)); } }); btnHbox.getChildren().add(backBtn); btnHbox.getChildren().add(nextBtn); // Cancel Button Button cancelBtn = new Button("Cancel"); cancelBtn.setOnAction(cancelEvent); btnHbox.getChildren().add(cancelBtn); grid.add(btnHbox, 0, 2); return grid; }
From source file:editeurpanovisu.EquiCubeDialogController.java
/** * * @param strTypeTransf//from w ww . j a va2s .c om * @throws Exception Exceptions */ public void afficheFenetre(String strTypeTransf) throws Exception { lvListeFichier.getItems().clear(); stTransformations = new Stage(StageStyle.UTILITY); apTransformations = new AnchorPane(); stTransformations.initModality(Modality.APPLICATION_MODAL); stTransformations.setResizable(true); apTransformations.setStyle("-fx-background-color : #ff0000;"); VBox vbFenetre = new VBox(); HBox hbChoix = new HBox(); Pane paneChoixFichier = new Pane(); btnAjouteFichiers = new Button("Ajouter des Fichiers"); paneChoixTypeFichier = new Pane(); Label lblType = new Label("Type des Fichiers de sortie"); rbJpeg = new RadioButton("JPEG (.jpg)"); rbBmp = new RadioButton("BMP (.bmp)"); rbTiff = new RadioButton("TIFF (.tif)"); cbSharpen = new CheckBox("Masque de nettet"); cbSharpen.setSelected(EditeurPanovisu.isbNetteteTransf()); slSharpen = new Slider(0, 2, EditeurPanovisu.getNiveauNetteteTransf()); lblSharpen = new Label(); double lbl = (Math.round(EditeurPanovisu.getNiveauNetteteTransf() * 20.d) / 20.d); lblSharpen.setText(lbl + ""); slSharpen.setDisable(!EditeurPanovisu.isbNetteteTransf()); lblSharpen.setDisable(!EditeurPanovisu.isbNetteteTransf()); Pane paneboutons = new Pane(); btnAnnuler = new Button("Fermer la fentre"); btnValider = new Button("Lancer le traitement"); strTypeTransformation = strTypeTransf; Image imgTransf; if (strTypeTransf.equals(EquiCubeDialogController.EQUI2CUBE)) { stTransformations.setTitle("Transformation d'quirectangulaire en faces de cube"); imgTransf = new Image( "file:" + EditeurPanovisu.getStrRepertAppli() + File.separator + "images/equi2cube.png"); } else { stTransformations.setTitle("Transformation de faces de cube en quirectangulaire"); imgTransf = new Image( "file:" + EditeurPanovisu.getStrRepertAppli() + File.separator + "images/cube2equi.png"); } ImageView ivTypeTransfert = new ImageView(imgTransf); ivTypeTransfert.setLayoutX(35); ivTypeTransfert.setLayoutY(280); paneChoixTypeFichier.getChildren().add(ivTypeTransfert); apTransformations.setPrefHeight(EditeurPanovisu.getHauteurE2C()); apTransformations.setPrefWidth(EditeurPanovisu.getLargeurE2C()); paneChoixFichier.setPrefHeight(350); paneChoixFichier.setPrefWidth(410); paneChoixFichier.setStyle("-fx-background-color: #d0d0d0; -fx-border-color: #bbb;"); paneChoixTypeFichier.setPrefHeight(350); paneChoixTypeFichier.setPrefWidth(180); paneChoixTypeFichier.setStyle("-fx-background-color: #d0d0d0; -fx-border-color: #bbb;"); hbChoix.getChildren().addAll(paneChoixFichier, paneChoixTypeFichier); vbFenetre.setPrefHeight(400); vbFenetre.setPrefWidth(600); apTransformations.getChildren().add(vbFenetre); hbChoix.setPrefHeight(350); hbChoix.setPrefWidth(600); hbChoix.setStyle("-fx-background-color: #d0d0d0;"); paneboutons.setPrefHeight(50); paneboutons.setPrefWidth(600); paneboutons.setStyle("-fx-background-color: #d0d0d0;"); vbFenetre.setStyle("-fx-background-color: #d0d0d0;"); btnAnnuler.setLayoutX(296); btnAnnuler.setLayoutY(10); btnValider.setLayoutX(433); btnValider.setLayoutY(10); lvListeFichier.setPrefHeight(290); lvListeFichier.setPrefWidth(380); lvListeFichier.setEditable(true); lvListeFichier.setLayoutX(14); lvListeFichier.setLayoutY(14); btnAjouteFichiers.setLayoutX(259); btnAjouteFichiers.setLayoutY(319); paneChoixFichier.getChildren().addAll(lvListeFichier, btnAjouteFichiers); if (strTypeTransf.equals(EquiCubeDialogController.EQUI2CUBE)) { lblDragDropE2C = new Label(rbLocalisation.getString("transformation.dragDropE2C")); } else { lblDragDropE2C = new Label(rbLocalisation.getString("transformation.dragDropC2E")); } lblDragDropE2C.setMinHeight(lvListeFichier.getPrefHeight()); lblDragDropE2C.setMaxHeight(lvListeFichier.getPrefHeight()); lblDragDropE2C.setMinWidth(lvListeFichier.getPrefWidth()); lblDragDropE2C.setMaxWidth(lvListeFichier.getPrefWidth()); lblDragDropE2C.setLayoutX(14); lblDragDropE2C.setLayoutY(14); lblDragDropE2C.setAlignment(Pos.CENTER); lblDragDropE2C.setTextFill(Color.web("#c9c7c7")); lblDragDropE2C.setTextAlignment(TextAlignment.CENTER); lblDragDropE2C.setWrapText(true); lblDragDropE2C.setStyle("-fx-font-size : 24px"); lblDragDropE2C.setStyle("-fx-background-color : rgba(128,128,128,0.1)"); paneChoixFichier.getChildren().add(lblDragDropE2C); lblType.setLayoutX(14); lblType.setLayoutY(14); rbBmp.setLayoutX(43); rbBmp.setLayoutY(43); rbBmp.setUserData("bmp"); if (EditeurPanovisu.getStrTypeFichierTransf().equals("bmp")) { rbBmp.setSelected(true); } rbBmp.setToggleGroup(tgTypeFichier); rbJpeg.setLayoutX(43); rbJpeg.setLayoutY(71); rbJpeg.setUserData("jpg"); if (EditeurPanovisu.getStrTypeFichierTransf().equals("jpg")) { rbJpeg.setSelected(true); } rbJpeg.setToggleGroup(tgTypeFichier); if (EditeurPanovisu.getStrTypeFichierTransf().equals("tif")) { rbTiff.setSelected(true); } rbTiff.setLayoutX(43); rbTiff.setLayoutY(99); rbTiff.setToggleGroup(tgTypeFichier); rbTiff.setUserData("tif"); tgTypeFichier.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> { EditeurPanovisu.setStrTypeFichierTransf(tgTypeFichier.getSelectedToggle().getUserData().toString()); }); cbSharpen.setLayoutX(43); cbSharpen.setLayoutY(127); cbSharpen.selectedProperty().addListener((ov, old_val, new_val) -> { slSharpen.setDisable(!new_val); lblSharpen.setDisable(!new_val); EditeurPanovisu.setbNetteteTransf(new_val); }); slSharpen.setShowTickMarks(true); slSharpen.setShowTickLabels(true); slSharpen.setMajorTickUnit(0.5f); slSharpen.setMinorTickCount(4); slSharpen.setBlockIncrement(0.05f); slSharpen.setSnapToTicks(true); slSharpen.setLayoutX(23); slSharpen.setLayoutY(157); slSharpen.setTooltip(new Tooltip("Choisissez le niveau d'accentuation de l'image")); slSharpen.valueProperty().addListener((observableValue, oldValue, newValue) -> { if (newValue == null) { lblSharpen.setText(""); return; } DecimalFormat dfArrondi = new DecimalFormat(); dfArrondi.setMaximumFractionDigits(2); //arrondi 2 chiffres apres la virgules dfArrondi.setMinimumFractionDigits(2); dfArrondi.setDecimalSeparatorAlwaysShown(true); lblSharpen.setText(dfArrondi.format(Math.round(newValue.floatValue() * 20.f) / 20.f) + ""); EditeurPanovisu.setNiveauNetteteTransf(newValue.doubleValue()); }); slSharpen.setPrefWidth(120); lblSharpen.setLayoutX(150); lblSharpen.setLayoutY(150); lblSharpen.setMinWidth(30); lblSharpen.setMaxWidth(30); lblSharpen.setTextAlignment(TextAlignment.RIGHT); paneChoixTypeFichier.getChildren().addAll(lblType, rbBmp, rbJpeg, rbTiff, cbSharpen, slSharpen, lblSharpen); pbBarreImage.setLayoutX(40); pbBarreImage.setLayoutY(190); pbBarreImage.setStyle("-fx-accent : #0000bb"); pbBarreImage.setVisible(false); paneChoixTypeFichier.getChildren().add(pbBarreImage); pbBarreAvancement = new ProgressBar(); pbBarreAvancement.setLayoutX(40); pbBarreAvancement.setLayoutY(220); pbBarreImage.setStyle("-fx-accent : #00bb00"); paneChoixTypeFichier.getChildren().add(pbBarreAvancement); pbBarreAvancement.setVisible(false); paneboutons.getChildren().addAll(btnAnnuler, btnValider); vbFenetre.getChildren().addAll(hbChoix, paneboutons); Scene scnTransformations = new Scene(apTransformations); stTransformations.setScene(scnTransformations); stTransformations.show(); btnAnnuler.setOnAction((e) -> { annulerE2C(); }); btnValider.setOnAction((e) -> { if (!bTraitementEffectue) { validerE2C(); } }); btnAjouteFichiers.setOnAction((e) -> { lblTermine.setText(""); fileLstFichier = choixFichiers(); if (fileLstFichier != null) { if (bTraitementEffectue) { lvListeFichier.getItems().clear(); bTraitementEffectue = false; } for (File fileLstFichier1 : fileLstFichier) { String strNomFich = fileLstFichier1.getAbsolutePath(); lvListeFichier.getItems().add(strNomFich); } } }); lvListeFichier.setCellFactory(new Callback<ListView<String>, ListCell<String>>() { @Override public ListCell<String> call(ListView<String> list) { return new ListeTransformationCouleur(); } }); apTransformations.setOnDragOver((event) -> { Dragboard dbFichiersTransformation = event.getDragboard(); if (dbFichiersTransformation.hasFiles()) { event.acceptTransferModes(TransferMode.ANY); } else { event.consume(); } }); stTransformations.widthProperty().addListener((arg0, arg1, arg2) -> { EditeurPanovisu.setLargeurE2C(stTransformations.getWidth()); apTransformations.setPrefWidth(stTransformations.getWidth()); vbFenetre.setPrefWidth(stTransformations.getWidth()); btnAnnuler.setLayoutX(stTransformations.getWidth() - 314); btnValider.setLayoutX(stTransformations.getWidth() - 157); paneChoixFichier.setPrefWidth(stTransformations.getWidth() - 200); lvListeFichier.setPrefWidth(stTransformations.getWidth() - 240); lblDragDropE2C.setMinWidth(lvListeFichier.getPrefWidth()); lblDragDropE2C.setMaxWidth(lvListeFichier.getPrefWidth()); btnAjouteFichiers.setLayoutX(stTransformations.getWidth() - 341); }); stTransformations.heightProperty().addListener((arg0, arg1, arg2) -> { EditeurPanovisu.setHauteurE2C(stTransformations.getHeight()); apTransformations.setPrefHeight(stTransformations.getHeight()); vbFenetre.setPrefHeight(stTransformations.getHeight()); paneChoixFichier.setPrefHeight(stTransformations.getHeight() - 80); hbChoix.setPrefHeight(stTransformations.getHeight() - 80); lvListeFichier.setPrefHeight(stTransformations.getHeight() - 140); lblDragDropE2C.setMinHeight(lvListeFichier.getPrefHeight()); lblDragDropE2C.setMaxHeight(lvListeFichier.getPrefHeight()); btnAjouteFichiers.setLayoutY(stTransformations.getHeight() - 121); }); stTransformations.setWidth(EditeurPanovisu.getLargeurE2C()); stTransformations.setHeight(EditeurPanovisu.getHauteurE2C()); apTransformations.setOnDragDropped((event) -> { Dragboard dbFichiersTransformation = event.getDragboard(); boolean bSucces = false; File[] fileLstFich; fileLstFich = null; if (dbFichiersTransformation.hasFiles()) { lblTermine.setText(""); bSucces = true; String[] stringFichiersPath = new String[200]; int i = 0; for (File file1 : dbFichiersTransformation.getFiles()) { stringFichiersPath[i] = file1.getAbsolutePath(); i++; } int iNb = i; i = 0; boolean bAttention = false; File[] fileLstFich1 = new File[stringFichiersPath.length]; for (int j = 0; j < iNb; j++) { String strNomfich = stringFichiersPath[j]; File fileTransf = new File(strNomfich); String strExtension = strNomfich.substring(strNomfich.lastIndexOf(".") + 1, strNomfich.length()) .toLowerCase(); if (strExtension.equals("bmp") || strExtension.equals("jpg") || strExtension.equals("tif")) { if (i == 0) { strRepertFichier = fileTransf.getParent(); } Image img = null; if (strExtension != "tif") { img = new Image("file:" + fileTransf.getAbsolutePath()); } else { try { img = ReadWriteImage.readTiff(strNomfich); } catch (ImageReadException ex) { Logger.getLogger(EquiCubeDialogController.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(EquiCubeDialogController.class.getName()).log(Level.SEVERE, null, ex); } } if (strTypeTransformation.equals(EquiCubeDialogController.EQUI2CUBE)) { if (img.getWidth() == 2 * img.getHeight()) { fileLstFich1[i] = fileTransf; i++; } else { bAttention = true; } } else { if (img.getWidth() == img.getHeight()) { String strNom = fileTransf.getAbsolutePath().substring(0, fileTransf.getAbsolutePath().length() - 6); boolean bTrouve = false; for (int ik = 0; ik < i; ik++) { String strNom1 = fileLstFich1[ik].getAbsolutePath().substring(0, fileTransf.getAbsolutePath().length() - 6); if (strNom.equals(strNom1)) { bTrouve = true; } } if (!bTrouve) { fileLstFich1[i] = fileTransf; i++; } } else { bAttention = true; } } } } if (bAttention) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle(rbLocalisation.getString("transformation.traiteImages")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("transformation.traiteImagesType")); alert.showAndWait(); } fileLstFichier = new File[i]; System.arraycopy(fileLstFich1, 0, fileLstFichier, 0, i); } if (fileLstFichier != null) { if (bTraitementEffectue) { lvListeFichier.getItems().clear(); bTraitementEffectue = false; } for (File lstFichier1 : fileLstFichier) { String nomFich = lstFichier1.getAbsolutePath(); lvListeFichier.getItems().add(nomFich); } } lblDragDropE2C.setVisible(false); event.setDropCompleted(bSucces); event.consume(); }); }
From source file:Main.java
private VBox getTransformationControls() { xSlider.setShowTickMarks(true);/* ww w . j a v a 2 s .com*/ xSlider.setShowTickLabels(true); xSlider.snapToTicksProperty().set(true); ySlider.setShowTickMarks(true); ySlider.setShowTickLabels(true); ySlider.snapToTicksProperty().set(true); widthSlider.setShowTickMarks(true); widthSlider.setShowTickLabels(true); widthSlider.snapToTicksProperty().set(true); heightSlider.setShowTickMarks(true); heightSlider.setShowTickLabels(true); heightSlider.snapToTicksProperty().set(true); opacitySlider.setShowTickMarks(true); opacitySlider.setShowTickLabels(true); opacitySlider.snapToTicksProperty().set(true); opacitySlider.setMinorTickCount(5); opacitySlider.setMajorTickUnit(0.20d); strokeSlider.setShowTickMarks(true); strokeSlider.setShowTickLabels(true); strokeSlider.snapToTicksProperty().set(true); strokeSlider.setMinorTickCount(5); strokeSlider.setMajorTickUnit(1.0d); translateXSlider.setShowTickMarks(true); translateXSlider.setShowTickLabels(true); translateXSlider.snapToTicksProperty().set(true); translateYSlider.setShowTickMarks(true); translateYSlider.setShowTickLabels(true); translateYSlider.snapToTicksProperty().set(true); rotateSlider.setShowTickMarks(true); rotateSlider.setShowTickLabels(true); rotateSlider.snapToTicksProperty().set(true); rotateSlider.setMinorTickCount(5); rotateSlider.setMajorTickUnit(30.0); scaleXSlider.setShowTickMarks(true); scaleXSlider.setShowTickLabels(true); scaleXSlider.setMajorTickUnit(0.2d); scaleXSlider.setLabelFormatter(new DoubleStringConverter()); scaleXSlider.snapToTicksProperty().set(true); scaleYSlider.setShowTickMarks(true); scaleYSlider.setShowTickLabels(true); scaleYSlider.setMajorTickUnit(0.2d); scaleYSlider.setLabelFormatter(new DoubleStringConverter()); scaleYSlider.snapToTicksProperty().set(true); shearXSlider.setShowTickMarks(true); shearXSlider.setShowTickLabels(true); shearXSlider.setMajorTickUnit(0.2d); shearXSlider.setLabelFormatter(new DoubleStringConverter()); shearXSlider.snapToTicksProperty().set(true); shearYSlider.setShowTickMarks(true); shearYSlider.setShowTickLabels(true); shearYSlider.setMajorTickUnit(0.2d); shearYSlider.setLabelFormatter(new DoubleStringConverter()); shearYSlider.snapToTicksProperty().set(true); HBox xyBox = new HBox(); xyBox.setSpacing(5); xyBox.getChildren().addAll(VBoxBuilder.create().children(xLabel, xSlider).build(), VBoxBuilder.create().children(yLabel, ySlider).build()); HBox whBox = new HBox(); whBox.setSpacing(5); whBox.getChildren().addAll(VBoxBuilder.create().children(widthLabel, widthSlider).build(), VBoxBuilder.create().children(heightLabel, heightSlider).build()); HBox colorBox = new HBox(); colorBox.setSpacing(5); colorBox.getChildren().addAll(VBoxBuilder.create().children(strokeLabel, strokeSlider).build(), VBoxBuilder.create().children(new Label("Stroke Color"), rectStrokeColorChoiceBox).build()); HBox opacityBox = new HBox(); opacityBox.setSpacing(5); opacityBox.getChildren().addAll(VBoxBuilder.create().children(opacityLabel, opacitySlider).build(), VBoxBuilder.create().children(new Label("Fill Color"), rectFillColorChoiceBox).build()); HBox translateBox = new HBox(); translateBox.setSpacing(5); translateBox.getChildren().addAll(VBoxBuilder.create().children(translateXLabel, translateXSlider).build(), VBoxBuilder.create().children(translateYLabel, translateYSlider).build()); HBox rotateBox = new HBox(); rotateBox.setSpacing(5); rotateBox.getChildren().addAll(VBoxBuilder.create().children(rotateLabel, rotateSlider).build()); HBox scaleBox = new HBox(); scaleBox.setSpacing(5); scaleBox.getChildren().addAll(VBoxBuilder.create().children(scaleXLabel, scaleXSlider).build(), VBoxBuilder.create().children(scaleYLabel, scaleYSlider).build()); HBox shearBox = new HBox(); shearBox.setSpacing(5); shearBox.getChildren().addAll(VBoxBuilder.create().children(shearXLabel, shearXSlider).build(), VBoxBuilder.create().children(shearYLabel, shearYSlider).build()); VBox rectangleBox = new VBox(); rectangleBox.getChildren().addAll(xyBox, whBox, colorBox, opacityBox); TitledPane rectangleProps = new TitledPane("Rectangle", rectangleBox); VBox transformBox = new VBox(); transformBox.getChildren().addAll(translateBox, rotateBox, scaleBox, shearBox); TitledPane transformsProps = new TitledPane("Tranformations", transformBox); TitledPane showBoundsControls = getShowBoundsControls(); TitledPane effectPane = getEffectTitledPane(); Button resetAllButton = new Button("Reset All"); resetAllButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { resetAll(); } }); Button saveButton = new Button("Save Layout as Image"); saveButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { saveLayoutAsImage(); } }); Button exitButton = new Button("Exit"); exitButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { Platform.exit(); } }); /* Button printButton = new Button("Print"); printButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { String str = getDesc("layoutBounds", mainRect.getLayoutBounds()) + getDesc("\nboundsInLocal", mainRect.getBoundsInLocal()) + getDesc("\nboundsInParent", mainRect.getBoundsInParent()); //printDataTextArea.setText(str); } private String getDesc(String type, Bounds b) { String str = type + "[minX=" + b.getMinX() + ", minY=" + b.getMinY() + ", width=" + b.getWidth() + ", height=" + b.getHeight() + "]"; return str; } }); */ HBox buttonBox = new HBox(); buttonBox.setSpacing(10); buttonBox.getChildren().addAll(resetAllButton, saveButton, exitButton); VBox vBox = new VBox(); vBox.getChildren().addAll(buttonBox, showBoundsControls, rectangleProps, effectPane, transformsProps); return vBox; }
From source file:FeeBooster.java
private GridPane broadcastTxGrid(Transaction tx) { // Setup Grid GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER);// ww w .j av a2 s. c om grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); // Instructions Text Text instructions = new Text("Enter your signed transaction into the space below."); grid.add(instructions, 0, 0); // Put signed transaction in text area TextArea signedTxTxt = new TextArea(); signedTxTxt.setWrapText(true); grid.add(signedTxTxt, 0, 1); // Display some info about Transaction after sent Text txInfo = new Text(); grid.add(txInfo, 0, 4); // Add Next Button Button nextBtn = new Button("Send Transaction"); nextBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Transaction signedTx = new Transaction(); Transaction.deserializeStr(signedTxTxt.getText(), signedTx); txInfo.setText("Transaction being broadcast. TXID: " + signedTx.getHash() + "\nPlease wait a few minutes for best results, but you may now exit."); Broadcaster.broadcastTransaction(Transaction.serialize(signedTx, false)); } }); HBox btnHbox = new HBox(10); // Back Button Button backBtn = new Button("Back"); backBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { sceneCursor--; stage.setScene(scenes.get(sceneCursor)); } }); btnHbox.getChildren().add(backBtn); btnHbox.getChildren().add(nextBtn); // Cancel Button Button cancelBtn = new Button("Exit"); cancelBtn.setOnAction(cancelEvent); btnHbox.getChildren().add(cancelBtn); grid.add(btnHbox, 0, 2); return grid; }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
private void addReportErrorButtons() { messageLabel.setText(truncatedMessage + "\n\nTo help us to improve the software please report the bug at our issue tracker at Github or send it by email to the developers.\n" + "The error message will be copied to clipboard when you click the below buttons.\n" + "It will make debugging easier if you can attach the bitsquare.log file which you can find in the application directory."); Button githubButton = new Button("Report to Github issue tracker"); GridPane.setMargin(githubButton, new Insets(20, 0, 0, 0)); GridPane.setHalignment(githubButton, HPos.RIGHT); GridPane.setRowIndex(githubButton, ++rowIndex); GridPane.setColumnIndex(githubButton, 1); gridPane.getChildren().add(githubButton); githubButton.setOnAction(event -> { Utilities.copyToClipboard(message); GUIUtil.openWebPage("https://github.com/bitsquare/bitsquare/issues"); });/*from w w w. ja v a2 s . c o m*/ Button mailButton = new Button("Report by email"); GridPane.setHalignment(mailButton, HPos.RIGHT); GridPane.setRowIndex(mailButton, ++rowIndex); GridPane.setColumnIndex(mailButton, 1); gridPane.getChildren().add(mailButton); mailButton.setOnAction(event -> { Utilities.copyToClipboard(message); GUIUtil.openMail("manfred@bitsquare.io", "Error report", "Error message:\n" + message); }); }
From source file:io.bitsquare.gui.main.overlays.Overlay.java
protected void addCloseButton() { closeButton = new Button(closeButtonText == null ? "Close" : closeButtonText); closeButton.setOnAction(event -> doClose()); if (actionHandlerOptional.isPresent() || actionButtonText != null) { actionButton = new Button(actionButtonText == null ? "Ok" : actionButtonText); actionButton.setDefaultButton(true); //TODO app wide focus //actionButton.requestFocus(); actionButton.setOnAction(event -> { hide();/*from w w w. ja v a 2s. com*/ actionHandlerOptional.ifPresent(Runnable::run); }); Pane spacer = new Pane(); HBox hBox = new HBox(); hBox.setSpacing(10); hBox.getChildren().addAll(spacer, closeButton, actionButton); HBox.setHgrow(spacer, Priority.ALWAYS); GridPane.setHalignment(hBox, HPos.RIGHT); GridPane.setRowIndex(hBox, ++rowIndex); GridPane.setColumnSpan(hBox, 2); GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0)); gridPane.getChildren().add(hBox); } else if (!hideCloseButton) { closeButton.setDefaultButton(true); GridPane.setHalignment(closeButton, HPos.RIGHT); if (!showReportErrorButtons) GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0)); GridPane.setRowIndex(closeButton, ++rowIndex); GridPane.setColumnIndex(closeButton, 1); gridPane.getChildren().add(closeButton); } }