java类javafx.beans.property.SimpleListProperty的实例源码

ObservableListConverter.java 文件源码 项目:GameAuthoringEnvironment 阅读 26 收藏 0 点赞 0 评论 0
@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());
}
ParticipantPacket.java 文件源码 项目:project-cars-replay-enhancer-ui 阅读 35 收藏 0 点赞 0 评论 0
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)));
    }
}
MainController.java 文件源码 项目:code-tracker 阅读 30 收藏 0 点赞 0 评论 0
@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);
}
BeanUtil.java 文件源码 项目:JavaFX-EX 阅读 35 收藏 0 点赞 0 评论 0
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;
}
BeanUtil.java 文件源码 项目:JavaFX-EX 阅读 32 收藏 0 点赞 0 评论 0
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;
}
AdditionalParticipantPacket.java 文件源码 项目:project-cars-replay-enhancer-ui 阅读 29 收藏 0 点赞 0 评论 0
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]));
    }
}
BeanUtil.java 文件源码 项目:JavaFX-EX 阅读 34 收藏 0 点赞 0 评论 0
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;
}
BeanUtil.java 文件源码 项目:JavaFX-EX 阅读 32 收藏 0 点赞 0 评论 0
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;
}
TableController.java 文件源码 项目:zest-writer 阅读 32 收藏 0 点赞 0 评论 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);

}
DownloadTaskGroupItemInfoView.java 文件源码 项目:LoliXL 阅读 30 收藏 0 点赞 0 评论 0
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.java 文件源码 项目:drbookings 阅读 33 收藏 0 点赞 0 评论 0
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<>();

}
MainWindowModel.java 文件源码 项目:null-client 阅读 29 收藏 0 点赞 0 评论 0
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);
    }
}
ComponentInfoVisitor.java 文件源码 项目:truffle-hog 阅读 27 收藏 0 点赞 0 评论 0
@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;
}
History.java 文件源码 项目:jdime 阅读 44 收藏 0 点赞 0 评论 0
/**
 * 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;
}
EloModel.java 文件源码 项目:polTool 阅读 36 收藏 0 点赞 0 评论 0
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());
}
CourseGroup.java 文件源码 项目:StudyGuide 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 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));
}
LedBargraph.java 文件源码 项目:FXImgurUploader 阅读 35 收藏 0 点赞 0 评论 0
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);
        }
    }
}
FXDataBooksTree.java 文件源码 项目:JVx.javafx 阅读 35 收藏 0 点赞 0 评论 0
/**
 * 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);
}
PlayerTournamentsToStringBinding.java 文件源码 项目:Tourney 阅读 36 收藏 0 点赞 0 评论 0
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);
}
FormItem.java 文件源码 项目:daris 阅读 31 收藏 0 点赞 0 评论 0
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();
}
LinkedEntriesEditorViewModel.java 文件源码 项目:jabref 阅读 28 收藏 0 点赞 0 评论 0
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()));
}
TagBar.java 文件源码 项目:jabref 阅读 38 收藏 0 点赞 0 评论 0
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());
}
MediaCreator.java 文件源码 项目:WatchlistPro 阅读 30 收藏 0 点赞 0 评论 0
/**
 * 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);
}
PersonTable.java 文件源码 项目:jfxtables 阅读 38 收藏 0 点赞 0 评论 0
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));
}
PersonTable.java 文件源码 项目:jfxtables 阅读 40 收藏 0 点赞 0 评论 0
@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()));
}
LedBargraph.java 文件源码 项目:Enzo 阅读 30 收藏 0 点赞 0 评论 0
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);
        }
    }
}
MultiShape2ifx.java 文件源码 项目:afc 阅读 29 收藏 0 点赞 0 评论 0
/** 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;
}
MultiShape2dfx.java 文件源码 项目:afc 阅读 30 收藏 0 点赞 0 评论 0
/** 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;
}
MultiShape3ifx.java 文件源码 项目:afc 阅读 32 收藏 0 点赞 0 评论 0
/** 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;
}
MultiShape3dfx.java 文件源码 项目:afc 阅读 28 收藏 0 点赞 0 评论 0
/** 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;
}


问题


面经


文章

微信
公众号

扫码关注公众号