Exemplo n.º 1
0
 private void createShowAlertsButton() {
   showAlertsToggleButton = new ToggleButton(FontAwesome.ICON_WARNING);
   showAlertsToggleButton.setFont(Font.font("FontAwesome", 14));
   showAlertsToggleButton.setTextFill(Color.DARKGOLDENROD);
   showAlertsToggleButton.setTooltip(new Tooltip("Show/Hide Alerts."));
   showAlertsToggleButton.selectedProperty().bindBidirectional(showAlerts);
 }
  void setSingleMode(Mode mode) {
    // First disable toggle buttons so we cannot switch from 1 mode to another
    colorToggleButton.setManaged(false);
    linearToggleButton.setManaged(false);
    radialToggleButton.setManaged(false);

    final Paint value;
    switch (mode) {
      case COLOR:
        value = DEFAULT_COLOR;
        break;
      case LINEAR:
        value = DEFAULT_LINEAR;
        break;
      case RADIAL:
        value = DEFAULT_RADIAL;
        break;
      default:
        value = null;
        assert false;
        break;
    }
    // Update model
    setPaintProperty(value);
    // Update UI
    updateUI(value);
  }
Exemplo n.º 3
0
 private void createShowConsoleButton() {
   consoleToggleButton = new ToggleButton(FontAwesome.ICON_TERMINAL);
   consoleToggleButton.setFont(Font.font("FontAwesome", 14));
   consoleToggleButton.setTextFill(Color.DARKBLUE);
   consoleToggleButton.setTooltip(new Tooltip("Show/Hide Console."));
   consoleToggleButton.selectedProperty().bindBidirectional(isDetailNodeVisible);
 }
  private boolean handleSitLeave(
      boolean bSit,
      int iPlayerPosition,
      Label lblPlayer,
      TextField txtPlayer,
      ToggleButton btnSitLeave,
      HBox HBoxPlayerCards) {
    if (bSit == false) {
      Player p = new Player(txtPlayer.getText(), iPlayerPosition);
      mainApp.AddPlayerToTable(p);
      lblPlayer.setText(txtPlayer.getText());
      lblPlayer.setVisible(true);
      btnSitLeave.setText("Leave");
      txtPlayer.setVisible(false);
      bSit = true;
    } else {
      mainApp.RemovePlayerFromTable(iPlayerPosition);
      btnSitLeave.setText("Sit");
      txtPlayer.setVisible(true);
      lblPlayer.setVisible(false);
      HBoxPlayerCards.getChildren().clear();
      bSit = false;
    }

    return bSit;
  }
  private void createNewStage(int level, Stage owner, boolean onTop) {
    Stage stage = new Stage();
    stage.initOwner(owner);
    stage.setTitle(level == 0 ? "Root" : "Child " + level);
    stage.setAlwaysOnTop(onTop);

    VBox root = new VBox(15);
    root.setPadding(new Insets(20));
    Scene scene = new Scene(root);
    stage.setScene(scene);

    ToggleButton onTopButton = new ToggleButton(onTop ? DISABLE_ON_TOP : ENABLE_ON_TOP);
    onTopButton.setSelected(onTop);

    stage
        .alwaysOnTopProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              onTopButton.setSelected(newValue);
              onTopButton.setText(newValue ? DISABLE_ON_TOP : ENABLE_ON_TOP);
            });

    onTopButton.setOnAction(event -> stage.setAlwaysOnTop(!stage.isAlwaysOnTop()));

    CheckBox box = new CheckBox("Child stage always on top");
    box.setSelected(true);
    Button newStageButton = new Button("Open child stage");

    newStageButton.setOnAction(event -> createNewStage(level + 1, stage, box.isSelected()));

    root.getChildren().addAll(onTopButton, box, newStageButton);

    stage.show();
  }
Exemplo n.º 6
0
 private void createProxyRequestsButton() {
   proxyRequestsToggleButton = new ToggleButton(FontAwesome.ICON_EXCHANGE);
   proxyRequestsToggleButton.setFont(Font.font("FontAwesome", 14));
   proxyRequestsToggleButton.setTextFill(Color.BLACK);
   proxyRequestsToggleButton.setTooltip(new Tooltip("Enable/Disable Proxying via Burp"));
   proxyRequestsToggleButton.selectedProperty().bindBidirectional(isProxyingEnabled);
 }
