@Override protected Object createCollection(Class type) { if (type == ObservableListWrapper.class) { return FXCollections.observableArrayList(); } if (type.getName().indexOf("$") > 0) { if (type.getName().equals("javafx.collections.FXCollections$SynchronizedObservableList")) { return FXCollections.synchronizedObservableList(FXCollections.observableArrayList()); } } return new SimpleListProperty<>(FXCollections.observableArrayList()); }
public ParticipantPacket(ByteBuffer data) { super(data); this.carName = new SimpleStringProperty(ReadString(data, 64).trim()); this.carClass = new SimpleStringProperty(ReadString(data, 64).trim()); this.trackLocation = new SimpleStringProperty(ReadString(data, 64).trim()); this.trackVariation = new SimpleStringProperty(ReadString(data, 64).trim()); this.names = new SimpleListProperty<>(FXCollections.observableArrayList()); for (int i = 0; i < 16 ; i++) { this.names.add(new SimpleStringProperty(ReadString(data, 64).split("\u0000", 2)[0])); } this.fastestLapTimes = new SimpleListProperty<>(FXCollections.observableList(new ArrayList<>())); for (int i = 0; i < 16; i++) { this.fastestLapTimes.add(new SimpleFloatProperty(ReadFloat(data))); } }
@Override @SuppressWarnings("unchecked") public void initialize(URL location, ResourceBundle resources) { // Initializes test base, tester and test map to access and modify the algorithm base testBase = TestBase.INSTANCE; // Gets a reference to the test base tester = new Tester(); // testMap = tester.getTestMap(); // Binds the list view with a list of algorithms (list items) listItems = FXCollections.observableList(new ArrayList<>(testMap.keySet())); list.itemsProperty().bindBidirectional(new SimpleListProperty<>(listItems)); list.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); list.getSelectionModel().selectedItemProperty().addListener((((observable, oldValue, newValue) -> { if(newValue != null) { textArea.setText(testMap.get(newValue).getContent()); } else { textArea.clear(); } }))); list.getSelectionModel().select(0); // Initializes the trie that stores all algorithm names algorithmNameTrie = new Trie(); for(String algorithmName : testMap.keySet()) { algorithmNameTrie.addWord(algorithmName); } // Binds search field with the list view (displays search result) searchField.textProperty().addListener((observable, oldValue, newValue) -> { listItems.setAll(algorithmNameTrie.getWords(newValue.toLowerCase())); if(!listItems.isEmpty()) { list.getSelectionModel().select(0); } }); // For unknown reasons, this style does not work on css, so I put it in here textArea.setStyle("-fx-focus-color: transparent; -fx-text-box-border: transparent;"); textArea.setFocusTraversable(false); }
public static <F, T> ListProperty<T> nestListProp(ObservableValue<F> pf, Function<F, ListProperty<T>> func) { ListProperty<T> current = func.apply(pf.getValue()); ListProperty<T> nestProp = new SimpleListProperty<>(); CacheUtil.set(BeanUtil.class, nestProp, current); nestProp.bindBidirectional(current); pf.addListener((ob, o, n) -> { CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContentBidirectional(p)); ListProperty<T> pt = func.apply(n); CacheUtil.set(BeanUtil.class, nestProp, pt); nestProp.bindContentBidirectional(pt); }); return nestProp; }
public static <F, T> ObservableList<T> nestListValue(ObservableValue<F> pf, Function<F, ObservableList<T>> func) { ObservableList<T> current = func.apply(pf.getValue()); ListProperty<T> nestProp = new SimpleListProperty<>(); CacheUtil.set(BeanUtil.class, nestProp, current); nestProp.bindContent(current); pf.addListener((ob, o, n) -> { CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContent(p)); ObservableList<T> pt = func.apply(n); CacheUtil.set(BeanUtil.class, nestProp, pt); nestProp.bindContent(pt); }); return nestProp; }
public AdditionalParticipantPacket(ByteBuffer data) { super(data); this.offset = new SimpleIntegerProperty(ReadChar(data)); this.names = new SimpleListProperty<>(FXCollections.observableArrayList()); for (int i = 0; i < 16 ; i++) { this.names.add(new SimpleStringProperty(ReadString(data, 64).split("\u0000", 2)[0])); } }
public ZRow(int n) { super(); List<String> lst = new ArrayList<>(); for(int i=0; i<n; i++) { lst.add(" - "); } ObservableList<String> observableList = FXCollections.observableArrayList(lst); this.row = new SimpleListProperty<>(observableList); }
public DownloadTaskGroupItemInfoView(DownloadTaskGroup group) { timer = new Timer(true); updateTask = new TimerTask() { @Override public void run() { Platform.runLater(DownloadTaskGroupItemInfoView.this::updateStatus); } }; taskGroup = group; entries = new SimpleListProperty<>(FXCollections.observableArrayList()); FXMLLoader loader = new FXMLLoader(BundleUtils.getResourceFromBundle(getClass(), FXML_LOCATION)); loader.setRoot(this); loader.setController(this); try { loader.load(); } catch (IOException e) { throw new UncheckedIOException(e); } itemContainer.setCellFactory(view -> new ListCell<DownloadTaskEntry>() { @Override public void updateItem(DownloadTaskEntry entry, boolean empty) { super.updateItem(entry, empty); setGraphic(makePaneForEntry(entry)); } }); cancelButton.textProperty().bind(I18N.localize("org.to2mbn.lolixl.ui.impl.component.view.downloads.item.cancelbutton.text")); cancelButton.setOnAction(event -> group.cancel(true)); startUpdateCycle(); }
MainManager() { roomProvider = new RoomProvider(); guestProvider = new GuestProvider(); cleaningProvider = new CleaningProvider(); bookingOriginProvider = new BookingOriginProvider(); bookings = new ArrayList<>(); cleaningEntries = ArrayListMultimap.create(); bookingEntries = ArrayListMultimap.create(); uiData = new SimpleListProperty<>(FXCollections.observableArrayList(DateBean.extractor())); uiDataMap = new LinkedHashMap<>(); }
public MainWindowModel(List<Profile> profiles) { this.profileTabs = new SimpleListProperty<ProfileTab>(FXCollections.observableArrayList()); for (Profile profile : profiles) { ProfileTab tab = new ProfileTab(profile); tab.setOnClosed(e -> { disconnectTab(tab); }); this.addTab(tab); } }
@Override public TreeItem<StatisticsViewModel.IEntry<StringProperty, ? extends Property>> visit(FilterPropertiesComponent component) { final TreeItem<StatisticsViewModel.IEntry<StringProperty, ? extends Property>> root = new TreeItem<>(new StatisticsViewModel.StringEntry<>(component.name(), "")); root.getChildren().add(new TreeItem<>(new StatisticsViewModel.StringEntry<>("Status", new SimpleListProperty<>(FXCollections.observableArrayList(component.getFilterColors().values()))))); return root; }
/** * Private constructor used for deserialization purposes. * * @param history * the <code>ObservableList</code> to use as the history */ private History(ObservableList<State> history) { this.index = new SimpleIntegerProperty(0); this.history = new SimpleListProperty<>(history); this.inProgress = State.defaultState(); BooleanProperty prevProperty = new SimpleBooleanProperty(); prevProperty.bind(this.history.emptyProperty().or(index.isEqualTo(0)).not()); BooleanProperty nextProperty = new SimpleBooleanProperty(); nextProperty.bind(this.history.emptyProperty().or(index.greaterThanOrEqualTo(this.history.sizeProperty())).not()); this.hasPrevious = prevProperty; this.hasNext = nextProperty; }
public EloModel(GuiModel model) { this.model = model; teamMap = new TreeMap<String, EloObject>(); playerMap = new TreeMap<String, EloObject>(); teamElo = new SimpleListProperty<EloObject>( FXCollections.observableArrayList()); playerElo = new SimpleListProperty<EloObject>( FXCollections.observableArrayList()); }
/** * Builds a new, non-empty course group. * * @param courseList non-empty list of courses * @throws IllegalArgumentException if any parameter is null or any list is empty */ public CourseGroup(Collection<Course> courseList) throws IllegalArgumentException { if (courseList == null || courseList.isEmpty()) { throw new IllegalArgumentException("The parameters cannot be null and the lists cannot be empty."); } this.courseList = new SimpleListProperty<>(FXCollections.observableArrayList(courseList)); }
public LedBargraph() { getStyleClass().add("bargraph"); ledColors = new SimpleListProperty(this, "ledColors", FXCollections.<Color>observableArrayList()); value = new SimpleDoubleProperty(this, "value", 0); for (int i = 0 ; i < getNoOfLeds() ; i++) { if (i < 11) { ledColors.get().add(Color.LIME); } else if (i > 10 && i < 13) { ledColors.get().add(Color.YELLOW); } else { ledColors.get().add(Color.RED); } } }
/** * Creates a new instance of {@link FXDataBooksTree}. */ public FXDataBooksTree() { super(); dataBookAfterRowSelectedListener = this::onDataBookAfterRowSelectedChanged; dataBooksListChangeListener = this::onDataBooksListChanged; activeDataBook = new SimpleObjectProperty<>(); cellFormatter = new SimpleObjectProperty<>(); ignoreEvents = false; ignoreNextScrollBarValueChange = false; leafDetection = new SimpleBooleanProperty(); nodeFormatter = new SimpleObjectProperty<>(); notify = new FXNotifyHelper(this::reload); translation = new FXTranslationHelper(); dataBooks = new SimpleListProperty<>(FXCollections.observableArrayList()); dataBooks.addListener(this::onDataBooksChanged); dataBooks.get().addListener(dataBooksListChangeListener); getSelectionModel().selectedItemProperty().addListener(this::onSelectionChanged); setEditable(false); setRoot(new TreeItem<>("ROOT")); setShowRoot(false); }
public PlayerTournamentsToStringBinding(Player player, ObservableList<Tournament> tournaments) { this.player = new SimpleObjectProperty<Player>(); this.player.set(player); this.tournaments = new SimpleListProperty<Tournament>(tournaments); this.bind(this.player); this.bind(this.tournaments); }
public FormItem(Form form, FormItem<?> parent, DataType dataType, String name, String displayName, String description, int minOccurs, int maxOccurs, XmlNodeType xmlNodeType, T initialValue) { _form = form; _parent = parent; _dataType = dataType; _name = name; _displayName = displayName; _description = description; _minOccurs = minOccurs; _maxOccurs = maxOccurs; _xmlNodeType = xmlNodeType; _initialValue = initialValue; _valueProperty = new SimpleObjectProperty<T>(initialValue); _valueProperty.addListener((ov, oldValue, newValue) -> { if (!ObjectUtils.equals(newValue, _initialValue)) { _changed = true; } updateValidity(); notifyOfChangeInState(); }); _itemsProperty = new SimpleListProperty<FormItem<?>>( FXCollections.observableArrayList()); _itemsProperty.addListener(new ListChangeListener<FormItem<?>>() { @Override public void onChanged(Change<? extends FormItem<?>> c) { while (c.next()) { if (c.getAddedSize() > 0 || c.getRemovedSize() > 0) { _changed = true; } updateValidity(); notifyOfChangeInState(); } } }); _validityProperty = new SimpleObjectProperty<Validity>(); _validityProperty.set(IsNotValid.INSTANCE); updateValidity(); }
public LinkedEntriesEditorViewModel(String fieldName, AutoCompleteSuggestionProvider<?> suggestionProvider, BibDatabaseContext databaseContext, FieldCheckers fieldCheckers) { super(fieldName, suggestionProvider, fieldCheckers); this.databaseContext = databaseContext; linkedEntries = new SimpleListProperty<>(FXCollections.observableArrayList()); BindingsHelper.bindContentBidirectional( linkedEntries, text, EntryLinkList::serialize, newText -> EntryLinkList.parse(newText, databaseContext.getDatabase())); }
public TagBar() { tags = new SimpleListProperty<>(FXCollections.observableArrayList()); tags.addListener(this::onTagsChanged); // Load FXML ControlHelper.loadFXMLForControl(this); getStylesheets().add(0, TagBar.class.getResource("TagBar.css").toExternalForm()); }
/** * Creates a new TvShow object. * @param titleString is the title of the TvShow object. * @return a new TvShow object. */ public TvShow createTvShow(String titleString) { StringProperty title = new SimpleStringProperty(); title.set(titleString); StringProperty watched = new SimpleStringProperty(); watched.set("false"); StringProperty genre = new SimpleStringProperty(); genre.set(""); StringProperty runtime = new SimpleStringProperty(); runtime.set(""); StringProperty creator = new SimpleStringProperty(); creator.set(""); StringProperty network = new SimpleStringProperty(); network.set(""); StringProperty numSeasons = new SimpleStringProperty(); numSeasons.set("0"); StringProperty numEpisodes = new SimpleStringProperty(); numEpisodes.set("0"); StringProperty description = new SimpleStringProperty(); description.set(""); ListProperty<List<Episode>> episodeList = new SimpleListProperty<>(); episodeList.set(new ObservableListWrapper<>(new ArrayList<>())); ListProperty<Boolean> seasonWatchedList = new SimpleListProperty<>(); seasonWatchedList.set(new ObservableListWrapper<>(new ArrayList<>())); return new TvShow(title, watched, genre, runtime, description, creator, network, numSeasons, numEpisodes, episodeList, seasonWatchedList); }
private void initPagination() { int itemCount = 10; final Pagination pagination = new Pagination(personsService.getPersons().getValue().size() / itemCount); virtualizedPersons = personsService.getPersons().filtered(t -> { int indexOf = personsService.getPersons().indexOf(t); int currentItemCount = pagination.getCurrentPageIndex() * itemCount; if (indexOf > currentItemCount && indexOf < currentItemCount + itemCount) return true; else return false; }); itemsProperty().bind(new SimpleListProperty<>(virtualizedPersons)); }
@SuppressWarnings("unchecked") private void addColumns() { // Combine Townname and Zip to Town townCol.getColumns().addAll(townName, townZipCode); // Add Major colums getColumns().addAll(firstNameCol, lastNameCol, ageCol, townCol, solvencyCol); itemsProperty().bind(new SimpleListProperty<>(personsService.getPersons())); }
/** Replies the property that contains all the shapes in this multishape. * * @return the elements property. */ public ListProperty<T> elementsProperty() { if (this.elements == null) { this.elements = new SimpleListProperty<>(this, MathFXAttributeNames.ELEMENTS, new InternalObservableList<>()); } return this.elements; }
public SimpleListProperty<Collection> collectionsProperty() { return collectionsProperty; }
@NotNull @Override protected ListProperty<T> createProperty(ObservableList<T> deserializedValue) { return new SimpleListProperty<>(deserializedValue); }
WithListProp(ObservableList<CustomObject> value) { this.prop = new SimpleListProperty<>(value); }
public ButtonGroup(ObservableList<ButtonBase> buttons) { this.buttons = new SimpleListProperty<>(buttons); orientation = new SimpleObjectProperty<>(Orientation.HORIZONTAL); this.getStyleClass().add(CONTROL_STYLE_CLASS); }
@SuppressWarnings("unused") public ApplicationModel() { mainDateTime = new SimpleObjectProperty<>(); selectedZoneIds = new SimpleListProperty<>(); templateFile = new SimpleObjectProperty<>(); }
public LoadProfileModel(String profileDir) { profileDirsProperty = new SimpleListProperty<String>(FXCollections.observableArrayList()); profileDirsProperty.addListener((observable, oldValue, newValue) -> updateProfiles()); profilesProperty = new SimpleListProperty<Profile>(FXCollections.observableArrayList()); setDir(profileDir); }
public LoadProfileModel(List<String> profileDirs) { profileDirsProperty = new SimpleListProperty<String>(FXCollections.observableArrayList()); profileDirsProperty.addListener((observable, oldValue, newValue) -> updateProfiles()); profilesProperty = new SimpleListProperty<Profile>(FXCollections.observableArrayList()); setDirs(profileDirs); }
/** * <p> * Creates and initializes the component using the provided Collection of IPacketData. * </p> */ public PacketDataLoggingComponent(Collection<IPacketData> data) { dataList = FXCollections.observableArrayList(data); dataProperty = new SimpleListProperty<>(dataList); }
public RadialMenuSectionDynamic(Params params, RadialPane radialPane, RadialMenuSectionDynamic parentSection, DoubleExpression streakAngleDeg) { this.params = params; this.radialPane = radialPane; this.parentSection = parentSection; this.radialPane.addRadialSection(this); if (streakAngleDeg != null) { this.streakAngleDeg.bind(streakAngleDeg); } else { this.streakAngleDeg.bind(params.angleFromDegProperty() .add(params.angleToDegProperty().subtract(params.angleFromDegProperty()).multiply(0.5d))); } itemsCount = new SimpleListProperty<>(items).sizeProperty(); final DoubleExpression itemRadiusHalf = params.buttonSizeProperty().multiply(0.5); if (parentSection != null) { innerRadius.bind(parentSection.outerRadiusProperty().add(itemRadiusHalf.multiply(params.spacingFactorProperty().multiply(2)))); } else { innerRadius.bind(params.minRadiusProperty()); } final DoubleExpression angleDeg = params.angleToDegProperty().subtract(params.angleFromDegProperty()); final DoubleExpression angleRad = new FunctionDoubleBinding(Math::toRadians, angleDeg); final DoubleExpression availablePerimeter = angleRad.multiply(innerRadius.add(itemRadiusHalf)); final DoubleExpression gapSize = params.buttonSizeProperty().multiply(params.gapFactorProperty()); final DoubleExpression allItemsSize = params.buttonSizeProperty().multiply(itemsCount.subtract(1)); final DoubleExpression totalSize = allItemsSize.add(gapSize.multiply(itemsCount.subtract(1))); final NumberBinding candidateNominalRadius = new When(availablePerimeter.greaterThan(totalSize)) .then(innerRadius.add(itemRadiusHalf)) .otherwise(totalSize.divide(angleRad)); final DoubleExpression candidateAngularTotalSizeDeg = new FunctionDoubleBinding(Math::toDegrees, totalSize.divide(candidateNominalRadius)); final DoubleExpression candidateAngularItemSizeDeg = candidateAngularTotalSizeDeg.divide(itemsCount); final DoubleExpression angularTotalSizeWithOverlapDeg = candidateAngularTotalSizeDeg.add(candidateAngularItemSizeDeg); nominalRadius.bind(candidateNominalRadius.add(new When(angularTotalSizeWithOverlapDeg.greaterThan(TWO_PI)) .then(totalSize.divide(angularTotalSizeWithOverlapDeg.subtract(TWO_PI))) .otherwise(0))); angularTotalSizeDeg = new FunctionDoubleBinding(Math::toDegrees, totalSize.divide(nominalRadius)); // TODO: Make sure, that outerRadius is reasonably small to prevent "large texture" errors outerRadius.bind(nominalRadius.add(itemRadiusHalf.add(params.buttonWidthOffsetProperty()))); params.centerOffsetProperty().add(outerRadius); fromAngleDeg.bind(this.streakAngleDeg.subtract(angularTotalSizeDeg.multiply(0.5))); toAngleDeg.bind(this.streakAngleDeg.add(angularTotalSizeDeg.multiply(0.5))); correctedStreakAngleDeg.bind(this.streakAngleDeg.add(new When(fromAngleDeg.lessThan(params.angleFromDegProperty())) .then(params.angleFromDegProperty().subtract(fromAngleDeg)) .otherwise(new When(toAngleDeg.greaterThan(params.angleToDegProperty())) .then(params.angleToDegProperty().subtract(toAngleDeg)) .otherwise(0)))); toAngleDeg.bind(fromAngleDeg.add(angularTotalSizeDeg)); angularItemSizeDeg.bind(angularTotalSizeDeg.divide(itemsCount)); final Circle perimeter = setupPerimeter(params); radialPane.getChildren().add(perimeter); params.centerOffsetProperty().addListener(observable -> radialPane.layout()); totalSize.addListener((sender, oldV, newV) -> System.out.println(this + " [" + itemsCount.intValue() + "] totalSize: " + newV)); nominalRadius.addListener((sender, oldV, newV)-> System.out.println(this + " [" + itemsCount.intValue() + "] nominalRadius: " + newV)); angularTotalSizeDeg.addListener((sender, oldV, newV)-> System.out.println(this + " [" + itemsCount.intValue() + "] ang. size (deg): " + newV)); }
public SimpleListProperty<EloObject> playerEloProperty() { return playerElo; }