Ejemplo n.º 1
0
  public ResultsTopComponent(RtcQuery query) {
    this.query = query;
    manager = new ExplorerManager();
    initComponents();
    outlineView = new RtcOutline();
    outlineView.getOutline().addMouseListener(new MouseListenerImpl(outlineView.getOutline()));
    outlineView.getOutline().setDefaultEditor(Property.class, null);

    outlineView
        .getOutline()
        .setDefaultRenderer(
            Property.class,
            new LabelProviderTableCellRenderer(
                outlineView.getOutline().getDefaultRenderer(Property.class)));
    outlineView.getOutline().setDefaultRenderer(Object.class, new EmptyTableCellRenderer());

    //        outlineView.getOutline().getModel()

    Outline outline = outlineView.getOutline();
    this.removeDefaultColumn(outline);
    outline.setRootVisible(false);
    add(outlineView);

    ic.add(this.query);
    HashMap hm = new HashMap();
    hm.put(query, previousQuery);
    ic.add(hm);
    previousQuery = this.query;

    setDisplayName(
        NbBundle.getMessage(ResultsTopComponent.class, "ResultTopComponent.name")
            + " "
            + this.query.getEditableName());
    setFocusable(true);
  }
 @Override
 public Lookup createLookup() {
   InstanceContent ic = new InstanceContent();
   ic.add(new IterationPossibleValues(area));
   ic.add(new IterationPrefferedValues(area));
   return new AbstractLookup(ic);
 }
Ejemplo n.º 3
0
 public BrepNode(DataObject arg0) {
   super(arg0, new ShapeChildren(), new MyLookup());
   ((MyLookup) getLookup()).setDelegates(new AbstractLookup(instanceContent));
   setIconBaseWithExtension("org/jcae/netbeans/cad/BRepNode.png");
   instanceContent.add(this);
   instanceContent.add(new ViewShapeCookie(this));
   instanceContent.add(getChildren());
   instanceContent.add(arg0);
 }
Ejemplo n.º 4
0
  protected Lookup getLookup(Node[] n) {
    InstanceContent ic = new InstanceContent();
    for (Node node : n) ic.add(node);

    if (n.length > 0) {
      EditorCookie tc = getTextComponent(n[0]);
      if (tc != null) {
        ic.add(tc);
      }
    }
    ic.add(new Hashtable<Object, Object>(0));
    return new AbstractLookup(ic);
  }
 private Lookup getInstanceLookup() {
   InstanceContent instanceContent = new InstanceContent();
   instanceContent.add(sq);
   instanceContent.add(vq);
   Lookup instanceLookup = new AbstractLookup(instanceContent);
   return instanceLookup;
 }
Ejemplo n.º 6
0
 public void open() {
   try {
     getLookup().lookup(BrepDataObject.class).load();
     instanceContent.add(getLookup().lookup(BrepDataObject.class).getShape());
     fireStateChange();
   } catch (IOException ex) {
     Exceptions.printStackTrace(ex);
   } catch (SAXException ex) {
     Exceptions.printStackTrace(ex);
   }
 }
 private void modify() {
   if (!nameField.getText().equals(nameText) || !cityField.getText().equals(cityText)) {
     if (getLookup().lookup(SavableViewCapability.class) == null) {
       instanceContent.add(new SavableViewCapability());
     }
   } else {
     SavableViewCapability svc = getLookup().lookup(SavableViewCapability.class);
     if (svc != null) {
       svc.remove();
     }
   }
 }
  public StackedAreaChartTopComponent() {
    initComponents();
    setName(Bundle.CTL_StackedAreaChartTopComponent());
    setToolTipText(Bundle.HINT_StackedAreaChartTopComponent());
    // Connect our lookup to the rest of the system, so that
    // Save Chart action can access the image
    associateLookup(new AbstractLookup(content));

    setLayout(new BorderLayout());
    // Enable the Print action for the TopComponent:
    putClientProperty("print.printable", true);
    init();
    content.add(new ChartSaveCapabilityImpl());
  }
Ejemplo n.º 9
0
  private CompilationNode(final Folder folder, Children children, InstanceContent content) {
    super(children, new AbstractLookup(content));
    this.setDisplayName(folder.getName());

    if (folder instanceof Group) {
      content.add(
          new OpenCookie() {

            @Override
            public void open() {
              final List<InputGraph> graphs = ((Group) folder).getGraphs();
              if (graphs.isEmpty()) {
                JOptionPane.showMessageDialog(
                    null, "Cannot open compilation, because there was no snapshots recorded!");
              } else {
                Lookup.getDefault().lookup(GraphViewer.class).view(graphs.get(0));
              }
            }
          });
    }
    content.add(folder);
    folder.getChangedEvent().addListener(this);
  }
  @Override
  public void resultChanged(LookupEvent lookupEvent) {
    nameField.setText("[no name]");
    cityField.setText("[no city]");

    // Get the query:
    Collection allQueries = customerQueryResult.allInstances();
    Iterator it1 = allQueries.iterator();
    while (it1.hasNext()) {
      query = (CustomerCollection) it1.next();
      setDisplayName("Customers");
    }
    // Get the customer:
    Collection allCustomers = customerResult.allInstances();
    Iterator it2 = allCustomers.iterator();
    while (it2.hasNext()) {
      customer = (Customer) it2.next();
      nameField.setText(customer.getName());
      cityField.setText(customer.getCity());
    }
    // Get the node:
    Collection allNodes = customerNodeResult.allInstances();
    Iterator it3 = allNodes.iterator();
    while (it3.hasNext()) {
      customerNode = (Node) it3.next();
    }
    // Need to Clear Save and Undo here
    nameText = nameField.getText();
    cityText = cityField.getText();

    // Remove New Type?
    Lookup.Result<NewType> newTypeResult = getLookup().lookupResult(NewType.class);
    Collection allNewTypes = newTypeResult.allInstances();
    Iterator it4 = allNewTypes.iterator();
    while (it4.hasNext()) {
      instanceContent.remove(it4.next());
    }

    if (customerNode != null) {
      this.setActivatedNodes(new Node[] {customerNode});
      for (NewType nt : customerNode.getNewTypes()) {
        instanceContent.add(nt);
      }
    }
    manager.discardAllEdits();
    modify();
  }