Exemplo n.º 7
0
 @FXML
 private void handleP1SitLeave() {
   int iPlayerPosition = 1;
   btnP1SitLeave.setDisable(true);
   bP1Sit =
       handleSitLeave(bP1Sit, iPlayerPosition, lblP1Name, txtP1Name, btnP1SitLeave, hBoxP1Cards);
   btnP1SitLeave.setDisable(false);
 }
Exemplo n.º 8
0
 @FXML
 private void handleP2SitLeave() {
   int iPlayerPosition = 2;
   btnP2SitLeave.setDisable(true);
   bP2Sit =
       handleSitLeave(bP2Sit, iPlayerPosition, lblP2Name, txtP2Name, btnP2SitLeave, hBoxP2Cards);
   btnP2SitLeave.setDisable(false);
 }
Exemplo n.º 9
0
 @FXML
 private void handleP3SitLeave() {
   int iPlayerPosition = 3;
   btnP3SitLeave.setDisable(true);
   bP3Sit =
       handleSitLeave(bP3Sit, iPlayerPosition, lblP3Name, txtP3Name, btnP3SitLeave, hBoxP3Cards);
   btnP3SitLeave.setDisable(false);
 }
Exemplo n.º 10
0
 @FXML
 private void handleP4SitLeave() {
   int iPlayerPosition = 4;
   btnP4SitLeave.setDisable(true);
   bP4Sit =
       handleSitLeave(bP4Sit, iPlayerPosition, lblP4Name, txtP4Name, btnP4SitLeave, hBoxP4Cards);
   btnP4SitLeave.setDisable(false);
 }
 private void initButtons() {
   levels = new ToggleGroup();
   levelOne.setToggleGroup(levels);
   levelTwo.setToggleGroup(levels);
   levelThree.setToggleGroup(levels);
   levelFour.setToggleGroup(levels);
   levelFive.setToggleGroup(levels);
 }
Exemplo n.º 12
0
  private void clearModels() {
    structureStick.selectedProperty().unbind();
    structureBall.selectedProperty().unbind();
    structureMesh.selectedProperty().unbind();

    structureBall.setOnAction(event -> {});

    rnaSequence3D.getModels().clear();
  }
