コード例 #1
0
ファイル: InventoryView.java プロジェクト: rwcarlsen/cyclist2
    public AgentEntry(final AgentInfo info) {
      super();
      this.info = info;

      getStyleClass().add("agent");
      Label text = new Label(info.value);
      text.setStyle("-fx-background-color:" + ColorUtil.toString(info.color));

      Node button = GlyphRegistry.get(AwesomeIcon.TIMES, "10px");
      button.setVisible(false);

      _status = new Status();
      getChildren().addAll(text, new Spring(), _status, button);

      info.taskProperty.addListener(o -> _status.setTask(info.getTask()));
      setOnMouseEntered(
          e -> {
            button.setVisible(true);
            getStyleClass().add("hover");
          });

      setOnMouseExited(
          e -> {
            button.setVisible(false);
            getStyleClass().remove("hover");
          });

      setOnMouseClicked(
          e -> {
            info.active = !info.active;
            text.setDisable(!info.active);
            if (info.active) {
              _chart.add(info);
            } else {
              _chart.remove(info);
            }
          });

      button.setOnMouseClicked(
          e -> {
            if (_onClose != null) {
              _onClose.accept(this);
            }
            e.consume();
          });

      HBox.setHgrow(text, Priority.ALWAYS);
    }
コード例 #2
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
 public void slideUp() {
   if (stopAnyRunningAnimation() == State.VISIBLE) {
     toAnimate.setVisible(true);
     state = State.SLIDING_UP;
     SLIDE_UP.playFromStart();
   }
 }
コード例 #3
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
 public Then slideDown() {
   stopAnyRunningAnimation();
   toAnimate.setVisible(true);
   state = State.SLIDING_DOWN;
   SLIDE_DOWN.playFromStart();
   return new Then(SLIDE_DOWN);
 }
コード例 #4
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
 public void fadeIn() {
   if (stopAnyRunningAnimation() == State.HIDDEN) {
     toAnimate.setVisible(true);
     state = State.FADING_IN;
     FADE_IN.playFromStart();
   }
 }
コード例 #5
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
 public void fadeAway() {
   if (stopAnyRunningAnimation() == State.VISIBLE) {
     toAnimate.setVisible(true);
     state = State.FADING_AWAY;
     FADE_AWAY.playFromStart();
   }
 }
コード例 #6
0
ファイル: Wizard.java プロジェクト: subshare/subshare
  private void showFinishingPage() {
    getChildren().remove(finishingPage);
    for (Node child : getChildren()) child.setVisible(false);

    finishingPage.setVisible(true);
    getChildren().add(finishingPage);
    finishingPage.requestFocus();
  }
コード例 #7
0
ファイル: Wizard.java プロジェクト: subshare/subshare
  protected void navTo(final WizardPage wizardPage, boolean addToHistory) {
    assertNotNull("wizardPage", wizardPage);
    PlatformUtil.assertFxApplicationThread();

    {
      WizardPage currentPage = getCurrentPage();
      if (currentPage != null) currentPage.onHidden();

      if (currentPage != null && addToHistory) history.addLast(currentPage);
    }

    setCurrentPage(wizardPage);
    for (Node child : getChildren()) child.setVisible(false);

    wizardPage.setVisible(true);
    getChildren().remove(wizardPage); // remove from z-order wherever it is (it might be missing!).
    getChildren().add(wizardPage); // re-add as last, which means top-most z-order.

    wizardPage.updateButtonsDisable();
    updateCanFinish();

    if (getParent() != null) getParent().requestFocus();

    this.requestFocus();
    wizardPage.requestFocus();

    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            final Scene scene = getScene();
            final Window window = scene == null ? null : scene.getWindow();
            if (window != null) window.sizeToScene();

            if (getParent() != null) getParent().requestFocus();

            Wizard.this.requestFocus();
            wizardPage.requestFocus();
            wizardPage.onShown();
          }
        });
  }
