Пример #1
0
    @Override
    public void handle(MouseEvent t) {
      try {
        TableCell c = (TableCell) t.getSource();
        int index = c.getIndex();
        System.out.println("id = " + recordList.get(index).getId());
        System.out.println("name = " + recordList.get(index).getName());
        System.out.println("board width = " + recordList.get(index).getBoardWidth());
        System.out.println("board height = " + recordList.get(index).getBoardHeight());
        int id = recordList.get(index).getId();
        runControllerThread(id);

      } catch (Exception e) {
      }
    }
Пример #2
0
  @Override
  public void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);
    if (item == null) {
      setGraphic(null);
      setText(null);
    } else {
      if (item.toString().equalsIgnoreCase("Processing")) {
        Platform.runLater(
            new Runnable() {
              @Override
              public void run() {

                if (getGraphic() == null) {
                  setGraphic(progressBar);
                  progressBar.setProgress(-1);
                } else {
                  ProgressBar objpProgressBar = (ProgressBar) getGraphic();
                  objpProgressBar.setProgress(-1);
                }
                setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
              }
            });
      }
    }
  }
Пример #3
0
  @Override
  public void cancelEdit() {
    super.cancelEdit();

    setText((String) getItem());
    setContentDisplay(ContentDisplay.TEXT_ONLY);
  }
 // Display button if the row is not empty
 @Override
 protected void updateItem(Boolean t, boolean empty) {
   super.updateItem(t, empty);
   if (!empty) {
     HBox box = new HBox();
     box.getChildren().addAll(cellEditButton, cellDeleteButton);
     setGraphic(box);
   }
 }
Пример #5
0
    @Override
    protected void updateItem(LocalDateTime item, boolean empty) {
      super.updateItem(item, empty);

      if (!empty) {
        setText(item.format(DateTimeFormatter.ISO_LOCAL_DATE));
      } else {
        setText(null);
      }
    }
Пример #6
0
 @Override
 protected void updateItem(String item, boolean empty) {
   super.updateItem(item, empty);
   if (!empty) {
     label.setText(genDotString(item.length()));
     setGraphic(label);
   } else {
     setGraphic(null);
   }
 }
Пример #7
0
 @Override
 protected void updateItem(T item, boolean empty) {
   super.updateItem(item, empty);
   if (empty) {
     setGraphic(null);
   } else {
     link.setText(getDisplayName(item));
     setGraphic(link);
   }
 }
 @Override
 public void cancelEdit() {
   super.cancelEdit();
   setText(getString());
   setContentDisplay(ContentDisplay.TEXT_ONLY);
   // Once the edit has been cancelled we no longer need the text field
   // so we mark it for cleanup here. Note though that you have to handle
   // this situation in the focus listener which gets fired at the end
   // of the editing.
   textField = null;
 }
Пример #9
0
  @Override
  public void updateItem(String item, boolean empty) {
    super.updateItem(item, empty);

    if (empty) {
      setText(null);
      setGraphic(null);
    } else {
      setText(getString());
      setGraphic(null);
    }
  }
