예제 #1
0
  @Override
  public void updateItem(LibraryListItem item, boolean empty) {
    super.updateItem(item, empty);
    setText(null);

    if (!empty && item != null) {
      updateLayout(item);
      if (item.getLibItem() != null) {
        // A qualifier needed to discriminate items is kept in the ID:
        // this applies to orientation as well as empty qualifiers.
        // FX8 qualifier is not kept as there's no ambiguity there.
        String id = item.getLibItem().getName();
        if (id.contains(BuiltinLibrary.getFX8Qualifier())) {
          id = id.substring(0, id.indexOf(BuiltinLibrary.getFX8Qualifier()));
        }
        // If QE were about to test a localized version the ID should
        // remain unchanged.
        if (id.contains(BuiltinLibrary.getEmptyQualifier())) {
          id = id.replace(BuiltinLibrary.getEmptyQualifier(), EMPTY_QUALIFIER_ID);
        }
        graphic.setId(id); // for QE
      }

      setGraphic(graphic);
    } else {
      setGraphic(null);
    }
  }
예제 #2
0
 @Override
 public void updateItem(T item, boolean empty) {
   super.updateItem(item, empty);
   setText(configuration.getLabel(item));
   setTooltip(item);
   setImage(item);
 }
예제 #3
0
 @Override
 protected void updateItem(PaymentType item, boolean empty) {
   super.updateItem(item, empty);
   if (item != null) {
     setText(item.getUfName());
   }
 }
  /** @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean) */
  @Override
  protected void updateItem(ResultsItem item, boolean empty) {
    super.updateItem(item, empty);
    if (item != null) {
      setText("");

      GridPane gp = new GridPane();
      gp.setHgap(0.0);
      gp.setVgap(0.0);
      gp.setPadding(new Insets(5, 5, 5, 5));
      gp.setMinWidth(250);

      ColumnConstraints constraint1 = new ColumnConstraints();
      constraint1.setFillWidth(false);
      constraint1.setHgrow(Priority.NEVER);
      constraint1.setMinWidth(160);
      constraint1.setMaxWidth(160);
      gp.getColumnConstraints().add(constraint1);

      ColumnConstraints constraint2 = new ColumnConstraints();
      constraint2.setFillWidth(true);
      constraint2.setHgrow(Priority.SOMETIMES);
      gp.getColumnConstraints().add(constraint2);

      int row = 0;

      gp.add(wrapAndStyle(makeBoldLabel("Message"), row), 0, row);
      Label message = new Label(item.getMessage());
      message.setWrapText(true);
      message.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(message, row), 1, row++);

      gp.add(wrapAndStyle(makeBoldLabel("Severity"), row), 0, row);
      Label severity = new Label(item.getSeverity().getName());
      severity.setWrapText(true);
      severity.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(severity, row), 1, row++);

      gp.add(wrapAndStyle(makeBoldLabel("Rule UUID"), row), 0, row);
      Label ruleUUID = new Label(item.getRuleUuid());
      ruleUUID.setWrapText(true);
      ruleUUID.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(ruleUUID, row), 1, row++);

      gp.add(wrapAndStyle(makeBoldLabel("Error Code"), row), 0, row);
      Label errorCode = new Label(item.getErrorCode() + "");
      errorCode.setWrapText(true);
      errorCode.maxWidthProperty().bind(this.widthProperty().subtract(180));
      gp.add(wrapAndStyle(errorCode, row), 1, row++);

      setGraphic(gp);
      this.setStyle("-fx-border-width:  0 0 2 0; -fx-border-color: grey; ");

    } else {
      setText("");
      setGraphic(null);
      this.setStyle("");
    }
  }
예제 #5
0
 @Override
 protected void updateItem(MBindingContext item, boolean empty) {
   super.updateItem(item, empty);
   if (item != null) {
     setText("BindingContext - " + item.getName());
     System.err.println(pool.getImageUnchecked(ResourceProvider.Model_BindingContext));
     setGraphic(new ImageView(pool.getImageUnchecked(ResourceProvider.Model_BindingContext)));
   }
 }
