Package javafx.beans.property

Examples of javafx.beans.property.StringProperty


    if (!encryptResult) {
      this.beanPathAdapter.bindBidirectional(this.modelKey.getKey(),
          tf.textProperty());
    } else {
      try {
        final StringProperty msp = new SimpleStringProperty(
            tf.getText()) {
          @Override
          public void set(final String value) {
            super.set(value);
            if (value == null || value.isEmpty()) {
              tf.setText(value);
              return;
            }
            encrypt = false;
            try {
              final String clearText = getEncryptionProvider()
                  .decrypt(value);
              tf.setText(clearText);
            } catch (final Throwable t) {
              throw new RuntimeException("Unable to decrypt", t);
            } finally {
              encrypt = true;
            }
          }
        };
        this.beanPathAdapter.bindBidirectional(this.modelKey.getKey(),
            msp);
        tf.focusedProperty().addListener(new ChangeListener<Boolean>() {
          private String ltv = tf.getText();
          @Override
          public void changed(
              final ObservableValue<? extends Boolean> observable,
              final Boolean oldValue, final Boolean newValue) {
            if (encrypt && (newValue == null || !newValue)
                && tf.getText() != null
                && !tf.getText().isEmpty()
                && !tf.getText().equals(ltv)) {
              try {
                final String encrypted = getEncryptionProvider()
                    .encrypt(tf.getText());
                ltv = tf.getText();
                msp.set(encrypted);
              } catch (final Throwable t) {
                throw new RuntimeException("Unable to encrypt",
                    t);
              }
            }
View Full Code Here


    @Before
    public void init() {
        this.cut = new MonitoringLevelActivation();
        this.cut.init();
        this.cut.model = mock(DashboardModel.class);
        StringProperty property = new SimpleStringProperty("http://localhost:8080/lightfish");
        when(this.cut.model.serverUriProperty()).thenReturn(property);
    }
View Full Code Here

    @Before
    public void init() {
        this.cut = new PollingSetup();
        this.cut.init();
        this.cut.model = mock(DashboardModel.class);
        StringProperty property = new SimpleStringProperty("http://localhost:8080/lightfish");
        when(this.cut.model.serverUriProperty()).thenReturn(property);
    }
View Full Code Here

    @Before
    public void init() {
        this.cut = new EJBPoolMonitoring();
        this.cut.init();
        this.cut.model = mock(DashboardModel.class);
        StringProperty property = new SimpleStringProperty("http://localhost:8080/lightfish");
        when(this.cut.model.serverUriProperty()).thenReturn(property);
    }
View Full Code Here

    public void init() {
        this.blockSupport = new CountDownLatch(1);
        this.cut = new MethodMonitoring();
        this.cut.init();
        this.cut.model = mock(DashboardModel.class);
        StringProperty property = new SimpleStringProperty("http://localhost:8080/lightfish");
        when(this.cut.model.serverUriProperty()).thenReturn(property);
    }
View Full Code Here

    }

    @Override
    protected void bind(FXFormNode fxFormNode) {
        final Adapter adapter = getFxForm().getAdapterProvider().getAdapter(StringProperty.class, getNode().getProperty().getClass(), getElement(), getNode());
        final StringProperty value = getFxForm().getResourceProvider().getString(getElement(), nodeType);
        fxFormNode.getProperty().bind(new ObjectBinding() {
            @Override
            protected Object computeValue() {
                {
                    bind(value);
                }

                try {
                    return adapter.adaptTo(value.get());
                } catch (AdapterException e) {
                    logger.log(Level.WARNING, e.getMessage(), e);
                }
                return null;
            }
View Full Code Here

    }
   
    public boolean restoreSession(Map<Location, Tile> gameGrid) {
        doClearGame();
        timer.stop();
        StringProperty sTime=new SimpleStringProperty("");
        int score = sessionManager.restoreSession(gameGrid, sTime);
        if (score >= 0) {
            gameScoreProperty.set(score);
            // check tiles>=2048
            gameWonProperty.set(false);
            gameGrid.forEach((l,t)->{
               if(t!=null && t.getValue()>=GameManager.FINAL_VALUE_TO_WIN){
                   gameWonProperty.removeListener(wonListener);
                   gameWonProperty.set(true);
                   gameWonProperty.addListener(wonListener);
               }
            });
            if(!sTime.get().isEmpty()){
                time = LocalTime.now().minusNanos(new Long(sTime.get()));
            }
            timer.play();
            return true;
        }
        // not session found, restart again
View Full Code Here

@RunWith(ScriptRunner.class)
public class BindingTest {

    @Test
    public void bindBidirectional() throws Exception {
        StringProperty property1 = new SimpleStringProperty("value1");
        StringProperty property2 = new SimpleStringProperty("value2");
        assert property1.get().equals("value1");
        assert property2.get().equals("value2");

        property2.set("change value2");
        assert property1.get().equals("value1");
        assert property2.get().equals("change value2");

        // bind
        property1.bindBidirectional(property2);
        assert property1.get().equals("change value2");
        assert property2.get().equals("change value2");

        property2.set("change from property2");
        assert property1.get().equals("change from property2");
        assert property2.get().equals("change from property2");

        property1.set("change from property1");
        assert property1.get().equals("change from property1");
        assert property2.get().equals("change from property1");
    }
View Full Code Here

TOP

Related Classes of javafx.beans.property.StringProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.