Java 类javafx.beans.property.adapter.JavaBeanStringPropertyBuilder 实例源码

项目:subshare    文件:ServerPane.java   
@SuppressWarnings("unchecked")
public ServerPane(final ServerData serverData) {
    this.serverData = assertNotNull(serverData, "serverData");
    this.server = assertNotNull(serverData.getServer(), "serverData.server");
    loadDynamicComponentFxml(ServerPane.class, this);

    try {
        url = JavaBeanObjectPropertyBuilder.create().bean(server).name(Server.PropertyEnum.url.name()).build();
        name = JavaBeanStringPropertyBuilder.create().bean(server).name(Server.PropertyEnum.name.name()).build();
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    urlTextField.textProperty().bindBidirectional(url, new UrlStringConverter());
    nameTextField.textProperty().bindBidirectional(name);

    acceptInvitationCheckBox.selectedProperty().bindBidirectional(serverData.acceptInvitationProperty());
    nameLabel.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());
    nameTextField.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());
    urlLabel.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());
    urlTextField.disableProperty().bind(acceptInvitationCheckBox.selectedProperty());

    addWeakPropertyChangeListener(server, Server.PropertyEnum.url, updateCompletePropertyChangeListener);
    serverData.acceptInvitationProperty().addListener(new WeakInvalidationListener(updateCompleteInvalidationListener));
    updateComplete();
}
项目:subshare    文件:ServerListItem.java   
@SuppressWarnings("unchecked")
public ServerListItem(final Server server) {
    this.server = assertNotNull(server, "server");
    try {
        name = JavaBeanStringPropertyBuilder.create()
                .bean(server)
                .name(Server.PropertyEnum.name.name()).build();

        url = JavaBeanObjectPropertyBuilder.create()
                .bean(server)
                .name(Server.PropertyEnum.url.name()).build();
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    updateSeverity();
}
项目:subshare    文件:LocalRepoListItem.java   
@SuppressWarnings("unchecked")
private void bind() {
    try {
        name = JavaBeanStringPropertyBuilder.create()
                .bean(localRepo)
                .name(LocalRepo.PropertyEnum.name.name()).build();

        localRoot = JavaBeanObjectPropertyBuilder.create()
                .bean(localRepo)
                .name(LocalRepo.PropertyEnum.localRoot.name()).build();
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
    name.addListener((InvalidationListener) observable -> updateNameShown());
    localRootAsString.bind(localRoot.asString());
}
项目:photo-flow    文件:PhotoFlowController.java   
/**
 * @param bean
 * @param propertyName
 * @return {@link JavaBeanStringProperty}
 */
protected static JavaBeanStringProperty stringProperty(Object bean, String propertyName) {
    Object key = key(bean, propertyName);
    if (STRING_PROPERTIES.containsKey(key)) {
        return STRING_PROPERTIES.get(key);
    }
    try {
        JavaBeanStringProperty property = JavaBeanStringPropertyBuilder.create().bean(bean).name(propertyName).build();
        STRING_PROPERTIES.put(key, property);
        return property;
    } catch (NoSuchMethodException e) {
        throw new IllegalStateException(e);
    }
}
项目:subshare    文件:LocalRepoPane.java   
@SuppressWarnings("unchecked")
private void bind() {
    try {
        // nameProperty must be kept as field to prevent garbage-collection!
        nameProperty = JavaBeanStringPropertyBuilder.create()
                .bean(localRepo)
                .name(LocalRepo.PropertyEnum.name.name())
                .build();
        nameTextField.textProperty().bindBidirectional(nameProperty);

        localRootProperty = JavaBeanObjectPropertyBuilder.create()
                .bean(localRepo)
                .name(LocalRepo.PropertyEnum.localRoot.name())
                .build();

        Bindings.bindBidirectional(localRootTextField.textProperty(), localRootProperty, new FileStringConverter());

    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }

    syncPeriodCheckBox.selectedProperty().addListener((InvalidationListener) observable -> updateSyncPeriodInConfig());
    syncPeriodTimePeriodTextField.timePeriodProperty().addListener((InvalidationListener) observable -> updateSyncPeriodInConfig());

    addWeakPropertyChangeListener(repoSyncDaemon, RepoSyncDaemon.PropertyEnum.activities, activityPropertyChangeListener);
    addWeakPropertyChangeListener(repoSyncDaemon, RepoSyncDaemon.PropertyEnum.states, statePropertyChangeListener);
    addWeakPropertyChangeListener(repoSyncTimer, RepoSyncTimer.PropertyEnum.nextSyncTimestamps, nextSyncPropertyChangeListener);
}
项目:subshare    文件:UserPane.java   
public UserPane(final EditUserManager editUserManager, final User user) {
    this.editUserManager = assertNotNull(editUserManager, "editUserManager");
    this.user = assertNotNull(user, "user");
    loadDynamicComponentFxml(UserPane.class, this);

    try {
        firstNameProperty = JavaBeanStringPropertyBuilder.create()
                .bean(user)
                .name(User.PropertyEnum.firstName.name())
                .build();
        firstNameTextField.textProperty().bindBidirectional(firstNameProperty);

        lastNameProperty = JavaBeanStringPropertyBuilder.create()
                .bean(user)
                .name(User.PropertyEnum.lastName.name())
                .build();
        lastNameTextField.textProperty().bindBidirectional(lastNameProperty);

        addWeakPropertyChangeListener(this.user, User.PropertyEnum.emails, userEmailsPropertyChangeListener);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }

    emailWrappers = FXCollections.observableList(createEmailWrapperList());
    emailWrappers.addListener((ListChangeListener<EmailWrapper>) c -> updateEmails());

    emailsTableView.setItems(emailWrappers);
    emailTableColumn.setCellFactory(cast(TextFieldTableCell.forTableColumn()));

    emailTableColumn.prefWidthProperty().bind(emailsTableView.widthProperty().subtract(10)); // TODO we should find out the scroll-bar-width and subtract this!

    final UserRootPgpKeyTreeItem root = new UserRootPgpKeyTreeItem(pgpKeyTreePane, user);
    pgpKeyTreePane.getTreeTableView().setRoot(root);
    pgpKeyTreePane.getTreeTableView().getSelectionModel().getSelectedItems().addListener((InvalidationListener) observable -> updateDisable());
    updateDisable();
}
项目:subshare    文件:ServerRepoListItem.java   
public ServerRepoListItem(final ServerRepo serverRepo) {
    this.serverRepo = assertNotNull(serverRepo, "serverRepo");
    try {
        nameProperty = JavaBeanStringPropertyBuilder.create()
                .bean(serverRepo)
                .name(ServerRepo.PropertyEnum.name.name())
                .build();
    } catch (final NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
}
项目:subshare    文件:ServerListItem.java   
public ServerListItem(final Server server) {
    this.server = assertNotNull(server, "server");
    try {
        name = JavaBeanStringPropertyBuilder.create()
                .bean(server)
                .name(Server.PropertyEnum.name.name()).build();

        url = JavaBeanObjectPropertyBuilder.create()
                .bean(server)
                .name(Server.PropertyEnum.url.name()).build();
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
}
项目:subshare    文件:FxPgpUserId.java   
public synchronized StringProperty nameProperty() {
    if (nameProperty == null) {
        try {
            nameProperty = JavaBeanStringPropertyBuilder.create().bean(this).name(PropertyEnum.name.name()).build();
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
    return nameProperty;
}
项目:subshare    文件:FxPgpUserId.java   
public synchronized StringProperty emailProperty() {
    if (emailProperty == null) {
        try {
            emailProperty = JavaBeanStringPropertyBuilder.create().bean(this).name(PropertyEnum.email.name()).build();
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
    return emailProperty;
}
项目:subshare    文件:ServerRepoPane.java   
public ServerRepoPane(final Server server, final ServerRepo serverRepo) {
    this.server = assertNotNull(server, "server");
    this.serverRepo = assertNotNull(serverRepo, "serverRepo");
    loadDynamicComponentFxml(ServerRepoPane.class, this);

    try {
        nameProperty = new JavaBeanStringPropertyBuilder().bean(serverRepo).name(ServerRepo.PropertyEnum.name.name()).build();
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e);
    }

    nameTextField.textProperty().bindBidirectional(nameProperty);
}
项目:Omoikane    文件:ItemCompraEntityWrapper.java   
public ItemCompraEntityWrapper(ItemCompra itemCompra) {
    _itemCompra = itemCompra;

    try {
        JavaBeanStringPropertyBuilder builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemCompra);
        builder.name("codigo");
        codigo = builder.build();

        builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemCompra);
        builder.name("nombre");
        nombre = builder.build();

        JavaBeanObjectPropertyBuilder<BigDecimal> builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemCompra);
        builder1.name("cantidad");
        cantidad = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemCompra);
        builder1.name("costoUnitario");
        costoUnitario = builder1.build();

        importe = new SimpleObjectProperty<BigDecimal>();
        importe.set( new BigDecimal(0) );

        JavaBeanObjectPropertyBuilder<Articulo> builder2 = JavaBeanObjectPropertyBuilder.create();
        builder2.bean(itemCompra);
        builder2.name("articulo");
        articulo = builder2.build();

    } catch (NoSuchMethodException e) {
        logger.error("Invalid method to wrap", e);
    }
}
项目:lawless-legends    文件:PropertyHelper.java   
public static JavaBeanStringProperty stringProp(Object t, String fieldName) throws NoSuchMethodException {
    return new JavaBeanStringPropertyBuilder().bean(t).name(fieldName).build();
}
项目:Omoikane    文件:ItemTraspasoPropWrapper.java   
public ItemTraspasoPropWrapper(ItemTraspasoSaliente itemConteo) {
    _itemConteo = itemConteo;

    try {
        JavaBeanStringPropertyBuilder builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemConteo);
        builder.name("codigo");
        codigo = builder.build();

        builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemConteo);
        builder.name("nombre");
        nombre = builder.build();

        JavaBeanObjectPropertyBuilder<BigDecimal> builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("cantidad");
        cantidad = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("stockDB");
        stockDB = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("costoUnitario");
        costoUnitario = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("precioPublico");
        precioPublico = builder1.build();

        JavaBeanObjectPropertyBuilder<Articulo> builder2 = JavaBeanObjectPropertyBuilder.create();
        builder2.bean(itemConteo);
        builder2.name("articulo");
        articulo = builder2.build();
    } catch (NoSuchMethodException e) {
        logger.error("Invalid method to wrap", e);
    }
}
项目:Omoikane    文件:ItemConteoPropWrapper.java   
public ItemConteoPropWrapper(ItemConteoInventario itemConteo) {
    _itemConteo = itemConteo;

    try {
        JavaBeanStringPropertyBuilder builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemConteo);
        builder.name("codigo");
        codigo = builder.build();

        builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemConteo);
        builder.name("nombre");
        nombre = builder.build();

        JavaBeanObjectPropertyBuilder<BigDecimal> builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("conteo");
        conteo = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("stockDB");
        stockDB = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("costoUnitario");
        costoUnitario = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("diferencia");
        diferencia = builder1.build();

        JavaBeanObjectPropertyBuilder<Articulo> builder2 = JavaBeanObjectPropertyBuilder.create();
        builder2.bean(itemConteo);
        builder2.name("articulo");
        articulo = builder2.build();
    } catch (NoSuchMethodException e) {
        logger.error("Invalid method to wrap", e);
    }
}
项目:Omoikane    文件:ItemTraspasoPropWrapper.java   
public ItemTraspasoPropWrapper(ItemTraspasoEntrante itemConteo) {
    _itemConteo = itemConteo;

    try {
        JavaBeanStringPropertyBuilder builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemConteo);
        builder.name("codigo");
        codigo = builder.build();

        builder = JavaBeanStringPropertyBuilder.create();
        builder.bean(itemConteo);
        builder.name("nombre");
        nombre = builder.build();

        JavaBeanObjectPropertyBuilder<BigDecimal> builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("cantidad");
        cantidad = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("stockDB");
        stockDB = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("costoUnitario");
        costoUnitario = builder1.build();

        builder1 = JavaBeanObjectPropertyBuilder.create();
        builder1.bean(itemConteo);
        builder1.name("precioPublico");
        precioPublico = builder1.build();

        JavaBeanObjectPropertyBuilder<Articulo> builder2 = JavaBeanObjectPropertyBuilder.create();
        builder2.bean(itemConteo);
        builder2.name("articulo");
        articulo = builder2.build();
    } catch (NoSuchMethodException e) {
        logger.error("Invalid method to wrap", e);
    }
}
项目:cayenne-modeler    文件:CayennePropertyAdapter.java   
/**
 * Binds a Java/Bean String property to a JavaFX property. Note: The JavaFX
 * property observes changes and marks the Cayenne project dirty when a
 * change occurs.
 *
 * @param property
 *            The Java/Bean property to bind to.
 * @return A new JavaFX property bound to the Java/Bean property.
 * @throws NoSuchMethodException
 *             If the specified Java/Bean property does not exist (check the
 *             property's spelling).
 */
public StringProperty bindString(String property) throws NoSuchMethodException
{
    return observePropertyChanges(JavaBeanStringPropertyBuilder.create().bean(getWrappedObject()).name(property).build());
}
项目:CMP    文件:CayennePropertyAdapter.java   
/**
 * Binds a Java/Bean String property to a JavaFX property. Note: The JavaFX
 * property observes changes and marks the Cayenne project dirty when a
 * change occurs.
 *
 * @param property
 *            The Java/Bean property to bind to.
 * @return A new JavaFX property bound to the Java/Bean property.
 * @throws NoSuchMethodException
 *             If the specified Java/Bean property does not exist (check the
 *             property's spelling).
 */
public StringProperty bindString(String property) throws NoSuchMethodException
{
    return observePropertyChanges(JavaBeanStringPropertyBuilder.create().bean(getWrappedObject()).name(property).build());
}