Beispiel #1
0
  /**
   * Creates new form GTPanel
   *
   * @param name
   * @param gr
   * @param ds
   */
  public GTPanel(String name, UPGMAItem gr, TypingData<? extends Profile> ds) {
    super(Lookups.singleton(gr));
    initComponents();
    this.setName(name);

    this.ds = ds;
    String distanceProvider = gr.getDistanceProvider();
    int split = distanceProvider.lastIndexOf(".") + 1;
    distanceProvider = distanceProvider.substring(split);
    uv = new UPGMAViewer(name, gr.getRoot(), distanceProvider);

    Visualization viz = gr.getVisualization();
    if (viz != null && viz.pv != null) {
      loadVisualization(viz);
    }

    tvc = uv.generateTreeViewComponent();

    this.add(tvc);
    gvCatListen =
        new CategoryChangeListener() {

          @Override
          public void categoryChange(CategoryProvider cp) {

            if (cp.isOn()) {
              catProvider = cp;
              uv.setDefaultRenderer(new ChartRenderer(cp, uv));
              uv.setCategoryProvider(cp);
            } else {
              catProvider = null;
              uv.resetDefaultRenderer();
              uv.setCategoryProvider(null);
            }
          }
        };

    // Let us track category providers...
    // TODO: implement this within a renderer.
    r = ds.getLookup().lookupResult(CategoryProvider.class);
    Iterator<? extends CategoryProvider> i = r.allInstances().iterator();
    while (i.hasNext()) i.next().addCategoryChangeListener(gvCatListen);

    r.addLookupListener(
        new LookupListener() {

          @SuppressWarnings("unchecked")
          @Override
          public void resultChanged(LookupEvent le) {

            Iterator<? extends CategoryProvider> i =
                ((Result<CategoryProvider>) le.getSource()).allInstances().iterator();
            while (i.hasNext()) {
              CategoryProvider cp = i.next();
              cp.removeCategoryChangeListener(gvCatListen);
              cp.addCategoryChangeListener(gvCatListen);
            }
          }
        });
  }
Beispiel #2
0
 public TagsRootNode() {
   super(Children.create(new Tags.TagsRootChildren(), true), Lookups.singleton(NAME));
   super.setName(NAME);
   super.setDisplayName(NAME);
   this.setIconBaseWithExtension(TAG_ICON_PATH);
   initData();
 }
 /**
  * Creates a new instance of CookieProxyLookup.
  *
  * @param lookups the Lookup instances to which we proxy.
  * @param delegate the Node delegate from which cookies come.
  */
 public SourceCookieProxyLookup(Lookup[] lookups, Node delegate) {
   super();
   this.lookups = lookups;
   this.delegate = delegate;
   setLookups(
       new Lookup[] {new ProxyLookup(lookups), delegate.getLookup(), Lookups.singleton(delegate)});
 }
 public RootNode(Node node, TitanPlatformProject project) throws DataObjectNotFoundException {
   super(
       node,
       new FilterNode.Children(node),
       new ProxyLookup(new Lookup[] {Lookups.singleton(project), node.getLookup()}));
   this.project = project;
 }
 public synchronized void propertyChange(PropertyChangeEvent event) {
   if (propertyChanging) {
     // Avoid an infinite loop whereby changing the lookup contents
     // causes the activated nodes to change, which calls us again.
     return;
   }
   propertyChanging = true;
   try {
     Node[] newNodes = (Node[]) event.getNewValue();
     if (newNodes == null || newNodes.length == 0) {
       setLookups(
           new Lookup[] {
             new ProxyLookup(lookups),
             new NoNodeLookup(delegate.getLookup()),
             Lookups.singleton(delegate)
           });
     } else {
       Lookup[] newNodeLookups = new Lookup[newNodes.length];
       for (int i = 0; i < newNodes.length; i++) {
         newNodeLookups[i] = new NoNodeLookup(newNodes[i].getLookup());
       }
       setLookups(
           new Lookup[] {
             new ProxyLookup(lookups),
             new ProxyLookup(newNodeLookups),
             Lookups.fixed((Object[]) newNodes)
           });
     }
   } finally {
     propertyChanging = false;
   }
 }