Ejemplo n.º 11
0
  private FolderNode(
      String name,
      GroupOrganizer organizer,
      List<String> oldSubFolders,
      final List<Group> groups,
      FolderChildren children,
      InstanceContent content) {
    super(children, new AbstractLookup(content));
    children.setParent(this);
    this.content = content;
    this.children = children;
    content.add(
        new RemoveCookie() {

          public void remove() {
            for (Group g : groups) {
              if (g.getDocument() != null) {
                g.getDocument().removeGroup(g);
              }
            }
          }
        });
    init(name, organizer, oldSubFolders, groups);
  }
Ejemplo n.º 12
0
 protected AbstractTGDatasetService() {
   content.add(this);
   lookup = new AbstractLookup(content);
 }
Ejemplo n.º 13
0
 /**
  * Registers the object <code>o</code> with this lookup.
  *
  * @see org.openide.util.Lookup.Provider.
  * @param o the object to be registered.
  */
 public void add(Object o) {
   ic.add(o);
 }
 void updateTideModel(TideModel tm) {
   System.out.println("agcvtc update");
   content.add(tm);
 }
    @Override
    public void run() {
      try {
        progressHandle.start(chromatograms.size());
        int workunit = 0;
        boolean is1D = true;
        for (IChromatogramDescriptor descr : chromatograms) {
          //            System.out.println("descr: "+(descr instanceof IChromatogram1D));
          if (!(descr.getChromatogram() instanceof IChromatogram1D)) {
            is1D = false;
          }
        }
        if (is1D) {
          Logger.getLogger(getClass().getName()).info("Creating 1D data providers and dataset.");
          List<INamedElementProvider<? extends IChromatogram1D, ? extends IScan>> providers =
              new ArrayList<>(chromatograms.size());
          InstanceContent ic = new InstanceContent();
          for (IChromatogramDescriptor descr : chromatograms) {
            progressHandle.progress("Creating data set for " + descr.getDisplayName(), workunit++);
            providers.add(
                new Chromatogram1DElementProvider(
                    descr.getDisplayName(), (IChromatogram1D) descr.getChromatogram()));
            ic.add(descr);
          }

          final Chromatogram1DDataset ds =
              new Chromatogram1DDataset(
                  providers,
                  Lookups.fixed(
                      new AbstractLookup(ic),
                      Utilities.actionsGlobalContext().lookup(IChromAUIProject.class)));
          onEdt(
              new Runnable() {
                @Override
                public void run() {
                  Chromatogram1DViewTopComponent topComponent =
                      new Chromatogram1DViewTopComponent();
                  topComponent.open();
                  topComponent.initialize(
                      Utilities.actionsGlobalContext().lookup(IChromAUIProject.class),
                      chromatograms,
                      ds);
                  topComponent.requestActive();
                  //                            topComponent.load();
                }
              });
        } else {
          Logger.getLogger(getClass().getName()).info("Creating 2D data providers and dataset.");
          List<INamedElementProvider<? extends IChromatogram1D, ? extends IScan>> providers =
              new ArrayList<>(chromatograms.size());
          InstanceContent ic = new InstanceContent();
          for (IChromatogramDescriptor descr : chromatograms) {
            progressHandle.progress("Creating data set for " + descr.getDisplayName(), workunit++);
            providers.add(
                new Chromatogram1DElementProvider(
                    descr.getDisplayName(), (IChromatogram2D) descr.getChromatogram()));
            ic.add(descr);
          }

          final Chromatogram1DDataset ds =
              new Chromatogram1DDataset(
                  providers,
                  Lookups.fixed(
                      new AbstractLookup(ic),
                      Utilities.actionsGlobalContext().lookup(IChromAUIProject.class)));
          onEdt(
              new Runnable() {
                @Override
                public void run() {
                  Chromatogram1DViewTopComponent topComponent =
                      new Chromatogram1DViewTopComponent();
                  topComponent.open();
                  topComponent.initialize(
                      Utilities.actionsGlobalContext().lookup(IChromAUIProject.class),
                      chromatograms,
                      ds);
                  //                            topComponent.load();
                }
              });
        }
      } finally {
        progressHandle.finish();
      }
    }
Ejemplo n.º 16
0
 public void add(Object instance) {
   content.add(instance);
 }
 private Lkp(org.openide.util.lookup.InstanceContent ic) {
   super(ic);
   ic.add(new Repository(testedFS));
 }
Ejemplo n.º 18
0
 public RtcPlanItemNoneGroup(RtcPlanItem[] planItems) {
   this.folder = new NonGroupElement();
   this.planItems = planItems;
   ic.add(folder);
   lookup = new AbstractLookup(ic);
 }