public TagsModel() { TAG_TYPES_PROPERTY = new ReadOnlyMapWrapper<>(FXCollections.observableHashMap()); PREDEFINED_TAGS_PROPERTY = new ReadOnlyMapWrapper<>(FXCollections.observableHashMap()); CUSTOM_TAGS_PROPERTY = new ReadOnlyListWrapper<>(FXCollections.observableArrayList()); // for (PredefinedTagType predefinedTag : PredefinedTagType.values()) { final TagType tagType = predefinedTag.get(); final int tagId = tagType.getId(); if (null != TAG_TYPES_PROPERTY.putIfAbsent(tagId, tagType)) { System.out.println(String.format("%s already exists (id=%d)", TagType.class.getSimpleName(), tagId)); } if (null != PREDEFINED_TAGS_PROPERTY.put(tagId, new TagModel(tagType.getName(), StringType.empty()))) { System.out.println(String.format("%s already exists (id=%d)", PredefinedTagType.class.getSimpleName(), tagId)); } } }
private void loadData() { GluonObservableList<Exhibitor> localExhibitors = loadEntities("exhibitors", Exhibitor.class, ServiceUtils::mapJsonToExhibitor); exhibitors = new ReadOnlyListWrapper<>(localExhibitors); GluonObservableList<Session> localSessions = loadEntities("sessions", Session.class, ServiceUtils::mapJsonToSession); sessions = new ReadOnlyListWrapper<>(localSessions); localSessions.initializedProperty().addListener(new InvalidationListener() { @Override public void invalidated(javafx.beans.Observable observable) { if (localSessions.isInitialized()) { // now that we have started retrieving the list of sessions we can // call retrieveAuthenticatedUser as sessions won't be empty localSessions.initializedProperty().removeListener(this); retrieveAuthenticatedUser(); } } }); GluonObservableList<Speaker> localSpeakers = loadEntities("speakers", Speaker.class, ServiceUtils::mapJsonToSpeaker); speakers = new ReadOnlyListWrapper<>(localSpeakers); GluonObservableList<Sponsor> localSponsors = loadEntities("sponsors", Sponsor.class, ServiceUtils::mapJsonToSponsor); sponsors = new ReadOnlyListWrapper<>(localSponsors); GluonObservableList<Venue> localVenues = loadEntities("venues", Venue.class, ServiceUtils::mapJsonToVenue); venues = new ReadOnlyListWrapper<>(localVenues); }
@Override public ReadOnlyListProperty<News> retrieveNews() { if (news == null) { news = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(readNews())); } return news.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<Session> retrieveSessions() { if (sessions == null) { sessions = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(readSessions())); } return sessions.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<Speaker> retrieveSpeakers() { if (speakers == null) { speakers = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(readSpeakers())); } return speakers.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<Exhibitor> retrieveExhibitors() { if (exhibitors == null) { exhibitors = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(readExhibitors())); } return exhibitors.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<Sponsor> retrieveSponsors() { if (sponsors == null) { sponsors = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(readSponsors())); } return sponsors.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<Venue> retrieveVenues() { if (venues == null) { venues = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(readVenues())); } return venues.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<OTNCoffee> retrieveOTNCoffees() { if (otnCoffees == null) { List<OTNCoffee> coffees = new LinkedList<>(); coffees.add(new OTNCoffee("1", "Brazilian Coffee")); coffees.add(new OTNCoffee("2", "Ethiopian Coffee")); coffees.add(new OTNCoffee("3", "Taiwan Tea")); otnCoffees = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(coffees)); } return otnCoffees; }
@Override public ReadOnlyListProperty<OTNGame> retrieveOTNGames() { if (otnGames == null) { List<OTNGame> games = new LinkedList<>(); games.add(new OTNGame("Tetris", "http://javahub.com/game/id1", "http://lorempixel.com/400/200")); games.add(new OTNGame("PacMan", "http://javahub.com/game/id2", "http://lorempixel.com/400/200")); games.add(new OTNGame("Brick Breaker", "http://javahub.com/game/id3", "http://lorempixel.com/400/200")); otnGames = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(games)); } return otnGames; }
@Override public ReadOnlyListProperty<OTNEmbroidery> retrieveOTNEmbroideries() { if (otnEmbroideries == null) { List<OTNEmbroidery> embroideries = new LinkedList<>(); embroideries.add(new OTNEmbroidery("OTNEmbroidery 1", "http://javahub.com/embroidery/id1", "http://lorempixel.com/400/200")); embroideries.add(new OTNEmbroidery("OTNEmbroidery 2", "http://javahub.com/embroidery/id2", "http://lorempixel.com/400/200")); embroideries.add(new OTNEmbroidery("OTNEmbroidery 3", "http://javahub.com/embroidery/id3", "http://lorempixel.com/400/200")); otnEmbroideries = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(embroideries)); } return otnEmbroideries; }
@Override public ReadOnlyListProperty<OTN3DModel> retrieveOTN3DModels() { if (otn3DModels == null) { List<OTN3DModel> models = new LinkedList<>(); models.add(new OTN3DModel("1", "Model 1", "http://lorempixel.com/400/200", true, 0)); models.add(new OTN3DModel("2", "Model 2", "http://lorempixel.com/400/200", false, 4)); models.add(new OTN3DModel("3", "Model 3", "http://lorempixel.com/400/200", false, 7)); models.add(new OTN3DModel("4", "Model 4", "http://lorempixel.com/400/200", false, 19)); otn3DModels = new ReadOnlyListWrapper<>(FXCollections.observableArrayList(models)); } return otn3DModels; }
@Override public ReadOnlyListProperty<News> retrieveNews() { if (news == null) { GluonObservableList<News> gluonNews = DataProvider.retrieveList(cloudGluonClient.createListDataReader("activityFeed", News.class, SyncFlag.LIST_READ_THROUGH)); SortedList<News> sortedNews = new SortedList<>(gluonNews); sortedNews.setComparator((n1, n2) -> n1.getCreationDate() == n2.getCreationDate() ? n1.getUuid().compareTo(n2.getUuid()) : Long.compare(n1.getCreationDate(), n2.getCreationDate()) * -1); news = new ReadOnlyListWrapper<>(sortedNews); } return news.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<OTNCoffee> retrieveOTNCoffees() { if (otnCoffees == null) { GluonObservableList<OTNCoffee> gluonCoffees = DataProvider.retrieveList(cloudGluonClient.createListDataReader("otncoffees", OTNCoffee.class, SyncFlag.LIST_READ_THROUGH)); otnCoffees = new ReadOnlyListWrapper<>(gluonCoffees); } return otnCoffees.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<OTNGame> retrieveOTNGames() { if (otnGames == null) { GluonObservableList<OTNGame> gluonGames = DataProvider.retrieveList(cloudGluonClient.createListDataReader("otngames", OTNGame.class, SyncFlag.LIST_READ_THROUGH)); otnGames = new ReadOnlyListWrapper<>(gluonGames); } return otnGames.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<OTNEmbroidery> retrieveOTNEmbroideries() { if (otnEmbroideries == null) { GluonObservableList<OTNEmbroidery> gluonEmbroideries = DataProvider.retrieveList(cloudGluonClient.createListDataReader("otnembroideries", OTNEmbroidery.class, SyncFlag.LIST_READ_THROUGH)); otnEmbroideries = new ReadOnlyListWrapper<>(gluonEmbroideries); } return otnEmbroideries.getReadOnlyProperty(); }
@Override public ReadOnlyListProperty<OTN3DModel> retrieveOTN3DModels() { if (otn3DModels == null) { ObservableList<OTN3DModel> localList = FXCollections.observableArrayList(); otn3DModels = new ReadOnlyListWrapper<>(localList); GluonObservableList<OTN3DModel> gluon3DModels = DataProvider.retrieveList(cloudGluonClient.createListDataReader("otn3dmodels", OTN3DModel.class, SyncFlag.LIST_READ_THROUGH, SyncFlag.OBJECT_READ_THROUGH, SyncFlag.OBJECT_WRITE_THROUGH)); gluon3DModels.initializedProperty().addListener((obs, ov, nv) -> { if (nv) { Bindings.bindContent(localList, gluon3DModels); } }); } return otn3DModels.getReadOnlyProperty(); }
public LocaleHandler() { this.currentLocale = new SimpleObjectProperty<Locale>( this, "currentLocale"); this.supportedLocales = new ReadOnlyListWrapper<Locale>( this, "availableLocales"); this.updateSupportedLocales(); this.setCurrentLocale(Locale.getDefault()); }
public LocaleHandler(Locale initialLocale) { this.currentLocale = new SimpleObjectProperty<Locale>( this, "currentLocale"); this.supportedLocales = new ReadOnlyListWrapper<Locale>( this, "availableLocales"); this.updateSupportedLocales(); this.setCurrentLocale(initialLocale); }
public ErrorConsoleViewModel(DialogService dialogService, ClipBoardManager clipBoardManager, BuildInfo buildInfo) { this.dialogService = Objects.requireNonNull(dialogService); this.clipBoardManager = Objects.requireNonNull(clipBoardManager); this.buildInfo = Objects.requireNonNull(buildInfo); ObservableList<LogEventViewModel> eventViewModels = EasyBind.map(LogMessages.getInstance().getMessages(), LogEventViewModel::new); allMessagesData = new ReadOnlyListWrapper<>(eventViewModels); }
@Override public void lineTo(int x, int y) { ensureMoveTo(); innerTypesProperty().add(PathElementType.LINE_TO); final ReadOnlyListWrapper<Point2ifx> coords = innerPointsProperty(); coords.add(getGeomFactory().newPoint(x, y)); }
@Override public void quadTo(int x1, int y1, int x2, int y2) { ensureMoveTo(); innerTypesProperty().add(PathElementType.QUAD_TO); final ReadOnlyListWrapper<Point2ifx> coords = innerPointsProperty(); coords.add(getGeomFactory().newPoint(x1, y1)); coords.add(getGeomFactory().newPoint(x2, y2)); }
@Override public void curveTo(int x1, int y1, int x2, int y2, int x3, int y3) { ensureMoveTo(); innerTypesProperty().add(PathElementType.CURVE_TO); final ReadOnlyListWrapper<Point2ifx> coords = innerPointsProperty(); coords.add(getGeomFactory().newPoint(x1, y1)); coords.add(getGeomFactory().newPoint(x2, y2)); coords.add(getGeomFactory().newPoint(x3, y3)); }
/** Replies the private coordinates property. * * @return the private coordinates property. */ protected ReadOnlyListWrapper<Point2ifx> innerPointsProperty() { if (this.coords == null) { this.coords = new ReadOnlyListWrapper<>(this, MathFXAttributeNames.COORDINATES, FXCollections.observableList(new ArrayList<>())); } return this.coords; }
/** Replies the private types property. * * @return the private types property. */ protected ReadOnlyListWrapper<PathElementType> innerTypesProperty() { if (this.types == null) { this.types = new ReadOnlyListWrapper<>(this, MathFXAttributeNames.TYPES, FXCollections.observableList(new ArrayList<>())); } return this.types; }
@Override public void lineTo(double x, double y) { ensureMoveTo(); innerTypesProperty().add(PathElementType.LINE_TO); final ReadOnlyListWrapper<Point2dfx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x, y)); }
@Override public void quadTo(double x1, double y1, double x2, double y2) { ensureMoveTo(); innerTypesProperty().add(PathElementType.QUAD_TO); final ReadOnlyListWrapper<Point2dfx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x1, y1)); coords.add(getGeomFactory().newPoint(x2, y2)); }
@Override public void curveTo(double x1, double y1, double x2, double y2, double x3, double y3) { ensureMoveTo(); innerTypesProperty().add(PathElementType.CURVE_TO); final ReadOnlyListWrapper<Point2dfx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x1, y1)); coords.add(getGeomFactory().newPoint(x2, y2)); coords.add(getGeomFactory().newPoint(x3, y3)); }
/** Replies the private coordinates property. * * @return the private coordinates property. */ protected ReadOnlyListWrapper<Point2dfx> innerCoordinatesProperty() { if (this.coords == null) { this.coords = new ReadOnlyListWrapper<>(this, MathFXAttributeNames.COORDINATES, FXCollections.observableList(new ArrayList<>())); } return this.coords; }
@Override public void lineTo(int x, int y, int z) { ensureMoveTo(); innerTypesProperty().add(PathElementType.LINE_TO); final ReadOnlyListWrapper<Point3ifx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x, y, z)); }
@Override public void quadTo(int x1, int y1, int z1, int x2, int y2, int z2) { ensureMoveTo(); innerTypesProperty().add(PathElementType.QUAD_TO); final ReadOnlyListWrapper<Point3ifx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x1, y1, z1)); coords.add(getGeomFactory().newPoint(x2, y2, z2)); }
@Override @SuppressWarnings("checkstyle:parameternumber") public void curveTo(int x1, int y1, int z1, int x2, int y2, int z2, int x3, int y3, int z3) { ensureMoveTo(); innerTypesProperty().add(PathElementType.CURVE_TO); final ReadOnlyListWrapper<Point3ifx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x1, y1, z1)); coords.add(getGeomFactory().newPoint(x2, y2, z2)); coords.add(getGeomFactory().newPoint(x3, y3, z3)); }
/** Replies the private coordinates property. * * @return the private coordinates property. */ protected ReadOnlyListWrapper<Point3ifx> innerCoordinatesProperty() { if (this.coords == null) { this.coords = new ReadOnlyListWrapper<>(this, MathFXAttributeNames.COORDINATES, FXCollections.observableList(new ArrayList<>())); } return this.coords; }
@Override public void lineTo(double x, double y, double z) { ensureMoveTo(); innerTypesProperty().add(PathElementType.LINE_TO); final ReadOnlyListWrapper<Point3dfx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x, y, z)); }
@Override public void quadTo(double x1, double y1, double z1, double x2, double y2, double z2) { ensureMoveTo(); innerTypesProperty().add(PathElementType.QUAD_TO); final ReadOnlyListWrapper<Point3dfx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x1, y1, z1)); coords.add(getGeomFactory().newPoint(x2, y2, z2)); }
@Override @SuppressWarnings("checkstyle:parameternumber") public void curveTo(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) { ensureMoveTo(); innerTypesProperty().add(PathElementType.CURVE_TO); final ReadOnlyListWrapper<Point3dfx> coords = innerCoordinatesProperty(); coords.add(getGeomFactory().newPoint(x1, y1, z1)); coords.add(getGeomFactory().newPoint(x2, y2, z2)); coords.add(getGeomFactory().newPoint(x3, y3, z3)); }