private void handlePrimaryClick() {
    final int currentClicks = ++clicks;
    manager.submitTask(() -> manager.findReferingNodes(node, false));

    if (isExpanded.get()) {
      getMaterial().setDiffuseMap(Resources.SPINNER);
      manager.submitTask(
          () ->
              manager.collapseNode(
                  node,
                  () -> {
                    if (clicks == currentClicks) collapseNodeCallback();
                  }));
    } else {
      getMaterial().setDiffuseMap(Resources.SPINNER);
      manager.submitTask(
          () ->
              manager.expandNode(
                  node,
                  () -> {
                    if (clicks == currentClicks) expandNodeCallback();
                  }));
    }
    isExpanded.setValue(!isExpanded.get());
  }
Example #2
0
  /**
   * @param variableName
   *     <p>Creates ComponentsForOutputVariable entry for specified variableName by invoking
   *     overridable methods and overridden abstract method createOutputVariableInputNode().
   *     <p>Note that while implementations of createOutputVariableInputNode() may include
   *     references to the Label and other properties, createOutputVariableInputNodeLabel() may not
   *     refer to any of these, as they will not exist until the Label has already been created and
   *     the respective ComponentsForOutputVariable has been put into the
   *     componentsForOutputVariables map
   *     <p>This method is final because the order of its operations is significant
   */
  protected final void addOutputVariable(String variableName) {
    Label newLabel = createOutputVariableInputNodeLabel(variableName);
    ComponentsForOutputVariable componentsForOutputVariable =
        new ComponentsForOutputVariable(variableName, newLabel);
    componentsForOutputVariables.put(variableName, componentsForOutputVariable);

    BooleanProperty variableStatusProperty = getOutputVariableStatusProperty(variableName);
    variableStatusProperty.addListener(
        new ChangeListener<Boolean>() {
          @Override
          public void changed(
              ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue != null && newValue) {
              newLabel.setStyle("-fx-text-fill: -fx-text-base-color;");
              if (areOutputVariablesSavable()) {
                getOutputVariablesSavableProperty().set(true);
              }
              if (isSavable()) {
                getIsSavableProperty().set(true);
              }
            } else {
              newLabel.setStyle("-fx-text-fill: red;");
              getOutputVariablesSavableProperty().set(false);
              getIsSavableProperty().set(false);
            }
          }
        });

    Node newNode = getOrCreateOutputVariableInputNode(variableName);
    componentsForOutputVariable.setInputNode(newNode);
  }
Example #3
0
 public void bind(final BooleanProperty property, final String propertyName) {
   String value = props.getProperty(propertyName);
   if (value != null) {
     property.set(Boolean.valueOf(value));
   }
   property.addListener(
       o -> {
         props.setProperty(propertyName, property.getValue().toString());
       });
 }
Example #4
0
 public void refreshPreview() {
   XHTMLCodeEditor xhtmlCodeEditor = (XHTMLCodeEditor) currentEditor.getValue();
   if (xhtmlCodeEditor != null && currentXHTMLResource.get() != null) {
     try {
       currentXHTMLResource.get().setData(xhtmlCodeEditor.getCode().getBytes("UTF-8"));
     } catch (UnsupportedEncodingException e) {
       // never happens
     }
     needsRefresh.setValue(true);
     needsRefresh.setValue(false);
   }
 }
 @Override
 public String toString() {
   StringBuilder builder = new StringBuilder();
   builder.append(_Visibility.getValue()).append(" ");
   if (_IsFinal.getValue()) builder.append("final").append(" ");
   if (_IsStatic.getValue()) builder.append("static ");
   builder.append(_Type.getValue()).append(" ");
   builder.append(_Name.getValue()).append(" ");
   builder.append(" = ").append(_DefaultValue.getValue());
   builder.append("\n");
   builder.append("annotations:\n");
   for (StringProperty str : _Annotations) builder.append(str).append("\n");
   builder.append("\n");
   return builder.toString();
 }
 public final void setHighlightsVisible(final boolean HIGHLIGHTS_VISIBLE) {
   if (null == highlightsVisible) {
     _highlightsVisible = HIGHLIGHTS_VISIBLE;
   } else {
     highlightsVisible.set(HIGHLIGHTS_VISIBLE);
   }
 }
 public final void setGlowEnabled(final boolean GLOW_ENABLED) {
   if (null == glowEnabled) {
     _glowEnabled = GLOW_ENABLED;
   } else {
     glowEnabled.set(GLOW_ENABLED);
   }
 }
 public final void setBackgroundVisible(final boolean BACKGROUND_VISIBLE) {
   if (null == backgroundVisible) {
     _backgroundVisible = BACKGROUND_VISIBLE;
   } else {
     backgroundVisible.set(BACKGROUND_VISIBLE);
   }
 }