Пример #10
0
  /** Prepares the cell for editing */
  @Override
  public void startEdit() {
    super.startEdit();

    if (textField == null) {
      createTextField();
    }
    setText(null);
    setGraphic(textField);
    textField.setText(getString());
    textField.selectAll();
  }
 @Override
 protected void updateItem(Calendar item, boolean empty) {
   super.updateItem(item, empty);
   if ((item == null) || empty) {
     setText(null);
     setStyle("");
   } else {
     String cellText = CFLibXmlUtil.formatTZTimestamp(item);
     setText(cellText);
     setStyle("-fx-alignment: CENTER-LEFT");
   }
 }
  @Override
  @SuppressWarnings("unchecked")
  public TableCell<S, T> call(TableColumn<S, T> p) {
    TableCell<S, T> cell =
        new TableCell<S, T>() {

          @Override
          public void updateItem(Object item, boolean empty) {
            if (item == getItem()) {
              return;
            }
            super.updateItem((T) item, empty);
            if (item == null) {
              super.setText(null);
              super.setGraphic(null);
            } else if (format != null) {
              super.setText(format.format(item));
            } else if (item instanceof Node) {
              super.setText(null);
              super.setGraphic((Node) item);
            } else {
              super.setText(item.toString());
              super.setGraphic(null);
            }
          }
        };
    cell.setTextAlignment(alignment);
    switch (alignment) {
      case CENTER:
        cell.setAlignment(Pos.CENTER);
        break;
      case RIGHT:
        cell.setAlignment(Pos.CENTER_RIGHT);
        break;
      default:
        cell.setAlignment(Pos.CENTER_LEFT);
        break;
    }
    return cell;
  }
    @Override
    public TableCell<LocalTask, T> call(TableColumn<LocalTask, T> param) {
      TableCell<LocalTask, T> newCell =
          new TableCell<LocalTask, T>() {
            @Override
            public void updateItem(T item, boolean empty) {
              super.updateItem(item, empty);
              setText(empty ? null : getString());
              setGraphic(null);
            }

            private String getString() {
              return getItem() == null ? "" : getItem().toString();
            }
          };
      newCell.addEventFilter(
          MouseEvent.MOUSE_CLICKED,
          new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
              TableCell<?, ?> c = (TableCell<?, ?>) event.getSource();

              if (event.getClickCount() == 1) {
                // LOG.debug(event.getButton() + " single clicked. Cell text: " + c.getText());
              } else if (event.getClickCount() > 1) {
                LOG.debug(event.getButton() + " double clicked. Cell text: " + c.getText());
                int cellIndex = c.getIndex();
                LocalTask task = taskTable.getItems().get(cellIndex);

                ConceptWorkflowViewI view = AppContext.getService(ConceptWorkflowViewI.class);
                view.setInitialTask(task.getId());
                view.showView(AppContext.getMainApplicationWindow().getPrimaryStage());
              }
            }
          });

      return newCell;
    }
 @Override
 public void startEdit() {
   super.startEdit();
   if (textField == null) {
     createTextField();
   }
   setGraphic(textField);
   setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
   Platform.runLater(
       new Runnable() {
         @Override
         public void run() {
           textField.selectAll();
           textField.requestFocus();
         }
       });
 }
Пример #15
0
 /**
  * Performs an item update
  *
  * @param item the updated cell type class instance
  * @param empty true if the item is empty
  */
 @Override
 public void updateItem(PropertyType item, boolean empty) {
   super.updateItem(item, empty);
   if (empty) {
     setText(null);
     setGraphic(null);
   } else {
     if (isEditing()) {
       if (textField != null) {
         textField.setText(getString());
       }
       setText(null);
       setGraphic(textField);
     } else {
       setText(getString());
       setGraphic(null);
     }
   }
 }
 @Override
 public void updateItem(T item, boolean empty) {
   super.updateItem(item, empty);
   if (empty) {
     setText(null);
     setGraphic(null);
   } else {
     if (isEditing()) {
       if (textField != null) {
         textField.setText(getString());
       }
       setGraphic(textField);
       setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
     } else {
       setText(getString());
       setContentDisplay(ContentDisplay.TEXT_ONLY);
     }
   }
 }
Пример #17
0
 @Override
 public void startEdit() {
   if (!isEmpty()) {
     super.startEdit();
   }
 }
Пример #18
0
 /** Cancels cell editing */
 @Override
 public void cancelEdit() {
   super.cancelEdit();
   setText(getString());
   setGraphic(null);
 }
Пример #19
0
 /**
  * Performs a commit only if the item is valid
  *
  * @param item the item to be committed
  */
 public void commitIfValid(String item) {
   if (validator.isValid(item)) super.commitEdit(propertyFromString(item));
   else cancelEdit();
 }