Beispiel #6
0
 public SceneComponentNode(MainSceneComponent msc) {
   super(Children.LEAF, Lookups.singleton(msc));
   this.msc = msc;
   this.msc.addPropertyChangeListener(this);
   this.setDisplayName(msc.getType().name() + ": " + msc.getComponentName());
   this.setName(msc.toString());
 }
Beispiel #7
0
 public NetworkVertexNode(Children children, NetworkElementApi data, NetworkCaseSetApi caseData) {
   super(children, Lookups.singleton(data));
   this.setVertexModelData(data);
   this.setCaseModelData(caseData);
   this.setDisplayName(data.getValue());
   this.AddModelListeners();
 }
Beispiel #8
0
 /**
  * @param skCase
  * @param filter
  * @param o Observable that provides updates when events are fired
  */
 FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter, Observable o) {
   super(
       Children.create(new FileSizeChildren(filter, skCase, o), true),
       Lookups.singleton(filter.getDisplayName()));
   this.filter = filter;
   init();
   o.addObserver(new FileSizeNodeObserver());
 }
Beispiel #9
0
 // use version with observer instead so that it updates
 @Deprecated
 FileSizeNode(SleuthkitCase skCase, FileSizeFilter filter) {
   super(
       Children.create(new FileSizeChildren(filter, skCase, null), true),
       Lookups.singleton(filter.getDisplayName()));
   this.filter = filter;
   init();
 }
Beispiel #10
0
 public static void renameProject(Project p, Object caller) {
   if (p == null) {
     return;
   }
   ContextAwareAction action = (ContextAwareAction) CommonProjectActions.renameProjectAction();
   Lookup ctx = Lookups.singleton(p);
   Action ctxAction = action.createContextAwareInstance(ctx);
   ctxAction.actionPerformed(new ActionEvent(caller, 0, "")); // NOI18N
 }
 public PackageNode(FileObject root, DataFolder dataFolder, boolean empty) {
   super(
       dataFolder.getNodeDelegate(),
       empty ? Children.LEAF : dataFolder.createNodeChildren(NO_FOLDERS_FILTER),
       new ProxyLookup(
           new Lookup[] {
             Lookups.singleton(new NoFoldersContainer(dataFolder)),
             dataFolder.getNodeDelegate().getLookup(),
             Lookups.singleton(
                 PackageRootNode.alwaysSearchableSearchInfo(
                     SearchInfoFactory.createSearchInfo(
                         dataFolder.getPrimaryFile(),
                         false, // not recursive
                         new FileObjectFilter[] {SearchInfoFactory.VISIBILITY_FILTER}))),
           }));
   this.root = root;
   this.dataFolder = dataFolder;
   this.isDefaultPackage = root.equals(dataFolder.getPrimaryFile());
 }
