コード例 #1
0
 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;
   }
 }
コード例 #2
0
ファイル: HeatMapViewer.java プロジェクト: HanSolo/FxHeatMap
 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());
   }
 }
コード例 #3
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);
            }
          }
        });
  }
コード例 #4
0
ファイル: Graphics.java プロジェクト: garrettrowell/CSET-3600
  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");
    }
  }
コード例 #5
0
ファイル: Graphics.java プロジェクト: garrettrowell/CSET-3600
  private static void vmNodeHidingListener(
      PopOver popover, VM vmObject, 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
      VM oldVM = vmObject;

      // only update with it's not in edit mode
      if (!toggleBtn.isSelected()) {
        VM newVmObject = new VM();
        TreeMap<String, String> newInterfaces = new TreeMap<String, 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 vmName = ((TextField) childNode.get(i + 1)).getText();
                  // only validate name if it's different than
                  // the current one
                  if (!oldVM.getName().equals(vmName)) {
                    // make sure name input is a valid name
                    if (Validator.validateName(vmName)) {
                      newVmObject.setName(vmName);
                    } else {
                      // if input is not valid, warn user
                      // and keep the old one
                      creatAlert(((Label) childNode.get(i)).getText(), "VM");
                      newVmObject.setName(oldVM.getName());
                    }
                  } else {
                    // set it to old name if it did not
                    // change
                    newVmObject.setName(oldVM.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("OS.*")) {
                  String vmOs = ((TextField) childNode.get(i + 1)).getText();
                  if (Validator.validateOs(vmOs)) {
                    newVmObject.setOs(vmOs);
                  } else {
                    creatAlert(((Label) childNode.get(i)).getText(), "VM");
                    newVmObject.setOs(oldVM.getOs());
                  }
                } else if (((Label) childNode.get(i)).getText().matches("Ver.*")) {
                  String vmVer = ((TextField) childNode.get(i + 1)).getText();
                  if (Validator.validateVer(vmVer)) {
                    newVmObject.setVer(Double.parseDouble(vmVer));
                  } else {
                    creatAlert(((Label) childNode.get(i)).getText(), "VM");
                    newVmObject.setVer(oldVM.getVer());
                  }
                } else if (((Label) childNode.get(i)).getText().matches("Src.*")) {
                  String vmSrc = ((TextField) childNode.get(i + 1)).getText();
                  if (Validator.validateSrc(vmSrc)) {
                    newVmObject.setSrc(vmSrc);
                  } else {
                    creatAlert(((Label) childNode.get(i)).getText(), "VM");
                    newVmObject.setSrc(oldVM.getSrc());
                  }
                } else if (((Label) childNode.get(i)).getText().matches("(\\w+?).(\\w+?\\d+?.*)")) {
                  String ipLabel = ((Label) childNode.get(i)).getText();
                  String vmIp = ((TextField) childNode.get(i + 1)).getText().trim();
                  // does the eth# interface already exist?
                  if (oldVM.getInterfaces().containsKey(ipLabel)) {
                    // is the new ip value equal to the old
                    // one
                    if (!oldVM.getInterfaces().get(ipLabel).equals(vmIp)) {
                      // if it's a new ip, validate and
                      // set it
                      if (Validator.validateIp(vmIp)) {
                        newInterfaces.put(ipLabel, vmIp);
                      } else {
                        // if not, alert user and set to
                        // old ip
                        creatAlert(ipLabel, "VM");
                        newInterfaces.put(ipLabel, oldVM.getInterfaces().get(ipLabel));
                      }
                    } else {
                      // if ip value didn't change just
                      // set to old value
                      newInterfaces.put(ipLabel, oldVM.getInterfaces().get(ipLabel));
                    }
                  } else {
                    // if that eth# doesn't exist yet
                    // validate it and set it
                    // only set the new eth# if the new ip
                    // value is valid
                    if (!vmIp.isEmpty()) {
                      if (Validator.validateIp(vmIp)) {
                        newInterfaces.put(ipLabel, vmIp);
                      } else {
                        // tell user there was an error
                        // and don't insert the new eth#
                        // interface
                        creatAlert(ipLabel, "VM");
                      }
                    }
                  }
                }
              }
            }
          }
        }
        newVmObject.setInterfaces(newInterfaces);
        Data.vmMap.replace(oldVM.getName(), newVmObject);
        // 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 VM
        // Object name
        LinkedHashMap<String, VM> updatedMap =
            Data.replaceVMKey(Data.vmMap, oldVM.getName(), newVmObject.getName());
        Data.vmMap = updatedMap;
        draw(canvas, contextMenu);
      }
    } catch (IndexOutOfBoundsException e) {
      System.out.println("Something went Wrong");
    }
  }
コード例 #6
0
ファイル: Dock.java プロジェクト: ludup/hypersocket-client
  private void rebuildIcons() {

    if (mode != Mode.LAUNCHERS) {
      return;
    }

    context.clearLoadQueue();
    flinger.getContent().getChildren().clear();

    // Type lastType = null;
    for (Map.Entry<ResourceGroupKey, ResourceGroupList> ig : icons.entrySet()) {
      Type type = ig.getKey().getType();
      // if (lastType != null && type != lastType) {
      // shortcuts
      // .getChildren()
      // .add(new Separator(
      // cfg.topProperty().get()
      // || cfg.bottomProperty().get() ? Orientation.VERTICAL
      // : Orientation.HORIZONTAL));
      // }
      switch (type) {
        case SSO:
          if (!ssoResources.isSelected()) continue;
          break;
        case BROWSER:
          if (!browserResources.isSelected()) continue;
          break;
        case FILE:
          if (!fileResources.isSelected()) continue;
          break;
        case NETWORK:
          if (!networkResources.isSelected()) continue;
          break;
        default:
          break;
      }

      List<ResourceGroupList> groupsAdded = new ArrayList<ResourceGroupList>();
      for (ResourceItem item : ig.getValue().getItems()) {
        ResourceGroupKey gk =
            new ResourceGroupKey(item.getResource().getType(), item.getResource().getGroup());
        ResourceGroupList groups = icons.get(gk);
        if (groups == null || groups.getItems().size() < 2) {
          flinger
              .getContent()
              .getChildren()
              .add(
                  new IconButton(resources, item, context, ig.getValue()) {

                    @Override
                    protected void onFinishLaunch() {
                      super.onFinishLaunch();

                      if (launchWait != null
                          && launchWait.getStatus() == javafx.animation.Animation.Status.RUNNING)
                        launchWait.stop();

                      launchWait = new Timeline(new KeyFrame(Duration.millis(Dock.LAUNCH_WAIT)));
                      launchWait.play();
                    }
                  });
        } else {
          if (!groupsAdded.contains(groups)) {
            flinger
                .getContent()
                .getChildren()
                .add(
                    new GroupButton(resources, context, groups) {

                      @Override
                      protected void onFinishLaunch() {
                        super.onFinishLaunch();

                        if (launchWait != null
                            && launchWait.getStatus() == javafx.animation.Animation.Status.RUNNING)
                          launchWait.stop();

                        launchWait = new Timeline(new KeyFrame(Duration.millis(Dock.LAUNCH_WAIT)));
                        launchWait.play();
                      }
                    });
            groupsAdded.add(groups);
          }
        }
      }

      // lastType = type;
    }
  }