コード例 #8
0
  @FXML
  private void handleAction(ActionEvent event) {
    List<IIOImage> iioImageList = GuiController.getInstance().iioImageList;
    List<BufferedImage> imageList = GuiController.getInstance().imageList;
    int imageIndex = GuiController.getInstance().imageIndex;
    if (iioImageList == null
        && (event.getSource() != chmiScreenshotMode)
        && event.getSource() != chmiSegmentedRegions) {
      Alert alert =
          new Alert(Alert.AlertType.INFORMATION, bundle.getString("Please_load_an_image."));
      alert.show();
      return;
    }

    if (event.getSource() == miMetadata) {
      try {
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ImageInfoDialog.fxml"));
        Parent root = fxmlLoader.load();
        ImageInfoDialogController controller = fxmlLoader.getController();
        controller.setImage(iioImageList.get(imageIndex));
        Stage imageInfoDialog = new Stage();
        imageInfoDialog.setResizable(false);
        imageInfoDialog.initStyle(StageStyle.UTILITY);
        imageInfoDialog.setAlwaysOnTop(true);
        //            imageInfoDialog.setX(prefs.getDouble(strChangeCaseX, imageInfoDialog.getX()));
        //            imageInfoDialog.setY(prefs.getDouble(strChangeCaseY, imageInfoDialog.getY()));
        Scene scene1 = new Scene(root);
        imageInfoDialog.setScene(scene1);
        imageInfoDialog.setTitle("Image Properties");
        imageInfoDialog.toFront();
        imageInfoDialog.show();
      } catch (Exception e) {

      }
    } else if (event.getSource() == miAutocrop) {
      menuBar.getScene().setCursor(Cursor.WAIT);

      originalImage = (BufferedImage) iioImageList.get(imageIndex).getRenderedImage();
      BufferedImage croppedImage =
          net.sourceforge.vietocr.util.ImageHelper.autoCrop(originalImage, 0.1);
      // if same image, skip
      if (originalImage != croppedImage) {
        stack.push(originalImage);
        imageList.set(imageIndex, croppedImage);
        iioImageList.get(imageIndex).setRenderedImage((BufferedImage) croppedImage);
        GuiController.getInstance().loadImage();
      }

      menuBar.getScene().setCursor(Cursor.DEFAULT);
    } else if (event.getSource() == miBrightness) {

    } else if (event.getSource() == miContrast) {

    } else if (event.getSource() == miDeskew) {
      menuBar.getScene().setCursor(Cursor.WAIT);

      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              ImageDeskew deskew =
                  new ImageDeskew((BufferedImage) iioImageList.get(imageIndex).getRenderedImage());
              double imageSkewAngle = deskew.getSkewAngle();

              if ((imageSkewAngle > MINIMUM_DESKEW_THRESHOLD
                  || imageSkewAngle < -(MINIMUM_DESKEW_THRESHOLD))) {
                originalImage = (BufferedImage) iioImageList.get(imageIndex).getRenderedImage();
                stack.push(originalImage);
                BufferedImage rotatedImage =
                    rotateImage(originalImage, Math.toRadians(-imageSkewAngle));
                imageList.set(imageIndex, rotatedImage); // persist the rotated image
                iioImageList.get(imageIndex).setRenderedImage(rotatedImage);
                GuiController.getInstance().loadImage();
              }
              menuBar.getScene().setCursor(Cursor.DEFAULT);
            }
          });
    } else if (event.getSource() == miGrayscale) {

    } else if (event.getSource() == miInvert) {

    } else if (event.getSource() == miMonochrome) {

    } else if (event.getSource() == miSharpen) {

    } else if (event.getSource() == miSmooth) {

    } else if (event.getSource() == miUndo) {
      if (stack.isEmpty()) {
        return;
      }
      BufferedImage image = stack.pop();
      imageList.set(imageIndex, image);
      iioImageList.get(imageIndex).setRenderedImage(image);
      GuiController.getInstance().loadImage();
    } else if (event.getSource() == chmiScreenshotMode) {
      Label labelScreenShotMode = (Label) menuBar.getScene().lookup("#labelScreenShotMode");
      labelScreenShotMode.setText(this.chmiScreenshotMode.isSelected() ? "On" : "Off");
    } else if (event.getSource() == chmiSegmentedRegions) {
      Node segmentedRegionsBox = menuBar.getScene().lookup("#segmentedRegionsBox");
      segmentedRegionsBox.setVisible(chmiSegmentedRegions.isSelected());
    }
  }
コード例 #9
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
  public Animations(
      Node toAnimate,
      boolean initiallyVisible,
      Duration slideDown,
      Duration slideUp,
      Duration fadeIn,
      Duration fadeAway) {
    this.toAnimate = toAnimate;
    toAnimate.setVisible(initiallyVisible);
    state = initiallyVisible ? State.VISIBLE : State.HIDDEN;

    SLIDE_DOWN =
        TranslateTransitionBuilder.create()
            .fromY(-200)
            .toY(0)
            .node(toAnimate)
            .duration(slideDown)
            .onFinished(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent arg0) {
                    toVisibleState();
                  }
                })
            .build();

    SLIDE_UP =
        TranslateTransitionBuilder.create()
            .fromY(0)
            .toY(-200)
            .node(toAnimate)
            .duration(slideUp)
            .onFinished(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent arg0) {
                    toHiddenState();
                  }
                })
            .build();

    FADE_AWAY =
        FadeTransitionBuilder.create()
            .node(toAnimate)
            .fromValue(1)
            .toValue(0)
            .duration(fadeAway)
            .onFinished(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent arg0) {
                    toHiddenState();
                  }
                })
            .build();
    FADE_IN =
        FadeTransitionBuilder.create()
            .node(toAnimate)
            .fromValue(0)
            .toValue(1)
            .duration(fadeIn)
            .onFinished(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent arg0) {
                    toVisibleState();
                  }
                })
            .build();
  }
コード例 #10
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
 private void toVisibleState() {
   state = State.VISIBLE;
   toAnimate.setVisible(true);
 }
コード例 #11
0
ファイル: Animations.java プロジェクト: J-Zeitler/loadui
 private void toHiddenState() {
   state = State.HIDDEN;
   toAnimate.setVisible(false);
   toAnimate.setOpacity(1.0);
 }