/** * If the entry is a recurrence (see {@link #recurrenceProperty()}) then * this property will store a reference to the entry for which the * recurrence was created. * * @return the entry that was the source of the recurrence */ public final ReadOnlyObjectProperty<Entry<T>> recurrenceSourceProperty() { if (recurrenceSource == null) { recurrenceSource = new ReadOnlyObjectWrapper<Entry<T>>(this, "recurrenceSource") { //$NON-NLS-1$ @Override public void set(Entry<T> newEntry) { super.set(newEntry); if (newEntry != null) { setRecurrence(true); } else { setRecurrence(false); } } }; } return recurrenceSource.getReadOnlyProperty(); }
@Override @FXThread protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() { final VirtualResourceTree<C> resourceTree = getResourceTree(); final MultipleSelectionModel<TreeItem<VirtualResourceElement<?>>> selectionModel = resourceTree.getSelectionModel(); final ReadOnlyObjectProperty<TreeItem<VirtualResourceElement<?>>> selectedItemProperty = selectionModel.selectedItemProperty(); final Class<C> type = getObjectsType(); final BooleanBinding typeCondition = new BooleanBinding() { @Override protected boolean computeValue() { final TreeItem<VirtualResourceElement<?>> treeItem = selectedItemProperty.get(); return treeItem == null || !type.isInstance(treeItem.getValue().getObject()); } @Override public Boolean getValue() { return computeValue(); } }; return Bindings.or(selectedItemProperty.isNull(), typeCondition); }
@Override public ReadOnlyObjectProperty<RequestStatus> loadCatchTypes(Consumer<CatchType> loadCallback) { RestClient catchTypeClient = RestClient.create().method("GET").host("https://api.nestnz.org") .path("/catch-type").connectTimeout(TIMEOUT); return processReadRequest(ApiCatchType.class, catchTypeClient, apiCatchType -> { URL imageUrl = null; if (apiCatchType.getImageUrl() != null) { try { imageUrl = new URL(apiCatchType.getImageUrl()); } catch (MalformedURLException ex) { LOG.log(Level.WARNING, "Error decoding image url: "+apiCatchType.getImageUrl(), ex); } } CatchType catchType = new CatchType(apiCatchType.getId(), apiCatchType.getName(), imageUrl); loadCallback.accept(catchType); }); }
@Override public ReadOnlyObjectProperty<RequestStatus> loadTrapline(Trapline trapline, Consumer<Trap> loadCallback) { RestClient trapsClient = RestClient.create().method("GET").host("https://api.nestnz.org") .path("/trap").connectTimeout(TIMEOUT).queryParam("trapline-id", Integer.toString(trapline.getId())); return processReadRequest(ApiTrap.class, trapsClient, apiTrap -> { if (apiTrap.getTraplineId() != trapline.getId()) { LOG.log(Level.WARNING, apiTrap+" was returned in a request for trapline "+trapline.getId()); return; } LocalDateTime created = LocalDateTime.parse(apiTrap.getCreated().replace(' ', 'T')); LocalDateTime lastReset = apiTrap.getLastReset() == null ? null : LocalDateTime.parse(apiTrap.getLastReset().replace(' ', 'T')); Trap trap = new Trap(apiTrap.getId(), apiTrap.getNumber(), apiTrap.getLatitude(), apiTrap.getLongitude(), TrapStatus.ACTIVE, created, lastReset); loadCallback.accept(trap); }); }
@SuppressWarnings("unchecked") @Override public void set(Consumer<Object> dispatcher, Object node, String name, VProperty vProperty) { if(! (node instanceof ListView)) { throw new IllegalStateException("Trying to set selectionModel of node " + node); } final ListView listView = (ListView) node; final ReadOnlyObjectProperty selectedItemProperty = listView.getSelectionModel().selectedItemProperty(); clearListeners(node, selectedItemProperty); final Object value = vProperty.isValueDefined()? vProperty.getValue() : null; listView.getSelectionModel().select(value); if(vProperty.getChangeListener().isDefined()) { setChangeListener(dispatcher, node, selectedItemProperty, vProperty.getChangeListener().get()); } if(vProperty.getInvalidationListener().isDefined()) { setInvalidationListener(dispatcher, node, selectedItemProperty, vProperty.getInvalidationListener().get()); } }
@Override public FindReplaceDialog getFindReplaceDialog() { if (findReplaceDialog == null) { findReplaceDialog = new FindReplaceDialog(getWindow(), this); ChangeListener<Node> focusOwnerListener = (observable, oldValue, newValue) -> findReplaceDialog.getController().setFocusOwner(newValue); ChangeListener<Scene> sceneListener = (observable, oldValue, newValue) -> { if (oldValue != null) oldValue.focusOwnerProperty().removeListener(focusOwnerListener); if (newValue != null) newValue.focusOwnerProperty().addListener(focusOwnerListener); }; ReadOnlyObjectProperty<Scene> sceneProperty = root.sceneProperty(); sceneProperty.addListener(sceneListener); sceneListener.changed(sceneProperty, null, sceneProperty.get()); } return findReplaceDialog; }
private void invalidate() { boolean initialized = false; for (ReadOnlyObjectProperty<Bounds> property : sourceBounds) { Bounds bounds = property.get(); if (!initialized) { minX.set(floorIfNeeded(bounds.getMinX())); minY.set(floorIfNeeded(bounds.getMinY())); minZ.set(floorIfNeeded(bounds.getMinZ())); maxX.set(ceilIfNeeded(bounds.getMaxX())); maxY.set(ceilIfNeeded(bounds.getMaxY())); maxZ.set(ceilIfNeeded(bounds.getMaxZ())); initialized = true; } else { minX.set(Double.min(minX.get(), floorIfNeeded(bounds.getMinX()))); minY.set(Double.min(minY.get(), floorIfNeeded(bounds.getMinY()))); minZ.set(Double.min(minZ.get(), floorIfNeeded(bounds.getMinZ()))); maxX.set(Double.max(maxX.get(), ceilIfNeeded(bounds.getMaxX()))); maxY.set(Double.max(maxY.get(), ceilIfNeeded(bounds.getMaxY()))); maxZ.set(Double.max(maxZ.get(), ceilIfNeeded(bounds.getMaxZ()))); } } }
private void bindPossibleScoringButtons() { ReadOnlyIntegerProperty selectedIndex = this.tablePossibleScores .getSelectionModel().selectedIndexProperty(); ReadOnlyObjectProperty<PossibleScoring> selectedItem = this.tablePossibleScores .getSelectionModel().selectedItemProperty(); // only enable move-up button if an item other than the topmost is // selected this.buttonMoveScoreUp.disableProperty().bind( selectedIndex.isEqualTo(0).or(selectedItem.isNull())); // only enable move-down button if an item other than the last one is // selected // index < size - 1 && selected != null this.buttonMoveScoreDown.disableProperty().bind( selectedIndex.greaterThanOrEqualTo( Bindings.size(this.tablePossibleScores.getItems()) .subtract(1)).or(selectedItem.isNull())); // only enable remove button if an item is selected this.buttonRemoveScore.disableProperty().bind(selectedItem.isNull()); // only enable edit button if an item is selected this.buttonEditScore.disableProperty().bind(selectedItem.isNull()); }
private void monitorStageScene(ReadOnlyObjectProperty<Scene> stageSceneProperty) { // first listen to changes stageSceneProperty.addListener(new ChangeListener<Scene>() { @Override public void changed(ObservableValue<? extends Scene> ov, Scene o, Scene n) { if (o != null) { unregisterScene(o); } if (n != null) { registerScene(n); } } }); if (stageSceneProperty.getValue() != null) { registerScene(stageSceneProperty.getValue()); } }
/** * Helper method which provides extra logic for extracting the {@link TreeItem} {@link Property} from a * {@link TreeTableCell}, which itself has no {@link TreeItem} property. The {@link TreeItem} {@link Property} we * want to bind can be found in the containing {@link TreeTableRow} instead. * <p> * * @param <T> the type of the item contained in the {@link TreeTableRow} * @param appCtx the {@link ApplicationContext} of the application * @param ctxMenuProperty the {@link ContextMenu} {@link Property} of the {@link TreeTableCell} * @param tableRowProperty the {@link TreeTableRow} {@link Property} of the {@link TreeTableCell} */ private static <T> void bindContextMenuForTreeTableCell(ApplicationContext appCtx, ObjectProperty<ContextMenu> ctxMenuProperty, ReadOnlyObjectProperty<TreeTableRow<T>> tableRowProperty) { tableRowProperty.addListener((property, oldValue, newValue) -> { // If the containing TreeTableRow disappears, unbind the context menu if any if (newValue == null) { ctxMenuProperty.unbind(); return; } // Otherwise, bind the ContextMenu to the TreeItem Property of the containing TreeTable row. bindContextMenu(appCtx, ctxMenuProperty, newValue.treeItemProperty()); }); }
public void initializeTabChangeListener(TabPane tabPane) { ReadOnlyObjectProperty<Tab> itemProperty = tabPane.getSelectionModel().selectedItemProperty(); tabPane.setOnMouseReleased(event -> { Optional.ofNullable(itemProperty) .map(ObservableObjectValue::get) .filter(e -> e instanceof MyTab) .map(e -> (MyTab) e) .map(MyTab::getEditorPane) .ifPresent(EditorPane::focus); }); itemProperty.addListener((observable, oldValue, selectedTab) -> { Optional.ofNullable(selectedTab) .filter(e -> e instanceof MyTab) .map(e -> (MyTab) e) .map(MyTab::getEditorPane) .filter(EditorPane::getReady) .ifPresent(EditorPane::updatePreviewUrl); }); }
@PostConstruct public void afterInit() { threadService.runActionLater(() -> { getWindow().setMember("afx", controller); ReadOnlyObjectProperty<Worker.State> stateProperty = webEngine().getLoadWorker().stateProperty(); WebView popupView = new WebView(); Stage stage = new Stage(); stage.setScene(new Scene(popupView)); stage.setTitle("AsciidocFX"); InputStream logoStream = SlidePane.class.getResourceAsStream("/logo.png"); stage.getIcons().add(new Image(logoStream)); webEngine().setCreatePopupHandler(param -> { if (!stage.isShowing()) { stage.show(); popupView.requestFocus(); } return popupView.getEngine(); }); stateProperty.addListener(this::stateListener); }); }
@Override public ReadOnlyObjectProperty<Rectangle2afp<?, ?, ?, ?, ?, ?>> viewportBoundsProperty() { if (this.viewportBounds == null) { this.viewportBounds = new ReadOnlyObjectWrapper<>(this, VIEWPORT_BOUNDS_PROPERTY); this.viewportBounds.bind(Bindings.createObjectBinding(() -> { final double scale = getScaleValue(); final double visibleAreaWidth = getWidth() / scale; final double visibleAreaHeight = getHeight() / scale; final double visibleAreaX = getViewportCenterX() - visibleAreaWidth / 2.; final double visibleAreaY = getViewportCenterY() - visibleAreaHeight / 2.; return new Rectangle2d(visibleAreaX, visibleAreaY, visibleAreaWidth, visibleAreaHeight); }, widthProperty(), heightProperty(), viewportCenterXProperty(), viewportCenterYProperty(), scaleValueProperty())); } return this.viewportBounds.getReadOnlyProperty(); }
/** * The date control where the entry view is shown. * * @return the date control */ public final ReadOnlyObjectProperty<T> dateControlProperty() { if (dateControl == null) { dateControl = new ReadOnlyObjectWrapper<>(this, "dateControl", _dateControl); //$NON-NLS-1$ } return dateControl.getReadOnlyProperty(); }
/** * The time where the entry view starts (not the start time of the calendar * entry). * * @return the start time of the view (not of the calendar entry) */ public final ReadOnlyObjectProperty<LocalTime> startTimeProperty() { if (startTime == null) { startTime = new ReadOnlyObjectWrapper<>(this, "startTime", _startTime); //$NON-NLS-1$ } return startTime.getReadOnlyProperty(); }
/** * The time where the entry view ends (not the end time of the calendar * entry). * * @return the end time of the view (not of the calendar entry) */ public final ReadOnlyObjectProperty<LocalTime> endTimeProperty() { if (endTime == null) { endTime = new ReadOnlyObjectWrapper<>(this, "endTime", _endTime); //$NON-NLS-1$ } return endTime.getReadOnlyProperty(); }
/** * The property used to store the end time of the recurrence rule. * * @return the recurrence rule end time * @see #recurrenceRuleProperty() */ public final ReadOnlyObjectProperty<LocalDate> recurrenceEndProperty() { if (recurrenceEnd == null) { recurrenceEnd = new ReadOnlyObjectWrapper<>(this, "recurrenceEnd", _recurrenceEnd); //$NON-NLS-1$ } return recurrenceEnd.getReadOnlyProperty(); }
/** * A property used to store a time zone for the entry. The time zone is * needed for properly interpreting the dates and times of the entry. * * @return the time zone property */ public final ReadOnlyObjectProperty<ZoneId> zoneIdProperty() { if (zoneId == null) { zoneId = new ReadOnlyObjectWrapper<>(this, "zoneId", getInterval().getZoneId()); //$NON-NLS-1$ } return zoneId.getReadOnlyProperty(); }
/** * A read-only property used for retrieving the end date of the entry. The * property gets updated whenever the end date inside the entry interval * changes (see {@link #intervalProperty()}). * * @return the end date of the entry */ public final ReadOnlyObjectProperty<LocalDate> endDateProperty() { if (endDate == null) { endDate = new ReadOnlyObjectWrapper<>(this, "endDate", getInterval().getEndDate()); //$NON-NLS-1$ } return endDate.getReadOnlyProperty(); }
/** * A read-only property used for retrieving the end time of the entry. The * property gets updated whenever the end time inside the entry interval * changes (see {@link #intervalProperty()}). * * @return the end time of the entry */ public final ReadOnlyObjectProperty<LocalTime> endTimeProperty() { if (endTime == null) { endTime = new ReadOnlyObjectWrapper<>(this, "endTime", getInterval().getEndTime()); //$NON-NLS-1$ } return endTime.getReadOnlyProperty(); }
/** * <p> * Creates a validator with given observable models as context information. * </p> * * <p> * The validator observes changes in any of the given context models. It automatically updates the * validated specification (see {@link #validSpecificationProperty()}) and/or the problems with * the constraint specification (see {@link #problemsProperty()}). * </p> * * @param typeContext the extracted types (esp. enums) from the code area * @param codeIoVariables the extracted {@link CodeIoVariable}s from the code area * @param validFreeVariables the most latest validated free variables from the * {@link FreeVariableList}. * @param specification the specification to be validated */ public ConstraintSpecificationValidator(ObjectProperty<List<Type>> typeContext, ObjectProperty<List<CodeIoVariable>> codeIoVariables, ReadOnlyObjectProperty<List<ValidFreeVariable>> validFreeVariables, ConstraintSpecification specification) { this.typeContext = typeContext; this.codeIoVariables = codeIoVariables; this.validFreeVariables = validFreeVariables; this.specification = specification; this.problems = new SimpleObjectProperty<>(new ArrayList<>()); this.validSpecification = new NullableProperty<>(); this.valid = new SimpleBooleanProperty(false); // All these ObservableLists invoke the InvalidationListeners on deep updates // So if only a cell in the Specification changes, the change listener on the ObservableList // two layers above gets notified. specification.getRows().addListener(listenToSpecUpdate); specification.getDurations().addListener(listenToSpecUpdate); specification.getColumnHeaders().addListener(listenToSpecUpdate); typeContext.addListener(listenToSpecUpdate); codeIoVariables.addListener(listenToSpecUpdate); validFreeVariables.addListener(listenToSpecUpdate); recalculateSpecProblems(); }
@Override @FXThread protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() { final ResourceTree resourceTree = getResourceTree(); final MultipleSelectionModel<TreeItem<ResourceElement>> selectionModel = resourceTree.getSelectionModel(); final ReadOnlyObjectProperty<TreeItem<ResourceElement>> selectedItemProperty = selectionModel.selectedItemProperty(); return selectedItemProperty.isNull(); }
@Override @FXThread protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() { final ComboBox<String> comboBox = getTextureParamNameComboBox(); final SingleSelectionModel<String> selectionModel = comboBox.getSelectionModel(); final ReadOnlyObjectProperty<String> itemProperty = selectionModel.selectedItemProperty(); final ObservableBooleanValue parent = super.buildAdditionalDisableCondition(); return Bindings.and(parent, itemProperty.isNull().or(itemProperty.isEqualTo(""))); }
private static ReadOnlyObjectProperty<? extends Control> getControlProperty(Object obj) { if (obj instanceof TableColumn) { return ((TableColumn) obj).tableViewProperty(); } else if (obj instanceof TreeTableColumn) { return ((TreeTableColumn) obj).treeTableViewProperty(); } else if (obj instanceof DockTab) { return ((DockTab) obj).tabPaneProperty(); } return null; }
@Override public ReadOnlyObjectProperty<EnabledOTNExperiences> retrieveEnabledOTNExperiences() { if (enabledOTNExperiences == null) { EnabledOTNExperiences otnExperiences = new EnabledOTNExperiences(); otnExperiences.badgeEnabledProperty().set(true); otnExperiences.coffeeEnabledProperty().set(true); otnExperiences.embroiderEnabledProperty().set(true); otnExperiences.gameEnabledProperty().set(true); otnExperiences.vote3dEnabledProperty().set(true); otnExperiences.iotworkshopEnabledProperty().set(true); enabledOTNExperiences = new ReadOnlyObjectWrapper<>(otnExperiences); } return enabledOTNExperiences.getReadOnlyProperty(); }
@Override public ReadOnlyObjectProperty<EnabledOTNExperiences> retrieveEnabledOTNExperiences() { if (enabledOTNExperiences == null) { enabledOTNExperiences = new ReadOnlyObjectWrapper<>(); GluonObservableObject<EnabledOTNExperiences> otnExperiences = DataProvider.retrieveObject(cloudGluonClient.createObjectDataReader("enabledOtnExperiences", EnabledOTNExperiences.class, SyncFlag.OBJECT_READ_THROUGH)); otnExperiences.initializedProperty().addListener((obs, ov, nv) -> { if (nv) { enabledOTNExperiences.setValue(otnExperiences.get()); } }); } return enabledOTNExperiences.getReadOnlyProperty(); }
@Override public ReadOnlyObjectProperty<LatestClearThreeDModelVotes> retrieveLatestClearVotes() { if (latestClearVotes == null) { latestClearVotes = new ReadOnlyObjectWrapper<>(); GluonObservableObject<LatestClearThreeDModelVotes> gluonLatestClearVotes = DataProvider.retrieveObject(cloudGluonClient.createObjectDataReader("latestClearThreeDModelVotes", LatestClearThreeDModelVotes.class, SyncFlag.OBJECT_READ_THROUGH)); gluonLatestClearVotes.initializedProperty().addListener((obs, ov, nv) -> { if (nv) { latestClearVotes.setValue(gluonLatestClearVotes.get()); } }); } return latestClearVotes.getReadOnlyProperty(); }
private void initializePatternsPane() { ReadOnlyObjectProperty<Columnizer> selectedColumnizer = columnizersPane.selectedItemProperty(); selectedColumnizerPane.disableProperty().bind(selectedColumnizer.isNull()); ListBinding<Pattern> patterns = UIUtils.selectList(selectedColumnizer, Columnizer::getPatterns); Predicate<String> isValidRegex = regex -> createPattern(regex) != null; patternsPane.setItemFactory(ColumnizersController::createPattern); patternsPane.setItemDuplicator(p -> p); // not updated anyway patternsPane.setNewItemValidator(isValidRegex); patternsPane.getList().setConverter(ColumnizersController::createPattern, Pattern::pattern, isValidRegex); patternsPane.getList().itemsProperty().bind(patterns); initializeColumnsTable(); }
/** * Tries to renew the {@link #sessionTokenProperty} using the username & password used in the last call to {@link #login(String, String)}. * @return The {@link #loginStatusProperty()}, which can be listened to & indicates when the request has completed * @throws IllegalStateException if no username & password have been saved for future use (i.e. if no successful call to {@link #login(String, String)} has completed before calling this method) */ public ReadOnlyObjectProperty<LoginStatus> renewSession () { if (username == null || password == null) { throw new IllegalStateException("Username & password not set!"); } return login(username, password); }
/** * Sends logged catches to the server * @return A {@link ReadOnlyObjectProperty} which is set to {@link RequestStatus#SUCCESS} if all catches were sent successfully, or to an error if any requests failed. */ public ReadOnlyObjectProperty<RequestStatus> sendCatchesToServer () { ReadOnlyObjectWrapper<RequestStatus> status = new ReadOnlyObjectWrapper<>(); if (loggedCatches.isEmpty()) { //Run the status update later, so the calling method has a chance to register a listener first Platform.runLater(() -> status.set(RequestStatus.SUCCESS)); } else { Platform.runLater(() -> status.set(RequestStatus.PENDING)); IntegerProperty remaining = new SimpleIntegerProperty(loggedCatches.size()); remaining.addListener((obs, oldVal, newVal) -> { if (newVal.intValue() == 0) { status.set(RequestStatus.SUCCESS); } }); for (Pair<Integer, Catch> c : loggedCatches) { networkService.sendLoggedCatch(c.getKey(), c.getValue()).addListener((obs, oldStatus, newStatus) -> { switch (newStatus) { case PENDING: break; case SUCCESS: remaining.set(remaining.get()-1); loggedCatches.remove(c); break; case FAILED_OTHER: LOG.log(Level.WARNING, "Failed to send logged catch "+c+" (server responded with an error code) - removing from cache."); loggedCatches.remove(c); trapline.getTrap(c.getKey()).getCatches().remove(c.getValue()); remaining.set(remaining.get()-1); break; case FAILED_NETWORK: case FAILED_UNAUTHORISED: status.set(newStatus); break; } }); } LOG.log(Level.INFO, "Sent "+loggedCatches.size()+" logged catches to the server."); } return status.getReadOnlyProperty(); }
public ReadOnlyObjectProperty<RequestStatus> sendTrapsToServer () { ReadOnlyObjectWrapper<RequestStatus> status = new ReadOnlyObjectWrapper<>(RequestStatus.PENDING); if (createdTraps.isEmpty()) { //Run the status update later, so the calling method has a chance to register a listener first Platform.runLater(() -> status.set(RequestStatus.SUCCESS)); } else { IntegerProperty remaining = new SimpleIntegerProperty(createdTraps.size()); remaining.addListener((obs, oldVal, newVal) -> { if (newVal.intValue() == 0) { status.set(RequestStatus.SUCCESS); } }); for (Trap t : createdTraps) { networkService.sendCreatedTrap(trapline.getId(), t).addListener((obs, oldStatus, newStatus) -> { switch (newStatus) { case PENDING: break; case SUCCESS: remaining.set(remaining.get()-1); createdTraps.remove(t); break; case FAILED_OTHER: LOG.log(Level.WARNING, "Failed to send created trap "+t+" (server responded with an error code) - removing from cache."); createdTraps.remove(t); trapline.getTraps().remove(t); remaining.set(remaining.get()-1); break; case FAILED_NETWORK: case FAILED_UNAUTHORISED: status.set(newStatus); break; } }); } LOG.log(Level.INFO, "Sent "+createdTraps.size()+" created traps to the server."); } return status.getReadOnlyProperty(); }
@Override public ReadOnlyObjectProperty<RequestStatus> sendLoggedCatch(int trapId, Catch loggedCatch) { RestClient apiClient = RestClient.create().method("POST").host("https://api.nestnz.org") .path("/catch").connectTimeout(TIMEOUT).contentType("application/json"); String logged = loggedCatch.getTimestamp().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); ApiCatch apiCatch = new ApiCatch(trapId, loggedCatch.getCatchType().getId(), loggedCatch.getNote(), logged); return processCreateRequest(ApiCatch.class, apiCatch, apiClient, id -> { LOG.log(Level.INFO, "Successfully logged catch: "+apiCatch); loggedCatch.setId(id); }); }
@Override public ReadOnlyObjectProperty<RequestStatus> sendCreatedTrap(int traplineId, Trap trap) { RestClient apiClient = RestClient.create().method("POST").host("https://api.nestnz.org") .path("/trap").connectTimeout(TIMEOUT).contentType("application/json"); String created = trap.getCreated().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); ApiPostTrap apiTrap = new ApiPostTrap(traplineId, trap.getNumber(), trap.getLatitude(), trap.getLongitude(), created); return processCreateRequest(ApiPostTrap.class, apiTrap, apiClient, id -> { LOG.log(Level.INFO, "Successfully created trap: "+apiTrap); trap.setId(id); }); }
@Override public ReadOnlyObjectProperty<RequestStatus> loadRegions(Consumer<Region> loadCallback) { RestClient regionClient = RestClient.create().method("GET").host("https://api.nestnz.org") .path("/region").connectTimeout(TIMEOUT); return processReadRequest(ApiRegion.class, regionClient, apiRegion -> { Region region = new Region(apiRegion.getId(), apiRegion.getName()); loadCallback.accept(region); }); }
@Override public ReadOnlyObjectProperty<RequestStatus> loadTraplines(Consumer<Trapline> loadCallback) { RestClient traplineClient = RestClient.create().method("GET").host("https://api.nestnz.org") .path("/trapline").connectTimeout(TIMEOUT); return processReadRequest(ApiTrapline.class, traplineClient, apiTrapline -> { Region r = new Region(apiTrapline.getRegionId()); Trapline trapline = new Trapline(apiTrapline.getId(), apiTrapline.getName(), r, apiTrapline.getStart(), apiTrapline.getEnd()); trapline.getCatchTypes().add(new CatchType(apiTrapline.getCommonCatchType1())); trapline.getCatchTypes().add(new CatchType(apiTrapline.getCommonCatchType2())); trapline.getCatchTypes().add(new CatchType(apiTrapline.getCommonCatchType3())); trapline.setCanEdit(apiTrapline.isCanEdit()); loadCallback.accept(trapline); }); }
private void showMainStage(ReadOnlyObjectProperty<ObservableList<String>> friends) { MineIDE.primaryStage = new Stage(StageStyle.DECORATED); Gui main = new GuiMain(); main.init(MineIDE.primaryStage); MineIDE.primaryStage.setMaximized(true); MineIDE.primaryStage.show(); }
/** * Test for javafx.scene.web.WebEngine.documentProperty property getter. * Checks that a non-null object is returned. */ @Test(timeout=10000) public void test1() { Platform.runLater(new Runnable() { public void run() { initWebEngine(); engine.load(getPath(this.getClass(), "resource/example1.html")); prepareWaitPageLoading(); } }); doWaitPageLoading(); ReadOnlyObjectProperty<Document> document = engine.documentProperty(); Assert.assertNotNull(document); }
/** * Test for javafx.scene.web.WebEngine.documentProperty property getter. * Checks that the documentProperty of WebEngine holds the same document as * javafx.scene.web.WebEngine.getDocument() method returns. */ @Test(timeout=10000) @Covers(value="javafx.scene.web.WebEngine.document.GET", level=Covers.Level.FULL) public void test2() { Platform.runLater(new Runnable() { public void run() { initWebEngine(); engine.load(getPath(this.getClass(), "resource/example1.html")); prepareWaitPageLoading(); } }); doWaitPageLoading(); ReadOnlyObjectProperty<Document> document = engine.documentProperty(); Assert.assertEquals(engine.getDocument(), document.get()); }
public final ReadOnlyObjectProperty<LatLong> centerProperty() { if (center == null) { center = new ReadOnlyObjectWrapper<>(getCenter()); addStateEventHandler(MapStateEventType.center_changed, () -> { center.set(getCenter()); }); } return center.getReadOnlyProperty(); }