Exemplo n.º 13
0
 public boolean removeLinkButton() {
   if (!linkButtonContainer.getChildren().isEmpty()) {
     linkButton.selectedProperty().unbindBidirectional(linkedProperty);
     linkButton.disableProperty().unbind();
     linkButtonContainer.getChildren().clear();
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 14
0
 private static void addHeader(String labelText, ToggleButton btn, Integer size, VBox content) {
   HBox headerRow = new HBox(size);
   Label lname = new Label(labelText);
   lname.getStyleClass().add("popover-label");
   btn.setPrefSize(50, 10);
   // this is so everytime user closes popover in edit, and when user
   // revisits it popover is
   // in edit mode
   btn.setSelected(false);
   headerRow.getChildren().addAll(lname, btn);
   content.getChildren().add(headerRow);
 }
Exemplo n.º 15
0
 private void setActiveButton() {
   switch (recording.getFileExistsAction()) {
     case OK:
       rename.setSelected(true);
       break;
     case REPLACE:
       replace.setSelected(true);
       break;
     case CANCEL:
       cancel.setSelected(true);
       break;
   }
 }
  @FXML
  private void handleP4SitLeave() {

    if (this.iCardDrawn != 0) {
      displayWarning("Players must wait until the current game is over.");
      return;
    }

    int iPlayerPosition = 4;
    btnP4SitLeave.setDisable(true);
    bP4Sit =
        handleSitLeave(bP4Sit, iPlayerPosition, lblP4Name, txtP4Name, btnP4SitLeave, hBoxP4Cards);
    btnP4SitLeave.setDisable(false);
  }
Exemplo n.º 17
0
 public ReplaceOrRenameActionBar(Recording recording, UserPrefs userPrefs) {
   this.recording = recording;
   this.userPrefs = userPrefs;
   replace = new ToggleButton("Replace");
   replace.setSelected(true);
   rename = new ToggleButton("Rename");
   cancel = new ToggleButton("Don't Archive");
   toggleGroup = new ToggleGroup();
   toggleGroup.getToggles().setAll(replace, rename, cancel);
   this.getButtons().addAll(replace, rename, cancel);
   replace.setOnAction(event -> replace());
   rename.setOnAction(event -> renameDestination());
   cancel.setOnAction(event -> cancelArchive());
 }
Exemplo n.º 18
0
 private void activateRightSideButtons() {
   colorPyrpur.setOnAction(
       (me) -> {
         ((MeshModel) rnaSequence3D.getModels().get(1)).colorPyrPur();
       });
   colorAugc.setOnAction(
       (me) -> {
         ((MeshModel) rnaSequence3D.getModels().get(1)).colorBases();
       });
   centerObject.setOnAction(
       (me) -> {
         tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter());
       });
 }
Exemplo n.º 19
0
  @SuppressWarnings("deprecation")
  protected void initialize() {
    followUpToggle.setOnAction(
        (ActionEvent t) -> {
          if (followUpToggle.isSelected() == true) {
            globalSelectionModel.clearAndSelect(fileID);
            try {
              AddDrawableTagAction.getInstance().addTag(TagUtils.getFollowUpTagName(), "");
            } catch (TskCoreException ex) {
              LOGGER.log(Level.SEVERE, "Failed to add follow up tag.  Could not load TagName.", ex);
            }
          } else {
            // TODO: convert this to an action!
            final ImageGalleryController controller = ImageGalleryController.getDefault();
            try {
              // remove file from old category group
              controller
                  .getGroupManager()
                  .removeFromGroup(
                      new GroupKey<TagName>(DrawableAttribute.TAGS, TagUtils.getFollowUpTagName()),
                      fileID);

              List<ContentTag> contentTagsByContent =
                  Case.getCurrentCase()
                      .getServices()
                      .getTagsManager()
                      .getContentTagsByContent(file);
              for (ContentTag ct : contentTagsByContent) {
                if (ct.getName()
                    .getDisplayName()
                    .equals(TagUtils.getFollowUpTagName().getDisplayName())) {
                  Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(ct);
                }
              }
              IngestServices.getInstance()
                  .fireModuleDataEvent(
                      new ModuleDataEvent(
                          "TagAction", BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE)); // NON-NLS
              controller
                  .getGroupManager()
                  .handleFileUpdate(
                      FileUpdateEvent.newUpdateEvent(
                          Collections.singleton(fileID), DrawableAttribute.TAGS));
            } catch (TskCoreException ex) {
              LOGGER.log(Level.SEVERE, "Failed to delete follow up tag.", ex);
            }
          }
        });
  }
Exemplo n.º 20
0
  public ToggleButton addLinkButton(SceneItem scenario) {

    if (!linkButtonContainer.getChildren().isEmpty()) {
      linkButtonContainer.getChildren().clear();
    }

    linkedProperty = getLinkedProperty(scenario);
    linkButton = linkScenarioButton(linkedProperty);

    linkButton.selectedProperty().bindBidirectional(linkedProperty);
    playButton.bindToSelectedProperty(linkButton.disableProperty());

    linkButtonContainer.getChildren().add(linkButton);
    return linkButton;
  }
Exemplo n.º 21
0
  @Override
  public void init() {
    backgroundImage = new ImageView();
    heatMapImage = new ImageView();
    buttonLoadBackgroundImage = new Button("BackgroundImage");
    buttonLoadHeatMapImage = new Button("HeatmapImage");
    toggleButtonShowHeatMap = new ToggleButton("hide");
    toggleButtonShowHeatMap.setSelected(true);

    AnchorPane.setLeftAnchor(buttonLoadBackgroundImage, 10d);
    AnchorPane.setTopAnchor(buttonLoadBackgroundImage, 10d);

    AnchorPane.setRightAnchor(buttonLoadHeatMapImage, 10d);
    AnchorPane.setTopAnchor(buttonLoadHeatMapImage, 10d);

    AnchorPane.setRightAnchor(toggleButtonShowHeatMap, 10d);
    AnchorPane.setTopAnchor(toggleButtonShowHeatMap, 40d);

    pane =
        new AnchorPane(
            backgroundImage,
            heatMapImage,
            buttonLoadBackgroundImage,
            buttonLoadHeatMapImage,
            toggleButtonShowHeatMap);

    registerListeners();
  }
Exemplo n.º 22
0
 private void registerListeners() {
   buttonLoadBackgroundImage.setOnAction(
       observable -> handleControlPropertyChanged("LOAD_BACKGROUND"));
   buttonLoadHeatMapImage.setOnAction(observable -> handleControlPropertyChanged("LOAD_HEATMAP"));
   toggleButtonShowHeatMap.setOnAction(
       observable -> handleControlPropertyChanged("TOGGLE_HEATMAP"));
 }
Exemplo n.º 23
0
 private void handleControlPropertyChanged(final String PROPERTY) {
   if ("LOAD_BACKGROUND".equals(PROPERTY)) {
     Image image = getImage(buttonLoadBackgroundImage.getScene().getWindow());
     if (null == image) return;
     backgroundImage.setImage(image);
     backgroundImage.toBack();
   } else if ("LOAD_HEATMAP".equals(PROPERTY)) {
     Image image = getImage(buttonLoadHeatMapImage.getScene().getWindow());
     if (null == image) return;
     heatMapImage.setImage(image);
     toggleButtonShowHeatMap.setSelected(true);
   } else if ("TOGGLE_HEATMAP".equals(PROPERTY)) {
     toggleButtonShowHeatMap.setText(toggleButtonShowHeatMap.isSelected() ? "show" : "hide");
     heatMapImage.setVisible(!toggleButtonShowHeatMap.isSelected());
   }
 }
Exemplo n.º 24
0
  @FXML
  private void handleP4SitLeave() {

    int iPlayerPosition = 4;

    if (bP4Sit == false) {
      Player p = new Player(txtP4Name.getText(), iPlayerPosition);
      mainApp.AddPlayerToTable(p);
      lblP4Name.setText(txtP4Name.getText());
      lblP4Name.setVisible(true);
      btnP4SitLeave.setText("Leave");
      txtP4Name.setVisible(false);
      bP4Sit = true;
    } else {
      mainApp.RemovePlayerFromTable(iPlayerPosition);
      btnP4SitLeave.setText("Sit");
      txtP4Name.setVisible(true);
      lblP4Name.setVisible(false);
      bP4Sit = false;
    }
  }
 private void setMode(Paint value) {
   if (value instanceof Color) {
     // make sure that a second click doesn't deselect the button
     if (colorToggleButton.isSelected() == false) {
       colorToggleButton.setSelected(true);
     }
     root_vbox.getChildren().remove(gradientPicker);
   } else if (value instanceof LinearGradient) {
     // make sure that a second click doesn't deselect the button
     if (linearToggleButton.isSelected() == false) {
       linearToggleButton.setSelected(true);
     }
     if (!root_vbox.getChildren().contains(gradientPicker)) {
       root_vbox.getChildren().add(gradientPicker);
     }
   } else if (value instanceof RadialGradient) {
     // make sure that a second click doesn't deselect the button
     if (radialToggleButton.isSelected() == false) {
       radialToggleButton.setSelected(true);
     }
     if (!root_vbox.getChildren().contains(gradientPicker)) {
       root_vbox.getChildren().add(gradientPicker);
     }
   } else {
     // Case not yet handled
     assert value instanceof ImagePattern;
   }
 }
Exemplo n.º 26
0
  /** defines what happens, before the GUI is started */
  public void initialize(URL location, ResourceBundle resources) {

    // set the controller var in the Main class to this Controller
    Main.controller = this;

    updateList();
    log.debug("List updated");

    // Formatting of the listView
    listView.setFixedCellSize(60);
    listView.setItems(items);
    addButton.setSelected(true);
    log.debug("ListView cellSize changed, items assigned");

    // is activated if the text in the searchbox is changed
    searchBox
        .textProperty()
        .addListener(
            (observable, oldVal, newVal) -> {
              renewSearch(newVal);
            });

    // is called when the selected Search Radiobutton is changed
    searchToggle
        .selectedToggleProperty()
        .addListener(
            new ChangeListener<Toggle>() {
              public void changed(
                  ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) {
                renewSearch(searchBox.getText());
              }
            });

    // gets called if an item in the listview is selected -> will load the
    // currently selected item
    // in the overview on the left
    listView
        .getSelectionModel()
        .getSelectedItems()
        .addListener(
            new ListChangeListener<ItemBox>() {
              @Override
              public void onChanged(
                  javafx.collections.ListChangeListener.Change<? extends ItemBox> c) {
                // Update the overview section on the left side of the GUI
                updateOverview();
              }
            });

    setupMenuItems();
  }
Exemplo n.º 27
0
 protected synchronized void updateFollowUpIcon() {
   if (file != null) {
     try {
       boolean hasFollowUp = hasFollowUp();
       Platform.runLater(
           () -> {
             followUpImageView.setImage(hasFollowUp ? followUpIcon : followUpGray);
             followUpToggle.setSelected(hasFollowUp);
           });
     } catch (TskCoreException ex) {
       LOGGER.log(Level.SEVERE, "Failed to get follow up status for file.", ex);
     }
   }
 }
Exemplo n.º 28
0
  private void loadAllmodels() {
    rnaSequence3D.addModel(new StickModel());
    rnaSequence3D.addModel(new MeshModel());
    rnaSequence3D.addModel(new BallModel());

    structureStick.selectedProperty().unbind();
    structureMesh.selectedProperty().unbind();
    structureBall.selectedProperty().unbind();

    rnaSequence3D.getModels().get(0).visibleProperty().bind(structureStick.selectedProperty());
    rnaSequence3D.getModels().get(1).visibleProperty().bind(structureMesh.selectedProperty());
    rnaSequence3D.getModels().get(2).visibleProperty().bind(structureBall.selectedProperty());

    tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(0));
    tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(1));
    tertiaryRoom.getObject().getChildren().addAll(rnaSequence3D.getModels().get(2));
  }