Пример #20
0
  @Override
  protected void updateItem(IlliquidMainSalesStatusBean item, boolean empty) {
    super.updateItem(item, empty);
    if ((!isEmpty()) && (item != null)) {
      StringBuilder tooltext = new StringBuilder();
      HBox hb = new HBox();
      hb.setAlignment(Pos.CENTER);
      VBox vb = new VBox();
      vb.setAlignment(Pos.CENTER);

      double totalCount =
          item.getCountTvr() + item.getDays30sale() + item.getDays60sale() + item.getDays90sale();
      double proc30;
      double proc60;
      double proc90;
      if (totalCount > 0) {
        proc30 = item.getDays30sale() / totalCount;
        proc60 = item.getDays60sale() / totalCount;
        proc90 = item.getDays90sale() / totalCount;
      } else {
        proc30 = 1;
        proc60 = 1;
        proc90 = 1;
      }

      if (proc30 == 0) {
        hb.getChildren().add(new ImageView(imEmpty));
        vb.getChildren().add(new ImageView(imEmpty));
      } else if (proc30 < 0.10) {
        hb.getChildren().add(new ImageView(imRed));
        vb.getChildren().add(new ImageView(imRed));
      } else if (proc30 >= 0.10 && proc30 < 0.30) {
        hb.getChildren().add(new ImageView(imYelow));
        vb.getChildren().add(new ImageView(imYelow));
      } else if (proc30 >= 0.30) {
        hb.getChildren().add(new ImageView(imGreen));
        vb.getChildren().add(new ImageView(imGreen));
      }
      tooltext
          .append("1 міс. {")
          .append(DateConverters.getDateToStr(per30From))
          .append(" - ")
          .append(DateConverters.getDateToStr(now))
          .append("}:  ")
          .append(String.format("%.2f", proc30 * 100))
          .append("%\n");

      if (proc60 == 0) {
        hb.getChildren().add(new ImageView(imEmpty));
        vb.getChildren().add(new ImageView(imEmpty));
      } else if (proc60 < 0.10) {
        hb.getChildren().add(new ImageView(imRed));
        vb.getChildren().add(new ImageView(imRed));
      } else if (proc60 >= 0.10 && proc60 < 0.30) {
        hb.getChildren().add(new ImageView(imYelow));
        vb.getChildren().add(new ImageView(imYelow));
      } else if (proc60 >= 0.30) {
        hb.getChildren().add(new ImageView(imGreen));
        vb.getChildren().add(new ImageView(imGreen));
      }
      tooltext
          .append("2 міс. {")
          .append(DateConverters.getDateToStr(per60From))
          .append(" - ")
          .append(DateConverters.getDateToStr(per30From))
          .append("}:  ")
          .append(String.format("%.2f", proc60 * 100))
          .append("%\n");

      if (proc90 == 0) {
        hb.getChildren().add(new ImageView(imEmpty));
        vb.getChildren().add(new ImageView(imEmpty));
      } else if (proc90 < 0.10) {
        hb.getChildren().add(new ImageView(imRed));
        vb.getChildren().add(new ImageView(imRed));
      } else if (proc90 >= 0.10 && proc90 < 0.30) {
        hb.getChildren().add(new ImageView(imYelow));
        vb.getChildren().add(new ImageView(imYelow));
      } else if (proc90 >= 0.30) {
        hb.getChildren().add(new ImageView(imGreen));
        vb.getChildren().add(new ImageView(imGreen));
      }
      tooltext
          .append("3 міс. {")
          .append(DateConverters.getDateToStr(per90From))
          .append(" - ")
          .append(DateConverters.getDateToStr(per60From))
          .append("}:  ")
          .append(String.format("%.2f", proc90 * 100))
          .append("%");
      tooltip.setText(tooltext.toString());
      tooltip.setGraphic(vb);
      setTooltip(tooltip);
      setGraphic(hb);
    } else {
      setGraphic(null);
    }
  }
Пример #21
0
 @Override
 public void cancelEdit() {
   super.cancelEdit();
   setText((String) getItem());
   setGraphic(null);
 }
Пример #22
0
 @Override
 public void updateItem(Integer item, boolean empty) {
   super.updateItem(item, empty);
   setText(empty ? null : getString());
   setGraphic(null);
 }