Java Code Examples for javafx.beans.property.StringProperty

The following examples show how to use javafx.beans.property.StringProperty. These examples are extracted from open source projects. 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
@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 2
Source Project: curly   Source File: AuthHandler.java    License: 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 3
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 4
@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 5
Source Project: curly   Source File: BatchRunner.java    License: 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
@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 7
Source Project: ReactFX   Source File: OrElseTest.java    License: 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 8
Source Project: Vert.X-generator   Source File: SetServiceImplController.java    License: 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 9
Source Project: Enzo   Source File: MenuItemBuilder.java    License: 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 10
Source Project: PeerWasp   Source File: TextFieldValidator.java    License: 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 Project: mokka7   Source File: SessionManager.java    License: 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 12
Source Project: Medusa   Source File: SectionBuilder.java    License: 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 13
Source Project: Spring-generator   Source File: SetMapperController.java    License: 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 Project: PreferencesFX   Source File: Setting.java    License: 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 15
Source Project: erlyberly   Source File: DataRow.java    License: GNU General Public License v3.0 4 votes vote down vote up
public StringProperty bCProperty() {
    return data[0xC];
}
 
Example 16
Source Project: phoebus   Source File: RulesDialog.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public StringProperty nameProperty()
{
    return name;
}
 
Example 17
Source Project: pikatimer   Source File: Segment.java    License: GNU General Public License v3.0 4 votes vote down vote up
public StringProperty startSplitStringProperty() {
    if ( ! startSplitStringProperty.isBound() && endSplitID != null && getStartSplit() != null) startSplitStringProperty.bind(getStartSplit().splitNameProperty());
    return startSplitStringProperty; 
}
 
Example 18
Source Project: pikatimer   Source File: Wave.java    License: GNU General Public License v3.0 4 votes vote down vote up
public StringProperty waveStartStringProperty(){
    return waveStartString;
}
 
Example 19
Source Project: FXyzLib   Source File: Text3DMesh.java    License: GNU General Public License v3.0 4 votes vote down vote up
public StringProperty fontProperty() {
    return font;
}
 
Example 20
Source Project: TweetwallFX   Source File: StringPropertyAppender.java    License: MIT License 4 votes vote down vote up
public StringProperty stringProperty() {
    return s;
}
 
Example 21
Source Project: mars-sim   Source File: AnimatedTableRow.java    License: GNU General Public License v3.0 4 votes vote down vote up
public StringProperty emailProperty() {
    return email ;
}
 
Example 22
Source Project: phoebus   Source File: TableEntry.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @return the property providing the alarm status of the PV value
 */
public StringProperty statusProperty() {
    return status;
}
 
Example 23
Source Project: mzmine3   Source File: AbstractTask.java    License: GNU General Public License v2.0 4 votes vote down vote up
public StringProperty nameProperty() {
  return name;
}
 
Example 24
Source Project: bisq   Source File: MainViewModel.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
StringProperty getMarketPrice(String currencyCode) {
    return marketPricePresentation.getMarketPrice(currencyCode);
}
 
Example 25
Source Project: chart-fx   Source File: LabelledMarkerRenderer.java    License: Apache License 2.0 4 votes vote down vote up
public StringProperty styleProperty() {
    return style;
}
 
Example 26
Source Project: marathonv5   Source File: ChoiceBoxTableViewSample.java    License: Apache License 2.0 4 votes vote down vote up
public StringProperty lastNameProperty() {
    return lastName;
}
 
Example 27
Source Project: mars-sim   Source File: TransportWizard.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
    * Asks user to confirm the location of the new building.
    * @param buildingManager
    * @param template the position of the proposed building
    * @param isAtPreDefinedLocation
    * @param isNewTemplate
    */
public synchronized void createDialog(BuildingManager mgr, BuildingTemplate template,
		boolean isAtPreDefinedLocation, boolean isNewTemplate) {
	//System.out.println("inside confirmBuildingLocation");
	//Building newBuilding = mgr.addOneBuilding(template, mgr.getResupply(), true);
	Building newBuilding = mgr.prepareToAddBuilding(template, resupply, true);

	// Clear any vehicles that block the location
	clearCollision(template, mgr, 10);
			
	//if (isAtPreDefinedLocation || isNewTemplate) {
	//	newBuilding = mgr.prepareToAddBuilding(template, resupply, false);
	//}

       // Determine location and facing for the new building.
	double xLoc = template.getXLoc();//newBuilding.getXLocation();
	double yLoc = template.getYLoc();//newBuilding.getYLocation();
	double scale = mapPanel.getScale();

	Settlement currentS = settlementWindow.getMapPanel().getSettlement();
	if (currentS != mgr.getSettlement()) {
		if (mainScene != null) {
			mainScene.setSettlement(mgr.getSettlement());
		}
		else
			settlementWindow.getMapPanel().getSettlementTransparentPanel().getSettlementListBox().setSelectedItem(mgr.getSettlement());
	}
 		// set up the Settlement Map Tool to display the suggested location of the building
	mapPanel.reCenter();
	mapPanel.moveCenter(xLoc*scale, yLoc*scale);
    //mapPanel.repaint();
	//mapPanel.setShowBuildingLabels(true);
	//mapPanel.getSettlementTransparentPanel().getBuildingLabelMenuItem().setSelected(true);

	String header = null;
	String title = null;
	String message = "(1) Will default to \"Yes\" in 30 secs unless timer is cancelled."
			 + System.lineSeparator() + "(2) To MANUALLY select a location, press 'Keyboard/Mouse' Button.";
	StringProperty msg = new SimpleStringProperty(message);

	if (isAtPreDefinedLocation) {
		header = "Would you like to place " + buildingNickName + " at its default position? ";
	}
	else {
		header = "Would you like to place " + buildingNickName + " at this position? ";
	}


	String missionName = template.getMissionName();

       if (missionName != null)
	//if (missionName.equals("null"))
		title = template.getMissionName() + " at " + mgr.getSettlement();
       else
       	title = "A Resupply Transport" + " at " + mgr.getSettlement();

       if (mainScene != null) {
   		//System.out.println("inside confirmBuildingLocation, calling alertDialog");
       	alertDialog(title, header, msg, template, mgr, newBuilding, true);//, timer);
       	mapPanel.repaint();
	} else {
		// for Swing mode
        desktop.openAnnouncementWindow("Pause for Transport Wizard");
        AnnouncementWindow aw = desktop.getAnnouncementWindow();
        Point location = MouseInfo.getPointerInfo().getLocation();
        double Xloc = location.getX() - aw.getWidth() * 2;
		double Yloc = location.getY() - aw.getHeight() * 2;
		aw.setLocation((int)Xloc, (int)Yloc);

		int reply = JOptionPane.showConfirmDialog(aw, header, TITLE, JOptionPane.YES_NO_OPTION);
		//repaint();

		if (reply == JOptionPane.YES_OPTION) {
            logger.info(newBuilding.toString() + " is put in Place.");
		}
		else {
			mgr.removeBuilding(newBuilding);
			// recursive calling of createDialog()
			createDialog(mgr, template, false, true);
		}

		desktop.disposeAnnouncementWindow();
       }
}
 
Example 28
Source Project: chart-fx   Source File: DataView.java    License: Apache License 2.0 4 votes vote down vote up
public final StringProperty nameProperty() {
    return name;
}
 
Example 29
public StringProperty valueProperty() {
    return value;
}
 
Example 30
Source Project: Enzo   Source File: TButton.java    License: Apache License 2.0 4 votes vote down vote up
public final StringProperty textProperty() {
    return text;
}