Beispiel #12
0
 public PathNode(Children children, List<NetworkElementApi> edges) {
   super(children, Lookups.singleton(edges));
   this.setPathModel(edges);
   if (edges.get(0).getNetworkElementType() == NetworkElementApi.NetworkElementType.NODE) {
     this.setDisplayName("End Points");
   }
   if (edges.get(0).getNetworkElementType() == NetworkElementApi.NetworkElementType.EDGE) {
     this.setDisplayName("Path-Size: " + mEdges.size());
   }
 }
 public void testFindTestSources() throws Exception {
   NbModuleProject p = generateStandaloneModule("p");
   FileObject test = p.getTestSourceDirectory("unit");
   FileObject oneTest = FileUtil.createData(test, "p/OneTest.java");
   FileObject r = FileUtil.createData(test, "p/r.png");
   FileObject otherTest = FileUtil.createData(test, "p/OtherTest.java");
   FileObject pkg = test.getFileObject("p");
   FileObject thirdTest = FileUtil.createData(test, "p2/ThirdTest.java");
   ModuleActions a = new ModuleActions(p);
   assertEquals("null", String.valueOf(a.findTestSources(Lookup.EMPTY, false)));
   assertEquals(
       "unit:p/OneTest.java",
       String.valueOf(a.findTestSources(Lookups.singleton(oneTest), false)));
   assertEquals(
       "unit:p/OneTest.java,p/OtherTest.java",
       String.valueOf(a.findTestSources(Lookups.fixed(oneTest, otherTest), false)));
   assertEquals("null", String.valueOf(a.findTestSources(Lookups.singleton(pkg), false)));
   assertEquals("null", String.valueOf(a.findTestSources(Lookups.singleton(r), false)));
   assertEquals("null", String.valueOf(a.findTestSources(Lookups.fixed(oneTest, r), false)));
   assertEquals("null", String.valueOf(a.findTestSources(Lookup.EMPTY, true)));
   assertEquals(
       "unit:p/OneTest.java", String.valueOf(a.findTestSources(Lookups.singleton(oneTest), true)));
   assertEquals(
       "unit:p/OneTest.java,p/OtherTest.java",
       String.valueOf(a.findTestSources(Lookups.fixed(oneTest, otherTest), true)));
   assertEquals("unit:p/**", String.valueOf(a.findTestSources(Lookups.singleton(pkg), true)));
   assertEquals(
       "unit:p/**,p2/ThirdTest.java",
       String.valueOf(a.findTestSources(Lookups.fixed(pkg, thirdTest), true)));
   assertEquals("null", String.valueOf(a.findTestSources(Lookups.singleton(r), true)));
   assertEquals("null", String.valueOf(a.findTestSources(Lookups.fixed(oneTest, r), true)));
 }
  @Override
  protected Node[] createNodes(Object key) {

    final Enterprise enterprise1 = (Enterprise) key;
    Node result;
    result =
        new AbstractNode(new EnterpriseChildren(enterprise1), Lookups.singleton(enterprise1)) {

          @Override
          protected Sheet createSheet() {
            Sheet sheet = Sheet.createDefault();
            Sheet.Set set = Sheet.createPropertiesSet();

            Property giamDocProperty =
                new PropertySupport.ReadOnly<String>(Giamdoc_PROPERTY, String.class, "Thu", "aaa") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateSumImportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(giamDocProperty);
            Property congTyMeProperty =
                new PropertySupport.ReadOnly<String>(
                    Congtyme_PROPERTY, String.class, "Chi", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateSumExportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(congTyMeProperty);
            sheet.put(set);
            return sheet;
          }
        };

    result.setDisplayName(enterprise1.getEnterpriseName());
    return new Node[] {result};
  }
Beispiel #15
0
    TagNodeRoot(
        BlackboardArtifact.ARTIFACT_TYPE tagType,
        String tagName,
        List<BlackboardArtifact> artifacts) {
      super(
          Children.create(new Tags.TagsChildrenNode(tagType, tagName, artifacts), true),
          Lookups.singleton(tagName));

      super.setName(tagName);
      super.setDisplayName(tagName + " (" + artifacts.size() + ")");

      if (tagName.equals(BOOKMARK_TAG_NAME)) {
        this.setIconBaseWithExtension(BOOKMARK_ICON_PATH);
      } else {
        this.setIconBaseWithExtension(TAG_ICON_PATH);
      }
    }
  @Override
  protected Node createNodeForKey(KeyValueQueryContent key) {
    final Content content = key.getContent();
    final String queryStr = key.getQueryStr();
    ;
    QueryResults hits = key.getHits();

    Node kvNode = new KeyValueNode(key, Children.LEAF, Lookups.singleton(content));

    // wrap in KeywordSearchFilterNode for the markup content, might need to override FilterNode for
    // more customization
    // store the data in HighlightedMatchesSource so that it can be looked up (in content viewer)
    HighlightedTextMarkup highlights =
        new HighlightedTextMarkup(
            key.solrObjectId, queryStr, !key.getQuery().isLiteral(), false, hits);
    return new KeywordSearchFilterNode(highlights, kvNode);
  }
 public void testDebugFix() throws Exception {
   // Track down #47012.
   Project freeform =
       ProjectManager.getDefault().findProject(FileUtil.toFileObject(file("ant.freeform")));
   assertNotNull("have project in ant/freeform", freeform);
   ActionProvider ap = freeform.getLookup().lookup(ActionProvider.class);
   assertNotNull("have ActionProvider", ap);
   FileObject actionsJava =
       FileUtil.toFileObject(
           file("ant.freeform/src/org/netbeans/modules/ant/freeform/Actions.java"));
   assertNotNull("have Actions.java", actionsJava);
   assertTrue(
       "Fix enabled on it",
       ap.isActionEnabled(
           JavaProjectConstants.COMMAND_DEBUG_FIX,
           Lookups.singleton(DataObject.find(actionsJava))));
 }
Beispiel #18
0
    TagsNodeRoot(
        BlackboardArtifact.ARTIFACT_TYPE tagType, Map<String, List<BlackboardArtifact>> subTags) {
      super(
          Children.create(new TagRootChildren(tagType, subTags), true),
          Lookups.singleton(tagType.getDisplayName()));

      String name = null;
      if (tagType.equals(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE)) {
        name = FILE_TAG_LABEL_NAME;
      } else if (tagType.equals(BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_ARTIFACT)) {
        name = RESULT_TAG_LABEL_NAME;
      }

      super.setName(name);
      super.setDisplayName(name + " (" + subTags.values().size() + ")");

      this.setIconBaseWithExtension(TAG_ICON_PATH);
    }
  /**
   * Sets the {@link Process} whose information to display
   *
   * @param processFullId
   * @param p
   */
  public void setData(String processFullId, Process p) {
    this.processFullId = processFullId;
    process = p;
    setName(processFullId);
    Activities activities = ((Activities) p.getActivity().getValue());
    AbstractNode root =
        new AbstractNode(
            Children.create(new ActivitiesChildFactory(activities), false), Lookups.singleton(p));
    root.setDisplayName(processFullId);

    em.setRootContext(root);
    Node n = root.getChildren().getNodes()[0];
    Property[] columnProperties = n.getPropertySets()[0].getProperties();
    treeTableView.setProperties(columnProperties);
    treeTableView.setTreePreferredWidth(600);
    treeTableView.setTableColumnPreferredWidth(0, 75);
    treeTableView.setTableColumnPreferredWidth(1, 150);
    ((myTreeTableView) treeTableView).setRenderers();
    openTreeToCurrentState();
  }
  /** Not private because of the tests. */
  static Lookup createActionContext(JTextComponent c) {
    Lookup nodeLookup = null;
    DataObject dobj = (c != null) ? NbEditorUtilities.getDataObject(c.getDocument()) : null;
    if (dobj != null && dobj.isValid()) {
      nodeLookup = dobj.getNodeDelegate().getLookup();
    }

    Lookup ancestorLookup = null;
    for (java.awt.Component comp = c; comp != null; comp = comp.getParent()) {
      if (comp instanceof Lookup.Provider) {
        Lookup lookup = ((Lookup.Provider) comp).getLookup();
        if (lookup != null) {
          ancestorLookup = lookup;
          break;
        }
      }
    }

    Lookup componentLookup = Lookups.singleton(c);
    if (nodeLookup == null && ancestorLookup == null) {
      return componentLookup;
    } else if (nodeLookup == null) {
      return new ProxyLookup(new Lookup[] {ancestorLookup, componentLookup});
    } else if (ancestorLookup == null) {
      return new ProxyLookup(new Lookup[] {nodeLookup, componentLookup});
    }
    assert nodeLookup != null && ancestorLookup != null;

    Node node = (Node) nodeLookup.lookup(Node.class);
    boolean ancestorLookupContainsNode =
        ancestorLookup.lookup(new Lookup.Template(Node.class)).allInstances().contains(node);

    if (ancestorLookupContainsNode) {
      return new ProxyLookup(new Lookup[] {ancestorLookup, componentLookup});
    } else {
      return new ProxyLookup(new Lookup[] {nodeLookup, ancestorLookup, componentLookup});
    }
  }
    private CustomTestAction(JavaTestTask testTask, String name) {
      super(name);

      this.context = Lookups.singleton(new TestTaskName(testTask.getName()));
      this.displayName = name;
    }
 public NiftyControlNode(GElement gTreeNode) {
   super(Children.create(new NiftyNodeFactory(gTreeNode), true), Lookups.singleton(gTreeNode));
   setDisplayName("Control " + gTreeNode.getAttribute("id"));
 }
 CarEditorTopComponent(Car bean) {
   setDisplayName(bean.getBrand());
   associateLookup(Lookups.singleton(bean));
 }
 public AbstractPropertiesNode(String name, AbstractPropertyListener listener) {
   super(Children.LEAF, Lookups.singleton(listener));
   setDisplayName(name);
   listener.addPropertyChangeListener((PropertyChangeListener) this);
 }
  @Override
  protected Node[] createNodes(Object key) {
    final Department department1 = (Department) key;

    // Node rootNode = new AbstractNode(new
    // PersonChildren(person1,enterprise),Lookups.singleton(department1));

    if (department1.getEnterpriseID().equals("")) {
      Node rootNode = null;
      rootNode =
          new AbstractNode(
              new PersonParent(department1, enterprise), Lookups.singleton(department1));
      rootNode.setDisplayName("Person");
      return new Node[] {rootNode};
    } else {
      Node result =
          new AbstractNode(
              new DepartmentChildren(department1, enterprise), Lookups.singleton(department1)) {

            @Override
            protected Sheet createSheet() {
              Sheet sheet = Sheet.createDefault();
              Sheet.Set set = Sheet.createPropertiesSet();

              Property giamDocProperty =
                  new PropertySupport.ReadOnly<String>(
                      Giamdoc_PROPERTY, String.class, "Trưởng phòng", "aaa") {

                    @Override
                    public String getValue()
                        throws IllegalAccessException, InvocationTargetException {
                      return department1.getPersonID();
                    }

                    @Override
                    public PropertyEditor getPropertyEditor() {
                      return new PropertyEditorSupport();
                    }
                  };
              set.put(giamDocProperty);
              Property congTyMeProperty =
                  new PropertySupport.ReadOnly<String>(
                      Congtyme_PROPERTY, String.class, "Công ty", "bbb") {

                    @Override
                    public String getValue()
                        throws IllegalAccessException, InvocationTargetException {
                      return department1.getEnterpriseID();
                    }

                    @Override
                    public PropertyEditor getPropertyEditor() {
                      return new PropertyEditorSupport();
                    }
                  };
              set.put(congTyMeProperty);
              sheet.put(set);
              return sheet;
            }
          };

      result.setDisplayName(department1.getDepartmentName());
      return new Node[] {result};
    }
  }
Beispiel #26
0
 public Lookup getLookup() {
   return Lookups.singleton(this);
 }
Beispiel #27
0
 FileSizeRootNode(SleuthkitCase skCase) {
   super(Children.create(new FileSizeRootChildren(skCase), true), Lookups.singleton(NAME));
   super.setName(NAME);
   super.setDisplayName(NAME);
   this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-size-16.png"); // NON-NLS
 }
Beispiel #28
0
  @Override
  protected Node[] createNodes(Object key) {

    final Enterprise enterprise1 = (Enterprise) key;
    Node result;
    result =
        new AbstractNode(new EnterpriseChildren(enterprise1), Lookups.singleton(enterprise1)) {

          @Override
          protected Sheet createSheet() {
            Sheet sheet = Sheet.createDefault();
            Sheet.Set set = Sheet.createPropertiesSet();

            Property thuMonth1Property =
                new PropertySupport.ReadOnly<String>(
                    ThuMonth1_PROPERTY, String.class, "ThuM1", "aaa") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateImportByMonth(enterprise1, month1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(thuMonth1Property);
            Property chiMonth1Property =
                new PropertySupport.ReadOnly<String>(
                    ChiMonth1_PROPERTY, String.class, "ChiM1", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateExportByMonth(enterprise1, month1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(chiMonth1Property);
            Property thuMonth2Property =
                new PropertySupport.ReadOnly<String>(
                    ThuMonth2_PROPERTY, String.class, "ThuM2", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateImportByMonth(enterprise1, month2));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(thuMonth2Property);
            Property chiMonth2Property =
                new PropertySupport.ReadOnly<String>(
                    ChiMonth2_PROPERTY, String.class, "ChiM2", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateExportByMonth(enterprise1, month2));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(chiMonth2Property);
            Property thuMonth3Property =
                new PropertySupport.ReadOnly<String>(
                    ThuMonth3_PROPERTY, String.class, "ThuM3", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateImportByMonth(enterprise1, month3));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(thuMonth3Property);
            Property chiMonth3Property =
                new PropertySupport.ReadOnly<String>(
                    ChiMonth3_PROPERTY, String.class, "ChiM3", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateExportByMonth(enterprise1, month3));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(chiMonth3Property);
            Property laiMonth1Property =
                new PropertySupport.ReadOnly<String>(Lai1_PROPERTY, String.class, "LaiM1", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(
                        calculateSPI.calculateImportByMonth(enterprise1, month1)
                            - calculateSPI.calculateExportByMonth(enterprise1, month1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(laiMonth1Property);
            Property laiMonth2Property =
                new PropertySupport.ReadOnly<String>(Lai2_PROPERTY, String.class, "LaiM2", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(
                        calculateSPI.calculateImportByMonth(enterprise1, month2)
                            - calculateSPI.calculateExportByMonth(enterprise1, month2));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(laiMonth2Property);
            Property lMaionth3Property =
                new PropertySupport.ReadOnly<String>(Lai3_PROPERTY, String.class, "LaiM3", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(
                        calculateSPI.calculateImportByMonth(enterprise1, month3)
                            - calculateSPI.calculateExportByMonth(enterprise1, month3));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(lMaionth3Property);
            Property thuYear1Property =
                new PropertySupport.ReadOnly<String>(
                    ThuYear1_PROPERTY, String.class, "ThuY1", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateImportByYear(enterprise1, year1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(thuYear1Property);
            Property chiYear1Property =
                new PropertySupport.ReadOnly<String>(
                    ChiYear1_PROPERTY, String.class, "ChiY1", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateExportByYear(enterprise1, year1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(chiYear1Property);
            Property laiYear1Property =
                new PropertySupport.ReadOnly<String>(
                    LaiYear1_PROPERTY, String.class, "LaiY1", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(
                        calculateSPI.calculateImportByYear(enterprise1, year1)
                            - calculateSPI.calculateExportByYear(enterprise1, year1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(laiYear1Property);

            Property thuYear2Property =
                new PropertySupport.ReadOnly<String>(
                    ThuYear2_PROPERTY, String.class, "ThuY2", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateImportByYear(enterprise1, year2));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(thuYear2Property);
            Property chiYear2Property =
                new PropertySupport.ReadOnly<String>(
                    ChiYear2_PROPERTY, String.class, "ChiY2", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateExportByYear(enterprise1, year2));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(chiYear2Property);
            Property laiYear2Property =
                new PropertySupport.ReadOnly<String>(
                    LaiYear2_PROPERTY, String.class, "LaiY2", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(
                        calculateSPI.calculateImportByYear(enterprise1, year2)
                            - calculateSPI.calculateExportByYear(enterprise1, year2));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(laiYear2Property);
            Property thuAllProperty =
                new PropertySupport.ReadOnly<String>(
                    ThuAll_PROPERTY, String.class, "ThuAll", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateSumImportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(thuAllProperty);
            Property chiAllProperty =
                new PropertySupport.ReadOnly<String>(
                    ChiAll_PROPERTY, String.class, "ChiAll", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(calculateSPI.calculateSumExportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(chiAllProperty);
            Property laiAllProperty =
                new PropertySupport.ReadOnly<String>(
                    LaiAll_PROPERTY, String.class, "LaiAll", "bbb") {

                  @Override
                  public String getValue()
                      throws IllegalAccessException, InvocationTargetException {
                    return String.valueOf(
                        calculateSPI.calculateSumImportByEnterprise(enterprise1)
                            - calculateSPI.calculateSumExportByEnterprise(enterprise1));
                  }

                  @Override
                  public PropertyEditor getPropertyEditor() {
                    return new PropertyEditorSupport();
                  }
                };
            set.put(laiAllProperty);
            sheet.put(set);
            return sheet;
          }
        };
    result.setDisplayName(enterprise1.getEnterpriseName());
    return new Node[] {result};
  }
Beispiel #29
0
 GoalNode(Goals goals, int goalIndex) {
   super(goals, goalIndex, Children.LEAF, Lookups.singleton(goals));
   setDisplayName(Bundle.FN_goal_display_name(goalIndex + 1));
   setChildren(Children.create(new GoalPremisesConclusionFactory(this), false));
 }
 public ExtractedContentNode(SleuthkitCase skCase) {
   super(Children.create(new ExtractedContentChildren(skCase), true), Lookups.singleton(NAME));
   super.setName(NAME);
   super.setDisplayName(NAME);
   this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/extracted_content.png");
 }