javafx.beans.property.StringProperty Java Examples

The following examples show how to use javafx.beans.property.StringProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FXMLTimingController.java    From pikatimer with GNU General Public License v3.0 6 votes vote down vote up
public void removeTimingLocation(ActionEvent fxevent){
    final TimingLocation tl = timingLocListView.getSelectionModel().getSelectedItem();
    
    // If the location is referenced by a split, 
    // toss up a warning and leave it alone
    final StringProperty splitsUsing = new SimpleStringProperty();
    raceDAO.listRaces().forEach(r -> {
        r.getSplits().forEach(s -> {
            if (s.getTimingLocation().equals(tl)) splitsUsing.set(splitsUsing.getValueSafe() + r.getRaceName() + " " + s.getSplitName() + "\n");
        });
    });
    
    if (splitsUsing.isEmpty().get()) {
        timingDAO.removeTimingLocation(tl);;
        timingLocAddButton.requestFocus();
        //timingLocAddButton.setDefaultButton(true);
    } else {
        Alert alert = new Alert(AlertType.INFORMATION);
        alert.setTitle("Unable to Remove Timing Location");
        alert.setHeaderText("Unable to remove the " + tl.getLocationName() + " timing location.");
        alert.setContentText("The timing location is in use by the following splits:\n" + splitsUsing.getValueSafe());
        alert.showAndWait();
    }
}
 
Example #2
Source File: OrElseTest.java    From ReactFX with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testCorrectness() {
    StringProperty s1 = new SimpleStringProperty("a");
    StringProperty s2 = new SimpleStringProperty("b");
    StringProperty s3 = new SimpleStringProperty("c");

    Val<String> firstNonNull = Val.orElse(s1, s2).orElse(s3);
    assertEquals("a", firstNonNull.getValue());

    s2.set(null);
    assertEquals("a", firstNonNull.getValue());

    s1.set(null);
    assertEquals("c", firstNonNull.getValue());

    s2.set("b");
    assertEquals("b", firstNonNull.getValue());

    s2.set(null);
    s3.set(null);
    assertNull(firstNonNull.getValue());
}
 