예제 #6
0
 @Override
 protected void updateItem(Person arg0, boolean arg1) {
   super.updateItem(arg0, arg1);
   if (arg0 == null) {
     setText("");
   } else {
     setText(arg0.getFirstname() + ", " + arg0.getLastname());
   }
 }
예제 #7
0
 /**
  * Aggiorna l'elemento della Lista
  *
  * @param biglietto
  * @param empty
  */
 @Override
 protected void updateItem(Biglietto biglietto, boolean empty) {
   super.updateItem(biglietto, empty);
   if (biglietto != null) {
     try {
       RisultatoBigliettoItem biglietto_item = new RisultatoBigliettoItem(this.stage, biglietto);
       setGraphic(biglietto_item.getRoot());
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 }
예제 #8
0
 @Override
 public void updateItem(T item, boolean empty) {
   super.updateItem(item, empty);
   if (item != null) {
     try {
       makeCell(item);
     } catch (NullPointerException e) {
       setText(null);
       setGraphic(null);
     }
   }
 }
예제 #9
0
 /**
  * Override the updateItem method, populate the cell with a flowpane node
  *
  * @param s: String input, either is a time or a task.
  */
 @Override
 protected void updateItem(String s, boolean empty) {
   super.updateItem(s, empty);
   if (!isEmpty()) {
     if (s.contains(TIME_FLAG)) {
       String time = s.substring(s.indexOf(TIME_FLAG) + TIME_STARTING_INDEX);
       String text = s.substring(STARTING_INDEX, s.indexOf(TIME_FLAG));
       setGraphic(createTextFlow(text, TIME_PLACEHOLDER, time));
     } else {
       setGraphic(createTextFlow(s));
     }
   } else {
     setGraphic(null);
   }
 }
예제 #10
0
 @Override
 protected void updateItem(final Tab tab, boolean empty) {
   super.updateItem(tab, empty);
   if (tab != null) {
     tab.getUnreadProperty()
         .addListener(
             new ChangeListener<Boolean>() {
               @Override
               public void changed(
                   ObservableValue<? extends Boolean> observableValue,
                   Boolean oldValue,
                   Boolean newValue) {
                 if (newValue) {
                   getStyleClass().add("unread");
                 } else {
                   getStyleClass().remove("unread");
                 }
               }
             });
     Entity entity = tab.getEntity();
     setPrefHeight(32);
     if (entity instanceof Server) {
       setPrefHeight(40);
       Label net = new Label("network");
       net.getStyleClass().add("network");
       VBox box = new VBox();
       Label name = new Label(entity.getName());
       name.getStyleClass().add("network-name");
       box.getChildren().addAll(net, name);
       setGraphic(box);
     } else if (entity instanceof Channel) {
       final Label label = new Label(entity.getName().substring(1));
       label.getStyleClass().add("name");
       final HBox box = new HBox();
       box.getChildren().addAll(FontAwesome.createIcon(FontAwesome.COMMENTS), label);
       setGraphic(box);
     } else if (entity instanceof User) {
       final Label label = new Label(entity.getName());
       label.getStyleClass().add("name");
       final HBox box = new HBox();
       box.getChildren().addAll(FontAwesome.createIcon(FontAwesome.USER), label);
       setGraphic(box);
     }
   }
 }
예제 #11
0
  @Override
  protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty) {
      setText(null);
      setGraphic(null);
    } else if (item instanceof Node) {
      setText(null);
      Node currentNode = getGraphic();
      Node newNode = (Node) item;
      if (currentNode == null || !currentNode.equals(newNode)) {
        setGraphic(newNode);
      }
    } else {
      setText(itemToString(item));
      setGraphic(null);
    }
  }