Exemplo n.º 29
0
  private void setFileDependingButtonBindings() {
    // MenuItems
    pyrpurItem.disableProperty().bind(model.fileLoadedProperty().not());
    augcItem.disableProperty().bind(model.fileLoadedProperty().not());
    meshItem.disableProperty().bind(model.fileLoadedProperty().not());
    stickItem.disableProperty().bind(model.fileLoadedProperty().not());
    ballItem.disableProperty().bind(model.fileLoadedProperty().not());

    // Buttons on the side
    colorPyrpur.disableProperty().bind(model.fileLoadedProperty().not());
    colorAugc.disableProperty().bind(model.fileLoadedProperty().not());
    structureMesh.disableProperty().bind(model.fileLoadedProperty().not());
    structureStick.disableProperty().bind(model.fileLoadedProperty().not());
    structureBall.disableProperty().bind(model.fileLoadedProperty().not());
    playRotate.disableProperty().bind(model.fileLoadedProperty().not());
    rotateLeft.disableProperty().bind(model.fileLoadedProperty().not());
    rotateRight.disableProperty().bind(model.fileLoadedProperty().not());
    zoomIn.disableProperty().bind(model.fileLoadedProperty().not());
    zoomOut.disableProperty().bind(model.fileLoadedProperty().not());
    centerObject.disableProperty().bind(model.fileLoadedProperty().not());
  }