Example #9
0
  private void initPendingTrades() {
    if (firstPeerAuthenticatedListener != null)
      p2PService.removeP2PServiceListener(firstPeerAuthenticatedListener);

    List<Trade> failedTrades = new ArrayList<>();
    for (Trade trade : trades) {
      // We continue an interrupted trade.
      // TODO if the peer has changed its IP address, we need to make another findPeer request. At
      // the moment we use the peer stored in trade to
      // continue the trade, but that might fail.

      // TODO
      /* if (trade.isFailedState()) {
          failedTrades.add(trade);
      }
      else {*/
      trade.setStorage(tradableListStorage);
      trade.updateDepositTxFromWallet(tradeWalletService);
      initTrade(trade);

      // after we are authenticated we remove mailbox messages.
      DecryptedMsgWithPubKey mailboxMessage = trade.getMailboxMessage();
      if (mailboxMessage != null) {
        log.trace("initPendingTrades/removeEntryFromMailbox mailboxMessage = " + mailboxMessage);
        p2PService.removeEntryFromMailbox(mailboxMessage);
        trade.setMailboxMessage(null);
      }
      // }
    }
    pendingTradesInitialized.set(true);

    failedTrades.stream().filter(Trade::isTakerFeePaid).forEach(this::addTradeToFailedTrades);
  }
 @SuppressWarnings("deprecation")
 private void initialize() {
   ConfidenceProgressIndicator control = getSkinnable();
   boolean isIndeterminate = control.isIndeterminate();
   if (isIndeterminate) {
     // clean up determinateIndicator
     determinateIndicator = null;
     // create spinner
     spinner = new IndeterminateSpinner(control, this, spinEnabled.get(), progressColor.get());
     getChildren().clear();
     getChildren().add(spinner);
     if (getSkinnable().impl_isTreeVisible()) {}
   } else {
     // clean up after spinner
     if (spinner != null) {
       spinner = null;
     }
     // create determinateIndicator
     determinateIndicator =
         new ConfidenceProgressIndicatorSkin.DeterminateIndicator(
             control, this, progressColor.get());
     getChildren().clear();
     getChildren().add(determinateIndicator);
   }
 }
Example #11
0
 @Override
 public void messagePosted(final Message event) {
   Platform.runLater(
       () -> {
         switch (event.getEvent()) {
           case FILE_LOAD_SUCCESS:
             disabled.setValue(false);
             break;
           case FILE_CLOSING:
             closeAllWindows();
             disabled.setValue(true);
             break;
           default:
             break;
         }
       });
 }
 @Override
 public String toString() {
   return "LuceneSearchTypeFilter [searchParameter="
       + searchParameter.get()
       + ", isValid="
       + isValid.get()
       + "]";
 }
  @Override
  public void changed(
      ObservableValue<? extends List<BindingViolation>> observable,
      List<BindingViolation> oldValue,
      List<BindingViolation> newValue) {

    List<BindingViolation> allViolations = new ArrayList<BindingViolation>();

    for (Binding<?, ?> oneBinding : bindings) {
      allViolations.addAll(oneBinding.targetConstraintViolationsProperty().getValue());
    }

    allConstraintViolations.setValue(Collections.unmodifiableList(allViolations));
    isValidProperty.set(allViolations.isEmpty());

    System.out.println("BindingContext#isValid(): " + isValidProperty.getValue());
  }
Example #14
0
 public KeyButtonEventHandler() {
   this.keyEventHandler =
       (e) -> {
         if (enabledProperty.get()) {
           sendKeyEvents(e);
           e.consume();
         }
       };
 }
