List of usage examples for javafx.scene.control TextArea setStyle
public final void setStyle(String value)
From source file:de.pixida.logtest.designer.automaton.AutomatonNode.java
public void createEnterAndLeaveScriptConfig(final ConfigFrame cf) { final int scriptInputLines = 3; final TextArea onEnterScriptInput = new TextArea(this.onEnter); onEnterScriptInput.setStyle("-fx-font-family: monospace"); onEnterScriptInput.setPrefRowCount(scriptInputLines); onEnterScriptInput.setWrapText(false); onEnterScriptInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setOnEnter(newValue); this.getGraph().handleChange(); });/*from w w w . ja v a 2s. c o m*/ cf.addOption("When entering state, run script", onEnterScriptInput); final TextArea onLeaveScriptInput = new TextArea(this.onLeave); onLeaveScriptInput.setStyle("-fx-font-family: monospace"); onLeaveScriptInput.setPrefRowCount(scriptInputLines); onLeaveScriptInput.setWrapText(false); onLeaveScriptInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setOnLeave(newValue); this.getGraph().handleChange(); }); cf.addOption("When leaving state, run script", onLeaveScriptInput); }
From source file:de.pixida.logtest.designer.automaton.AutomatonNode.java
@Override public Node getConfigFrame() { // TODO: Remove code redundancies; element creating methods have been created in class AutomatonEdge and should be centralized! final ConfigFrame cf = new ConfigFrame("State properties"); final int nameInputLines = 1; final TextArea nameInput = new TextArea(this.name); nameInput.setPrefRowCount(nameInputLines); nameInput.setWrapText(true);// w ww.j a v a 2s . c o m nameInput.textProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setName(newValue); this.getGraph().handleChange(); }); cf.addOption("Name", nameInput); final int descriptionInputLines = 3; this.createTextAreaInput(descriptionInputLines, cf, "Description", this.getDescription(), newValue -> this.setDescription(newValue)); final VBox typeAttributes = new VBox(); final ToggleGroup flagToggleGroup = new ToggleGroup(); typeAttributes.getChildren() .add(this.createRadioButtonForType(null, "None (intermediate node)", flagToggleGroup)); typeAttributes.getChildren().add(this.createRadioButtonForType(Type.INITIAL, "Initial", flagToggleGroup)); final RadioButton successOption = this.createRadioButtonForType(Type.SUCCESS, "Success", flagToggleGroup); typeAttributes.getChildren().add(successOption); typeAttributes.getChildren().add(this.createRadioButtonForType(Type.FAILURE, "Failure", flagToggleGroup)); cf.addOption("Type", typeAttributes); final CheckBox waitCheckBox = new CheckBox("Active"); waitCheckBox.setSelected(this.wait); waitCheckBox.setOnAction(event -> { this.setWait(waitCheckBox.isSelected()); this.getGraph().handleChange(); }); cf.addOption("Wait", waitCheckBox); final int expressionInputLines = 1; final TextArea successCheckExpInput = new TextArea(this.successCheckExp); successCheckExpInput.setStyle("-fx-font-family: monospace"); successCheckExpInput.setPrefRowCount(expressionInputLines); successCheckExpInput.setWrapText(false); successCheckExpInput.textProperty() .addListener((ChangeListener<String>) (observable, oldValue, newValue) -> { this.setSuccessCheckExp(newValue); this.getGraph().handleChange(); }); successCheckExpInput.disableProperty().bind(successOption.selectedProperty().not()); cf.addOption("Script expression to verify if node is successful", successCheckExpInput); this.createEnterAndLeaveScriptConfig(cf); return cf; }
From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java
private List<Triple<String, Node, String>> createConfigurationForm() { final List<Triple<String, Node, String>> formItems = new ArrayList<>(); // Automaton file final TextField automatonFilePath = new TextField(); this.automatonFilePathProperty.bind(automatonFilePath.textProperty()); HBox.setHgrow(automatonFilePath, Priority.ALWAYS); final Button selectAutomatonFilePathButton = SelectFileButton.createButtonWithFileSelection( automatonFilePath, Editor.Type.AUTOMATON.getIconName(), "Select " + Editor.Type.AUTOMATON.getName(), Editor.Type.AUTOMATON.getFileMask(), Editor.Type.AUTOMATON.getFileDescription()); final HBox automatonFilePathConfig = new HBox(automatonFilePath, selectAutomatonFilePathButton); formItems.add(Triple.of("Automaton", automatonFilePathConfig, null)); // Automaton parameters final TextArea parametersInputText = new TextArea(); parametersInputText.setStyle("-fx-font-family: monospace"); HBox.setHgrow(parametersInputText, Priority.ALWAYS); final int parametersInputLinesSize = 4; parametersInputText.setPrefRowCount(parametersInputLinesSize); this.parametersProperty.bind(parametersInputText.textProperty()); formItems.add(Triple.of("Parameters", parametersInputText, "Set parameters for the execution. Each line can contain a parameter as follows: ${PARAMETER}=value, e.g. ${TIMEOUT}=10.")); // Log file/* w w w .j ava2 s. c om*/ this.createLogFileSourceInputItems(formItems); // Log reader configuration file final TextField logReaderConfigurationFilePath = new TextField(); this.logReaderConfigurationFilePathProperty.bind(logReaderConfigurationFilePath.textProperty()); HBox.setHgrow(logReaderConfigurationFilePath, Priority.ALWAYS); final Button selectLogReaderConfigurationFilePathButton = SelectFileButton.createButtonWithFileSelection( logReaderConfigurationFilePath, Editor.Type.LOG_READER_CONFIG.getIconName(), "Select " + Editor.Type.LOG_READER_CONFIG.getName(), Editor.Type.LOG_READER_CONFIG.getFileMask(), Editor.Type.LOG_READER_CONFIG.getFileDescription()); final HBox logReaderConfigurationFilePathConfig = new HBox(logReaderConfigurationFilePath, selectLogReaderConfigurationFilePathButton); formItems.add(Triple.of("Log Reader Configuration", logReaderConfigurationFilePathConfig, null)); // Debug output final CheckBox cb = new CheckBox(); this.showDebugOutputProperty.bind(cb.selectedProperty()); formItems.add(Triple.of("Show Debug Output", cb, "Show verbose debug output. Might generate lots of text and slows down the" + " evaluation, but is very helpful for debugging automatons while developing them.")); return formItems; }
From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java
public VBox createRunForm() { // CHECKSTYLE:OFF Yes, we are using lots of constants here. It does not make sense to name them using final variables. final VBox lines = new VBox(); lines.setSpacing(10d);/*from w w w . ja v a2s. com*/ final HBox inputTypeLine = new HBox(); inputTypeLine.setSpacing(30d); final ToggleGroup group = new ToggleGroup(); final RadioButton inputTypeText = new RadioButton("Paste/Enter text"); inputTypeText.setToggleGroup(group); final RadioButton inputTypeFile = new RadioButton("Read log file"); inputTypeFile.setToggleGroup(group); inputTypeLine.getChildren().add(inputTypeText); inputTypeLine.getChildren().add(inputTypeFile); inputTypeText.setSelected(true); final TextField pathInput = new TextField(); HBox.setHgrow(pathInput, Priority.ALWAYS); final Button selectLogFileButton = SelectFileButton.createButtonWithFileSelection(pathInput, LOG_FILE_ICON_NAME, "Select log file", null, null); final Text pathInputLabel = new Text("Log file path: "); final HBox fileInputConfig = new HBox(); fileInputConfig.setAlignment(Pos.CENTER_LEFT); fileInputConfig.visibleProperty().bind(inputTypeFile.selectedProperty()); fileInputConfig.managedProperty().bind(fileInputConfig.visibleProperty()); fileInputConfig.getChildren().addAll(pathInputLabel, pathInput, selectLogFileButton); final TextArea logInputText = new TextArea(); HBox.setHgrow(logInputText, Priority.ALWAYS); logInputText.setPrefRowCount(10); logInputText.setStyle("-fx-font-family: monospace"); final HBox enterTextConfig = new HBox(); enterTextConfig.getChildren().add(logInputText); enterTextConfig.visibleProperty().bind(inputTypeText.selectedProperty()); enterTextConfig.managedProperty().bind(enterTextConfig.visibleProperty()); final Button startBtn = new Button("Read Log"); startBtn.setPadding(new Insets(8d)); // CHECKSTYLE:ON startBtn.setGraphic(Icons.getIconGraphics("control_play_blue")); HBox.setHgrow(startBtn, Priority.ALWAYS); startBtn.setMaxWidth(Double.MAX_VALUE); startBtn.setOnAction(event -> this.runLogFileReader(inputTypeFile, pathInput, logInputText)); final HBox startLine = new HBox(); startLine.getChildren().add(startBtn); lines.getChildren().addAll(inputTypeLine, fileInputConfig, enterTextConfig, startLine, new Text("Results:"), this.parsedLogEntries); return lines; }
From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java
public void createLogFileSourceInputItems(final List<Triple<String, Node, String>> formItems) { final TextField logFilePath = new TextField(); this.logFilePathProperty.bind(logFilePath.textProperty()); HBox.setHgrow(logFilePath, Priority.ALWAYS); final Button selectLogFileButton = SelectFileButton.createButtonWithFileSelection(logFilePath, LogReaderEditor.LOG_FILE_ICON_NAME, "Select log file", null, null); final HBox fileInputConfig = new HBox(logFilePath, selectLogFileButton); final VBox lines = new VBox(); final double spacingOfLines = 5d; lines.setSpacing(spacingOfLines);/*from www.ja v a 2 s. co m*/ final HBox inputTypeLine = new HBox(); final double hSpacingOfInputTypeChoices = 30d; inputTypeLine.setSpacing(hSpacingOfInputTypeChoices); final ToggleGroup group = new ToggleGroup(); final RadioButton inputTypeText = new RadioButton("Paste/Enter log"); inputTypeText.setToggleGroup(group); this.loadLogFromEnteredTextProperty.bind(inputTypeText.selectedProperty()); final RadioButton inputTypeFile = new RadioButton("Read log file"); inputTypeFile.setToggleGroup(group); this.loadLogFromFileProperty.bind(inputTypeFile.selectedProperty()); inputTypeFile.setSelected(true); inputTypeLine.getChildren().add(inputTypeText); inputTypeLine.getChildren().add(inputTypeFile); fileInputConfig.visibleProperty().bind(inputTypeFile.selectedProperty()); fileInputConfig.managedProperty().bind(fileInputConfig.visibleProperty()); final TextArea logInputText = new TextArea(); HBox.setHgrow(logInputText, Priority.ALWAYS); final int numLinesForEnteringLogInputManually = 10; logInputText.setPrefRowCount(numLinesForEnteringLogInputManually); logInputText.setStyle("-fx-font-family: monospace"); this.enteredLogTextProperty.bind(logInputText.textProperty()); final HBox enterTextConfig = new HBox(); enterTextConfig.getChildren().add(logInputText); enterTextConfig.visibleProperty().bind(inputTypeText.selectedProperty()); enterTextConfig.managedProperty().bind(enterTextConfig.visibleProperty()); lines.getChildren().addAll(inputTypeLine, fileInputConfig, enterTextConfig); formItems.add(Triple.of("Trace Log", lines, null)); }
From source file:sudoku.controller.ViewController.java
public void attachTextEventHandlers(ArrayList<TextArea> textAreas) { for (TextArea textArea : textAreas) { textArea.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { String parentID = textArea.getParent().getId(); //get the row and column of the cell int row = parentID.charAt(0) - 48; int column = parentID.charAt(1) - 48; System.out.println("Parent: " + textArea.getParent().getId()); //if it's an empty cell if (newValue.equals("")) GameController.userBoard[row][column] = 0; // if the length is greater than 1, it's an invalid input if (newValue.length() > 1) textArea.setText(oldValue); //make sure that the user is actually providing a +ve number greater than 0 as an input if (newValue.length() > 0) { int value = newValue.charAt(0) - 48; if (!Character.isDigit(newValue.charAt(0)) || newValue.charAt(0) == 48) { textArea.setText(""); GameController.userBoard[row][column] = 0; } else { //for an illegal move, set the cell's text to a red color if (!solver.isLegal(GameController.userBoard, row, column, value)) { textArea.setStyle("-fx-text-fill: red;"); } else { textArea.setStyle("-fx-text-fill: black;"); }/*from w w w . ja va 2 s . c om*/ GameController.userBoard[row][column] = value; } } }); } }