Exemplo n.º 30
0
  private static void hubNodeHidingListener(
      PopOver popover, HUB hubObject, Pane canvas, ContextMenu contextMenu) {
    try {
      // eveything in the popover
      VBox contentPane = (VBox) popover.getContentNode();
      // find the header row
      HBox headerRow = (HBox) contentPane.getChildren().get(0);
      // find the toggle button
      ToggleButton toggleBtn = (ToggleButton) headerRow.getChildren().get(1);
      // the old key used to find the correlating vmObject
      HUB oldHub = hubObject;

      // only update with it's not in edit mode
      if (!toggleBtn.isSelected()) {
        HUB newHubObject = new HUB();
        TreeSet<String> newInterfaces = new TreeSet<String>();
        for (Node row : contentPane.getChildren()) {
          if (row instanceof HBox) {
            ObservableList<Node> childNode = ((HBox) row).getChildren();
            for (int i = 0; i < childNode.size(); i++) {
              if (childNode.get(i) instanceof Label) {
                if (((Label) childNode.get(i)).getText().matches("Name.*")) {
                  String hubName = ((TextField) childNode.get(i + 1)).getText();
                  // only validate name if it's different than
                  // the current one
                  if (!oldHub.getName().equals(hubName)) {
                    // make sure name input is a valid name
                    if (Validator.validateName(hubName)) {
                      newHubObject.setName(hubName);
                    } else {
                      // if input is not valid, warn user
                      // and keep the old one
                      creatAlert(((Label) childNode.get(i)).getText(), "HUB");
                      newHubObject.setName(oldHub.getName());
                    }
                  } else {
                    // set it to old name if it did not
                    // change
                    newHubObject.setName(oldHub.getName());
                  }
                  // same general idea goes for the rest of
                  // the labels
                  // if input is different
                  // then test it's validation before making
                  // changes
                  // if it's not valid then warn the user
                  // else just set it to the old one
                } else if (((Label) childNode.get(i)).getText().matches("Subnet.*")) {
                  String hubSubnet = ((TextField) childNode.get(i + 1)).getText();
                  if (!oldHub.getSubnet().equals(hubSubnet)) {
                    if (Validator.validateIp(hubSubnet)) {
                      newHubObject.setSubnet(hubSubnet);
                    } else {
                      creatAlert(((Label) childNode.get(i)).getText(), "HUB");
                      newHubObject.setSubnet(oldHub.getSubnet());
                    }
                  } else {
                    newHubObject.setSubnet(oldHub.getSubnet());
                  }
                } else if (((Label) childNode.get(i)).getText().matches("Netmask.*")) {
                  String hubNetmask = ((TextField) childNode.get(i + 1)).getText();
                  if (Validator.validateNetmask(hubNetmask)) {
                    newHubObject.setNetmask(hubNetmask);
                  } else {
                    creatAlert(((Label) childNode.get(i)).getText(), "HUB");
                    newHubObject.setNetmask(oldHub.getNetmask());
                  }
                } else if (((Label) childNode.get(i)).getText().matches("Inf.*")) {
                  String infValue = ((TextField) childNode.get(i + 1)).getText();
                  // if field is not empty
                  if (!infValue.isEmpty()) {
                    // if the interface is not in the old
                    // ones
                    if (!oldHub.getInfs().contains(infValue)) {
                      String hubNetmask = null;
                      if (!hubObject.getSubnet().equals(hubNetmask)) {
                        hubNetmask = newHubObject.getNetmask();
                      } else {
                        hubNetmask = oldHub.getNetmask();
                      }
                      // if new inf value is valid then
                      // insert the new one
                      if (Validator.validateHubInf(infValue)
                          && Validator.validateSubnetting(
                              newHubObject.getNetmask(), infValue, newHubObject.getSubnet())) {
                        newInterfaces.add(infValue);
                      } else {
                        creatAlert("Inf.", "HUB");
                      }
                    } else {
                      newInterfaces.add(infValue);
                    }
                  }
                }
              }
            }
          }
        }
        newHubObject.setInfs(newInterfaces);
        Data.hubMap.replace(oldHub.getName(), newHubObject);
        // here we don't want to simply delete old entry because of the
        // coordinates
        // so we update the key to a different key if they change the
        // Hub Object name
        LinkedHashMap<String, HUB> updatedMap =
            Data.replaceHUBKey(Data.hubMap, oldHub.getName(), newHubObject.getName());
        Data.hubMap = updatedMap;
        draw(canvas, contextMenu);
      }
    } catch (IndexOutOfBoundsException e) {
      System.out.println("Something went wrong");
    }
  }