Example #15
0
 private void registerStatements() {
   // FIXME this is registered multiple times
   try {
     database.get().createPreparedStatement(statementObject, statementFormat);
     alive.set(true);
   } catch (final Throwable t) {
     t.printStackTrace();
   }
 }
 /**
  * Creates a new ExerciseFilter domain object from the edited JavaFX properties.
  *
  * @return ExerciseFilter
  */
 public ExerciseFilter getExerciseFilter() {
   final ExerciseFilter exerciseFilter = new ExerciseFilter();
   exerciseFilter.setDateStart(dateStart.get());
   exerciseFilter.setDateEnd(dateEnd.get());
   exerciseFilter.setSportType(sportType.get());
   exerciseFilter.setSportSubType(sportSubtype.get());
   exerciseFilter.setIntensity(intensity.get().intensityType);
   exerciseFilter.setEquipment(equipment.get());
   exerciseFilter.setCommentSubString(StringUtils.getTrimmedTextOrNull(commentSubString.get()));
   exerciseFilter.setRegularExpressionMode(regularExpressionMode.get());
   return exerciseFilter;
 }
Example #17
0
  private void createStatusBar() {
    statusBar = new StatusBar();
    statusBar.setText("Alerts");

    Button alertsButton = new Button();
    alertsButton.textProperty().bind(numberOfAlerts);
    alertsButton.setBackground(
        new Background(new BackgroundFill(Color.ORANGE, new CornerRadii(2), new Insets(4))));
    alertsButton.setOnAction(
        event -> {
          isDetailNodeVisible.setValue(true);
          detailPane.getSelectionModel().select(0);
        });

    statusBar.getLeftItems().add(alertsButton);
    statusBar.progressProperty().bind(webEngine.getLoadWorker().progressProperty());
  }
Example #18
0
    //		Validator getValidator() { return validator; }
    void setValidator(Validator v) {
      if (valuePropertyListener != null) {
        valueProperty.removeListener(valuePropertyListener);
      }
      validator = v;

      if (validator != null) {
        valueProperty.addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  ObservableValue<? extends String> observable, String oldValue, String newValue) {
                statusProperty.set(validator.isValid());
              }
            });
        statusProperty.set(validator.isValid());
      }
    }
Example #19
0
 @FXML
 private void initialize() {
   initMenu();
   strokes.setCellFactory(param -> new ModelCell<>(lang));
   strokes
       .getSelectionModel()
       .selectedItemProperty()
       .addListener((observable, oldValue, newValue) -> onSelect(newValue));
   isSelected.bind(strokes.getSelectionModel().selectedItemProperty().isNotNull());
   search
       .textProperty()
       .addListener(
           observable -> {
             if (search.getText() == null || search.getText().isEmpty()) {
               allStrokes.setPredicate(set -> true);
             } else {
               allStrokes.setPredicate(
                   set ->
                       set.uiString(lang).toLowerCase().contains(search.getText().toLowerCase()));
             }
           });
   populate();
 }
 public NameDialog(final Stage stg, Maze maze) {
   width = 350;
   height = 80;
   this.maze = maze;
   stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initOwner(stg);
   stage.setTitle("Name:Press Enter Confirmed");
   Group root = new Group();
   AnchorPane anchorPane = new AnchorPane();
   okbtn = new Button("确定");
   field = new TextField();
   field.setFont(new Font(30));
   field.setPrefWidth(width);
   field.setPrefHeight(height);
   property.set(false);
   MyEvent myEvent = new MyEvent();
   field.setOnKeyPressed(
       new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent event) {
           if (event.getCode() == KeyCode.ENTER) {
             maze.handleEvent(field.getText());
             stage.close();
           }
         }
       });
   okbtn.setOnMouseClicked(myEvent);
   Scene scene = new Scene(root, width, height + 20);
   anchorPane.getChildren().add(field);
   okbtn.setLayoutX(0);
   okbtn.setLayoutY(height);
   anchorPane.getChildren().add(okbtn);
   root.getChildren().add(anchorPane);
   stage.setScene(scene);
   stage.show();
 }
