public final ReadOnlyObjectProperty<TextField> editorProperty() { if (editor == null) { editor = new ReadOnlyObjectWrapper<>(this, "editor"); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); } return editor.getReadOnlyProperty(); }
@Override public ValidatorBase getActiveValidator() { return activeValidator == null ? null : activeValidator.get(); }
private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); try { editorProperty(); Field editorField = DatePicker.class.getDeclaredField("editor"); editorField.setAccessible(true); ReadOnlyObjectWrapper<TextField> editor = (ReadOnlyObjectWrapper<TextField>) editorField.get(this); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } }
@Override public ReadOnlyObjectProperty<ValidatorBase> activeValidatorProperty() { return this.activeValidator.getReadOnlyProperty(); }
public <T extends Node> T start(FlowContainer<T> container) throws FlowException { containerWrapper.set(container); flowContextWrapper.get().register(this); if (viewConfiguration != null) { flowContextWrapper.get().register(ResourceBundle.class.toString(), viewConfiguration.getResources()); } try { FlowView<?> startView = new FlowView(ViewFactory.getInstance().createByController(flowWrapper.get().getStartViewControllerClass(), null, getViewConfiguration(), flowContextWrapper.get())); setNewView(startView, false); } catch (FxmlLoadException e) { throw new FlowException(e); } return container.getView(); }
/** Location: TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT */ public ReadOnlyObjectProperty<Location> locationProperty() { return new ReadOnlyObjectWrapper<Location>(this, "location").getReadOnlyProperty(); } final private SimpleObjectProperty<Location> locationObjectProperty = new SimpleObjectProperty<Location>(this, "location", Location.TOP_LEFT);
public void resetValidation() { control.pseudoClassStateChanged(ValidatorBase.PSEUDO_CLASS_ERROR, false); activeValidator.set(null); } }
public FlowHandler(Flow flow, ViewFlowContext flowContext, ViewConfiguration viewConfiguration, ExceptionHandler exceptionHandler) { this.flowWrapper = new ReadOnlyObjectWrapper<>(flow); this.viewConfiguration = viewConfiguration; this.exceptionHandler = exceptionHandler; controllerHistory = FXCollections.observableArrayList(); currentViewWrapper = new ReadOnlyObjectWrapper<>(); containerWrapper = new ReadOnlyObjectWrapper<>(); flowContextWrapper = new ReadOnlyObjectWrapper<>(flowContext); currentViewMetadataWrapper = new ReadOnlyObjectWrapper<>(); flowContextWrapper.get().currentViewContextProperty().addListener((e) -> currentViewMetadataWrapper.set(flowContextWrapper.get().getCurrentViewContext().getMetadata())); flowContextWrapper.get().register(new FlowActionHandler(this)); }
/** * @param param tree item * @return the data represented by the tree item */ public final ObservableValue<T> getComputedValue(CellDataFeatures<S, T> param) { Object rowObject = param.getValue().getValue(); if (rowObject instanceof RecursiveTreeObject) { RecursiveTreeObject<?> item = (RecursiveTreeObject<?>) rowObject; if (item.getGroupedColumn() == this) { return new ReadOnlyObjectWrapper(item.getGroupedValue()); } } return null; }
public ReadOnlyObjectProperty<ValidatorBase> activeValidatorProperty() { return this.activeValidator.getReadOnlyProperty(); }
public <U> ViewContext<U> setNewView(FlowView<U> newView, boolean addOldToHistory) throws FlowException { if (getCurrentView() != null && addOldToHistory) { ViewHistoryDefinition<?> historyDefinition = new ViewHistoryDefinition(getCurrentView().getViewContext().getController().getClass(), "", null); controllerHistory.add(0, historyDefinition); } flowWrapper.get().addActionsToView(newView); FlowView<?> oldView = getCurrentView(); if (oldView != null) { ViewContext<?> lastViewContext = oldView.getViewContext(); if (lastViewContext != null) { try { lastViewContext.destroy(); } catch (Exception e) { throw new FlowException( "Last ViewContext can't be destroyed!", e); } } } currentViewWrapper.set(newView); flowContextWrapper.get().setCurrentViewContext(getCurrentView().getViewContext()); containerWrapper.get().setViewContext(getCurrentView().getViewContext()); return newView.getViewContext(); }
@Override public ReadOnlyObjectProperty<Long> fileSizeProperty() { if (this.fileSize == null) { try { this.fileSize = new ReadOnlyObjectWrapper<>(this, "fileSize", Long.valueOf(Files.size(this.path)));//$NON-NLS-1$ } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return this.fileSize.getReadOnlyProperty(); } }
public static void reset(Control control) { ValidationFacade facade = (ValidationFacade) control.getParent(); control.pseudoClassStateChanged(PSEUDO_CLASS_ERROR, false); facade.activeValidator.set(null); }
@Override public ObservableValue<File> getObservableValue(SelectionTableRowData data) { return new ReadOnlyObjectWrapper<>(data.descriptor().getFile()); }
private void initialize() { this.getStyleClass().add(DEFAULT_STYLE_CLASS); editorProperty(); ReadOnlyObjectWrapper<TextField> editor = ReflectionHelper.getFieldContent(DatePicker.class, this, "editor" ); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); }
@Deprecated public ReadOnlyObjectProperty<Integer> overAllIndexProperty() { return overAllIndexProperty.getReadOnlyProperty(); }
private Tab createColorTab() { Tab t = new Tab(); t.setText(Messages.getString("PaintEditor.Color")); //$NON-NLS-1$ GridLayoutPane p = new GridLayoutPane(); p.setNumColumns(3); Rectangle solidPreview = new Rectangle(PREVIEW_SIZE, PREVIEW_SIZE); this.solidPreview = solidPreview; GridLayoutPane dataPane = new GridLayoutPane(); dataPane.setNumColumns(2); ColorPicker picker = new ColorPicker(); picker.valueProperty().addListener((o) -> { solidPreview.setFill(picker.getValue()); this.paint.set(picker.getValue()); }); dataPane.getChildren().addAll(new Label(Messages.getString("PaintEditor.Color")), picker); //$NON-NLS-1$ Color color = (Color) this.paint.get(); if (color instanceof Color) { picker.setValue(color); } TitledPane dtp = new TitledPane(Messages.getString("PaintEditor.Data"), dataPane); //$NON-NLS-1$ dtp.setCollapsible(false); TitledPane pane = new TitledPane(Messages.getString("PaintEditor.Preview"), solidPreview); //$NON-NLS-1$ pane.setCollapsible(false); GridLayoutPane.setConstraint(dtp, new GridData(Alignment.FILL, Alignment.FILL, true, true)); GridLayoutPane.setConstraint(pane, new GridData(Alignment.BEGINNING, Alignment.BEGINNING, false, false)); p.getChildren().addAll(pane, dtp); t.setContent(p); return t; }
@Override public ReadOnlyObjectProperty<Long> fileSizeProperty() { if (this.fileSize == null) { try { this.fileSize = new ReadOnlyObjectWrapper<>(this, "fileSize", Long.valueOf(Files.size(this.path)));//$NON-NLS-1$ } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return this.fileSize.getReadOnlyProperty(); } }
public final ReadOnlyObjectProperty<TextField> editorProperty() { if (editor == null) { editor = new ReadOnlyObjectWrapper<>(this, "editor"); final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField(); this.focusedProperty().addListener((obj, oldVal, newVal) -> { if (getEditor() != null) { editorNode.setFakeFocus(newVal); } }); editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty()); editor.set(editorNode); } return editor.getReadOnlyProperty(); }
/** * validates the text value using the list of validators provided by the user * {{@link #setValidators(ValidatorBase...)} * * @return true if the value is valid else false */ @Override public boolean validate() { for (ValidatorBase validator : validators) { // source control must be set to allow validators re-usability validator.setSrcControl(control); validator.validate(); if (validator.getHasErrors()) { activeValidator.set(validator); return false; } } activeValidator.set(null); return true; }