예제 #12
0
  @Override
  public void updateItem(Experiment t, boolean empty) {
    super.updateItem(t, empty);
    if (t == null) {
      return;
    }
    label.textProperty().set("Test: " + t.getName());

    ExperimentStatusSnapshot knownStatus = AppController.getEventServer().getCurrentlyKnownStatus();

    if (knownStatus.finishedSubExperimentNames().contains(t.getName())) {
      progressRect.setProgress(1);
    } else if (t.getName().equals(knownStatus.currentExecutedSubExperimentName())) {
      final double value =
          (double) knownStatus.currentExecutedSubExperimentStatus().finishedExecutions()
              / t.numberOfExecutions();
      progressRect.setProgress(value);
    } else {
      progressRect.setProgress(0);
    }

    setGraphic(content);
  }
예제 #13
0
 @Override
 protected void updateItem(Task item, boolean empty) {
   super.updateItem(item, empty);
   updateViewModel();
 }
예제 #14
0
 @Override
 public void cancelEdit() {
   super.cancelEdit();
   updateViewModel();
 }
예제 #15
0
 @Override
 public void startEdit() {
   super.startEdit();
   updateViewModel();
 }
예제 #16
0
  @Override
  protected void updateItem(ShoppingItem item, boolean empty) {
    super.updateItem(item, empty);

    if (item != null) {
      if (empty) {
        setText(null);
        setGraphic(null);
      } else {
        setText(null);

        BorderPane pane = new BorderPane();
        pane.setPadding(new Insets(2, 5, 2, 5));
        TextField txtField = new TextField((int) item.getAmount() + "");
        txtField.setMaxWidth(40);
        txtField.setDisable(false);
        txtField.setEditable(true);
        pane.setLeft(txtField);

        Label name = new Label(item.getProduct().getName());
        BorderPane.setAlignment(name, Pos.CENTER_LEFT);
        BorderPane.setMargin(name, new Insets(0, 0, 0, 10));
        name.getStyleClass().add("produktnamn");
        pane.setCenter(name);

        GridPane priceAndDelete = new GridPane();
        double cost = item.getTotal();
        Label price = new Label(String.format("%.2f", cost) + " kr");
        price.setTextAlignment(TextAlignment.CENTER);
        GridPane.setMargin(price, new Insets(0, 10, 0, 0));
        priceAndDelete.add(price, 0, 0);

        Button delete = new Button("X");
        priceAndDelete.add(delete, 1, 0);

        pane.setRight(priceAndDelete);
        setGraphic(pane);

        delete.setOnMouseClicked(
            new EventHandler<MouseEvent>() {
              @Override
              public void handle(MouseEvent event) {
                IMatDataHandler.getInstance().getShoppingCart().removeItem(item);
                IMatDataHandler.getInstance()
                    .getShoppingCart()
                    .fireShoppingCartChanged(item, false);
              }
            });

        // Listen for TextField text changes
        txtField
            .textProperty()
            .addListener(
                new ChangeListener<String>() {
                  @Override
                  public void changed(
                      ObservableValue<? extends String> observable,
                      String oldValue,
                      String newValue) {
                    try {
                      if (!txtField.getText().equals("")) {
                        int amount = Integer.parseInt(txtField.getText());
                        if (amount < 1) {
                          txtField.setText(1 + "");
                        } else if (amount > 99) {
                          txtField.setText(99 + "");
                        }
                        item.setAmount(Integer.parseInt(txtField.getText()));
                        double cost2 = item.getTotal();
                        price.setText(String.format("%.2f", cost2) + " kr");
                        // IMatDataHandler.getInstance().getShoppingCart().fireShoppingCartChanged(item, true);
                        lastValidProductAmountString = txtField.getText();
                      }
                    } catch (NumberFormatException e) {
                      txtField.setText(lastValidProductAmountString);
                    }
                  }
                });
      }
    } else {
      if (count < 1) {
        Label noProducts = new Label("Din kundvagn är tom");
        noProducts.getStyleClass().add("produktnamn");
        setGraphic(noProducts);
        count++;
      } else {
        setText(null);
        setGraphic(null);
      }
    }
  }