Example #21
0
  private Conf() {

    confDoc = DBUtils.getConfDoc();
    if (confDoc == null) {
      confDoc = new Document();
      confDoc
          .append("_id", "conf")
          .append("width", 400d)
          .append("height", 400d)
          .append("traductor", false)
          .append("lastDoc", lastDoc.get());
      DBUtils.getCollection().insertOne(confDoc);
    } else {
      System.out.println(confDoc.toJson());
      height.set(confDoc.getDouble("height"));
      width.set(confDoc.getDouble("width"));
      traductorVisible.set(confDoc.getBoolean("traductor", false));
      Document _ld = (Document) confDoc.get("lastDoc");
      if (_ld != null) {
        lastDoc.set(_ld);
      }
    }
    setListeners();
  }
 public void withdrawAddressFocusOut(String text) {
   withdrawalButtonDisable.set(!btcAddressValidator.validate(text).isValid);
 }
 public boolean isOn() {
   return on.get();
 }
 public void setOn(boolean value) {
   on.set(value);
 }
Example #25
0
 public static boolean isShowWhitespace() {
   return showWhitespace.get();
 }
Example #26
0
 public final void setVisible(final boolean VISIBLE) {
   visible.set(VISIBLE);
 }
Example #27
0
 public final boolean isVisible() {
   return visible.get();
 }
Example #28
0
  public boolean splitXHTMLFile() {
    boolean result = false;
    if (currentEditor.getValue().getMediaType().equals(MediaType.XHTML)) {
      XHTMLCodeEditor xhtmlCodeEditor = (XHTMLCodeEditor) currentEditor.getValue();
      EditorPosition pos = xhtmlCodeEditor.getEditorCursorPosition();
      XMLTagPair pair =
          xhtmlCodeEditor.findSurroundingTags(
              token -> {
                String type = token.getType();
                if ("tag".equals(type)) {
                  String content = token.getContent();
                  if ("head".equals(content) || "body".equals(content) || "html".equals(content)) {
                    return true;
                  }
                }
                return false;
              });
      if (pair == null
          || "head".equals(pair.getTagName())
          || "html".equals(pair.getTagName())
          || StringUtils.isEmpty(pair.getTagName())) {
        Dialogs.create()
            .owner(tabPane)
            .title("Teilung nicht möglich")
            .message(
                "Kann Datei nicht an dieser Position teilen. Eine Teilung ist nur innerhalb des XHTML-Bodys möglich.")
            .showWarning();
        return false;
      }
      logger.debug("umgebendes pair " + pair);
      // wir sind innerhalb des Body
      int index = xhtmlCodeEditor.getIndexFromPosition(pos);
      try {
        String originalCode = xhtmlCodeEditor.getCode();
        org.jdom2.Document originalDocument = XHTMLUtils.parseXHTMLDocument(originalCode);
        List<Content> originalHeadContent = getOriginalHeadContent(originalDocument);

        byte[] frontPart = originalCode.substring(0, index).getBytes("UTF-8");
        Resource oldResource = currentXHTMLResource.getValue();
        oldResource.setData(frontPart);
        HtmlCleanerBookProcessor processor = new HtmlCleanerBookProcessor();
        processor.processResource(oldResource);
        xhtmlCodeEditor.setCode(new String(oldResource.getData(), "UTF-8"));

        byte[] backPart =
            originalCode.substring(index, originalCode.length() - 1).getBytes("UTF-8");
        String fileName = book.getNextStandardFileName(MediaType.XHTML);
        Resource resource = MediaType.XHTML.getResourceFactory().createResource("Text/" + fileName);
        byte[] backPartXHTML = XHTMLUtils.repairWithHead(backPart, originalHeadContent);
        resource.setData(backPartXHTML);

        int spineIndex = book.getSpine().getResourceIndex(oldResource);
        book.addSpineResource(resource, spineIndex + 1);
        openFileInEditor(resource, MediaType.XHTML);

        bookBrowserManager.refreshBookBrowser();
        needsRefresh.setValue(true);
        needsRefresh.setValue(false);
      } catch (IOException | JDOMException | ResourceDataException e) {
        logger.error("", e);
        Dialogs.create()
            .owner(tabPane)
            .title("Teilung nicht möglich")
            .message("Kann Datei nicht teilen. Bitte Fehlermeldung an den Hersteller übermitteln.")
            .showException(e);
      }

      result = true;
    }
    return result;
  }
Example #29
0
 public Boolean getAtivo() {
   return ativo.get();
 }
 public final boolean isSweepFlag() {
   return sweepFlag == null ? false : sweepFlag.get();
 }