Example #3
Source File: MainMenuController.java    From BetonQuest-Editor with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void newSet() {
	try {
		StringProperty name = new SimpleStringProperty();
		if (NameEditController.display(name, true)) {
			if (!PackageSet.isUnique(name.get())) {
				BetonQuestEditor.showError("already-exists");
				return;
			}
			PackageSet set = new PackageSet(null, SaveType.NONE, name.get());
			QuestPackage pack = new QuestPackage(set, name.get());
			set.getPackages().add(pack);
			BetonQuestEditor.getInstance().getSets().add(set);
			RootController.setPackageSets(BetonQuestEditor.getInstance().getSets());
			BetonQuestEditor.getInstance().display(set);
		}
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
Example #4
Source File: AuthHandler.java    From curly with Apache License 2.0 6 votes vote down vote up
public AuthHandler(StringProperty host, BooleanProperty ssl, StringProperty userName, StringProperty password) {
    model = new Login();

    model.hostProperty().bindBidirectional(host);
    model.sslProperty().bindBidirectional(ssl);
    model.userNameProperty().bindBidirectional(userName);
    model.passwordProperty().bindBidirectional(password);

    model.hostProperty().addListener(this::triggerLoginTest);
    model.sslProperty().addListener(this::triggerLoginTest);
    model.userNameProperty().addListener(this::triggerLoginTest);
    model.passwordProperty().addListener(this::triggerLoginTest);

    model.statusMessageProperty().set(ApplicationState.getMessage(INCOMPLETE_FIELDS));
    model.loginConfirmedProperty().set(false);

}
 
Example #5
Source File: BatchRunner.java    From curly with Apache License 2.0 6 votes vote down vote up
private void buildTasks(List<Action> actions, List<Map<String, String>> batchData, Map<String, StringProperty> defaultValues, Set<String> displayColumns) {
    int row = 0;
    for (Map<String,String> data : batchData) {
        row++;
        try {
            Map<String,String> values = new HashMap<>(data);
            defaultValues.forEach((key,value)-> {
                if (values.get(key) == null || values.get(key).isEmpty()) {
                    values.put(key,value.get());
                }
            });
            ActionGroupRunner runner = new ActionGroupRunner("Row "+row,this::getConnection, actions, values, displayColumns);
            result.addDetail(runner.results);
            executor.execute(runner);
        } catch (ParseException ex) {
            Logger.getLogger(BatchRunner.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
 
Example #6
Source File: ConversationController.java    From BetonQuest-Editor with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void addPlayerOption() {
	try {
		StringProperty name = new SimpleStringProperty();
		NameEditController.display(name, true);
		if (name.get() == null || name.get().isEmpty()) {
			return;
		}
		if (name.get().contains(".")) {
			BetonQuestEditor.showError("no-cross-conversation");
			return;
		}
		if (currentConversation.getPlayerOption(name.get()) == null) {
			PlayerOption option = currentConversation.newPlayerOption(name.get());
			option.setIndex(currentConversation.getPlayerOptions().size() - 1);
			BetonQuestEditor.getInstance().refresh();
			displayOption(option);
			playerList.requestFocus();
		} else {
			BetonQuestEditor.showError("option-exists");
		}
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
Example #7
Source File: StartPresenter.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@FXML
    void runModel() {
        try {
            Service service = new Service();
            StringProperty answer = service.predictRemote(model, imageView.getImageFile());
            showResult(answer);
//            MATCH_VIEW.switchView();
//            Optional<Object> presenter = MATCH_VIEW.getPresenter();
//            MatchPresenter p = (MatchPresenter) presenter.get();
//            answer.addListener(new InvalidationListener() {
//                @Override
//                public void invalidated(Observable o) {
//                    String astring = answer.get();
//                    System.out.println("got answer: "+astring);
//                    if (astring != null) {
//                        p.setResult(Integer.valueOf(astring));
//                    }
//                }
//            });
//            if (answer.get() != null) {
//                p.setResult(Integer.valueOf(answer.get()));
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
Example #8
Source File: SectionBuilder.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public final Section build() {
    final Section SECTION = new Section();
    for (String key : properties.keySet()) {
        if ("start".equals(key)) {
            SECTION.setStart(((DoubleProperty) properties.get(key)).get());
        } else if("stop".equals(key)) {
            SECTION.setStop(((DoubleProperty) properties.get(key)).get());
        } else if("text".equals(key)) {
            SECTION.setText(((StringProperty) properties.get(key)).get());
        } else if("icon".equals(key)) {
            SECTION.setIcon(((ObjectProperty<Image>) properties.get(key)).get());
        } else if ("color".equals(key)) {
            SECTION.setColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("highlightColor".equals(key)) {
            SECTION.setHighlightColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("textColor".equals(key)) {
            SECTION.setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("onSectionEntered".equals(key)) {
            SECTION.setOnSectionEntered(((ObjectProperty<EventHandler>) properties.get(key)).get());
        } else if ("onSectionLeft".equals(key)) {
            SECTION.setOnSectionLeft(((ObjectProperty<EventHandler>) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            SECTION.setStyleClass(((StringProperty) properties.get(key)).get());
        }
    }
    return SECTION;
}
 
Example #9
Source File: SetMapperController.java    From Spring-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example #10
Source File: TextFieldValidator.java    From PeerWasp with MIT License 5 votes vote down vote up
public TextFieldValidator(TextField txtField, StringProperty errorProperty, boolean onFly) {
	this.validateTxtField = txtField;
	this.errorProperty = errorProperty;
	if(onFly) {
		initChangeListener();
	}
}
 
Example #11
Source File: MenuItemBuilder.java    From Enzo with Apache License 2.0 5 votes vote down vote up
@Override public final MenuItem build() {
    final MenuItem CONTROL = new MenuItem();

    properties.forEach((key, property) -> {
        if ("tooltip".equals(key)) {
            CONTROL.setTooltip(((StringProperty) property).get());
        } else if("size".equals(key)) {
            CONTROL.setSize(((DoubleProperty) property).get());
        } else if ("backgroundColor".equals(key)) {
            CONTROL.setBackgroundColor(((ObjectProperty<Color>) property).get());
        } else if ("borderColor".equals(key)) {
            CONTROL.setBorderColor(((ObjectProperty<Color>) property).get());
        } else if ("foregroundColor".equals(key)) {
            CONTROL.setForegroundColor(((ObjectProperty<Color>) property).get());
        } else if ("selectedBackgroundColor".equals(key)) {
            CONTROL.setSelectedBackgroundColor(((ObjectProperty<Color>) property).get());
        } else if ("selectedForegroundColor".equals(key)) {
            CONTROL.setSelectedForegroundColor(((ObjectProperty<Color>) property).get());
        } else if ("symbol".equals(key)) {
            CONTROL.setSymbolType(((ObjectProperty<SymbolType>) property).get());
        } else if ("thumbnailImageName".equals(key)) {
            CONTROL.setThumbnailImageName(((StringProperty) property).get());
        } else if ("text".equals(key)) {
            CONTROL.setText(((StringProperty) property).get());
        } else if ("selectable".equals(key)) {
            CONTROL.setSelectable(((BooleanProperty) property).get());
        } else if ("selected".equals(key)) {
            CONTROL.setSelected(((BooleanProperty) property).get());
        }
    });

    return CONTROL;
}
 
Example #12
Source File: Setting.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a custom color picker control.
 *
 * @param description   the title of this setting
 * @param colorProperty the current selected color value
 * @return the constructed setting
 */
public static Setting of(String description, ObjectProperty<Color> colorProperty) {
  StringProperty stringProperty = new SimpleStringProperty();
  stringProperty.bindBidirectional(
      colorProperty, new StringConverter<Color>() {
        @Override
        public String toString(Color color) {
          return color.toString();
        }

        @Override
        public Color fromString(String value) {
          return Color.valueOf(value);
        }
      }
  );

  return new Setting<>(
      description,
      Field.ofStringType(stringProperty)
          .label(description)
          .render(new SimpleColorPickerControl(
              Objects.isNull(colorProperty.get()) ? Color.BLACK : colorProperty.get())
          ),
      stringProperty
  );
}
 
Example #13
Source File: SetServiceImplController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example #14
Source File: SessionManager.java    From mokka7 with Eclipse Public License 1.0 5 votes vote down vote up
public void bind(final StringProperty property, final String propertyName) {
    String value = props.getProperty(propertyName);
    if (value != null) {
        property.set(value);
    }

    property.addListener(new InvalidationListener() {
        @Override
        public void invalidated(Observable o) {
            props.setProperty(propertyName, property.getValue());
        }
    });
}
 
Example #15
Source File: ProtocolSelectionDataBinding.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public StringProperty getFrameLengthTypeProperty() {
    return frameLengthTypeProperty;
}
 
Example #16
Source File: UserDetail.java    From DashboardFx with GNU General Public License v3.0 4 votes vote down vote up
public StringProperty headerProperty() {
    return header;
}
 
Example #17
Source File: Question.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public StringProperty linkProperty() {
    return link;
}
 
Example #18
Source File: AdvancedPropertiesDataBinding.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public StringProperty getCacheSizeTypeProperty() {
    return cacheSizeTypeProperty;
}
 
Example #19
Source File: StatEntry.java    From metastone with GNU General Public License v2.0 4 votes vote down vote up
public StringProperty player2ValueProperty() {
	return player2Value;
}
 
Example #20
Source File: ConnectionParameterModel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
public StringProperty validationErrorProperty() {
	return validationError;
}
 
Example #21
Source File: XYZSeriesBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final XYZSeries build() {
    final XYZSeries SERIES = new XYZSeries();

    if (properties.keySet().contains("itemsArray")) {
        SERIES.setItems(((ObjectProperty<XYZItem[]>) properties.get("itemsArray")).get());
    }
    if(properties.keySet().contains("itemsList")) {
        SERIES.setItems(((ObjectProperty<List<XYZItem>>) properties.get("itemsList")).get());
    }

    for (String key : properties.keySet()) {
        if ("name".equals(key)) {
            SERIES.setName(((StringProperty) properties.get(key)).get());
        } else if ("fill".equals(key)) {
            SERIES.setFill(((ObjectProperty<Paint>) properties.get(key)).get());
        } else if ("stroke".equals(key)) {
            SERIES.setStroke(((ObjectProperty<Paint>) properties.get(key)).get());
        } else if ("textFill".equals(key)) {
            SERIES.setTextFill(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("symbolFill".equals(key)) {
            SERIES.setSymbolFill(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("symbolStroke".equals(key)) {
            SERIES.setSymbolStroke(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("symbol".equals(key)) {
            SERIES.setSymbol(((ObjectProperty<Symbol>) properties.get(key)).get());
        } else if ("chartType".equals(key)) {
            SERIES.setChartType(((ObjectProperty<ChartType>) properties.get(key)).get());
        } else if ("symbolsVisible".equals(key)) {
            SERIES.setSymbolsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("symbolsVisible".equals(key)) {
            SERIES.setSymbolsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("symbolSize".equals(key)) {
            SERIES.setSymbolSize(((DoubleProperty) properties.get(key)).get());
        } else if ("strokeWidth".equals(key)) {
            SERIES.setStrokeWidth(((DoubleProperty) properties.get(key)).get());
        } else if("animated".equals(key)) {
            SERIES.setAnimated(((BooleanProperty) properties.get(key)).get());
        } else if("animationDuration".equals(key)) {
            SERIES.setAnimationDuration(((LongProperty) properties.get(key)).get());
        }
    }
    return SERIES;
}
 
Example #22
Source File: MemoryUtilizationModel.java    From trex-stateless-gui with Apache License 2.0 4 votes vote down vote up
public StringProperty bank4096bProperty() {
    return bank4096b;
}
 
Example #23
Source File: Translator.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public StringProperty weightLabelProperty() {
  return weightLabel;
}
 
Example #24
Source File: GeneralRunningCodeManager.java    From MSPaintIDE with MIT License 4 votes vote down vote up
@Override
public void bindStartButton(StringProperty startStopText) {
    this.boundText.bindBidirectional(startStopText);
}
 
Example #25
Source File: SimpleButton.java    From cute-proxy with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public StringProperty iconPathProperty() {
    return iconPath;
}
 
Example #26
Source File: SearchBox.java    From phoenicis with GNU Lesser General Public License v3.0 4 votes vote down vote up
public StringProperty searchTermProperty() {
    return searchTerm;
}
 
Example #27
Source File: Participant.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public StringProperty zipProperty(){
    return zipProperty;
}
 
Example #28
Source File: CardComponent.java    From FXGLGames with MIT License 4 votes vote down vote up
public StringProperty descriptionProperty() {
    return description;
}
 
Example #29
Source File: CorneredEdge.java    From fxgraph with Do What The F*ck You Want To Public License 4 votes vote down vote up
public StringProperty textProperty() {
	return textProperty;
}
 
Example #30
Source File: Segment.java    From pikatimer with GNU General Public License v3.0 4 votes vote down vote up
public StringProperty distanceStringProperty(){
    updateDistanceStringProperty();
    return distanceStringProperty;
}