Пример #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);
  }
 private Lookup getInstanceLookup() {
   InstanceContent instanceContent = new InstanceContent();
   instanceContent.add(sq);
   instanceContent.add(vq);
   Lookup instanceLookup = new AbstractLookup(instanceContent);
   return instanceLookup;
 }
 @Override
 public Lookup createLookup() {
   InstanceContent ic = new InstanceContent();
   ic.add(new IterationPossibleValues(area));
   ic.add(new IterationPrefferedValues(area));
   return new AbstractLookup(ic);
 }
Пример #4
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);
 }
Пример #5
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);
  }
  @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();
  }
Пример #7
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();
     }
   }
 }
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == rdoDaily) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(dailyPanel);
      panelOptionDetail.repaint();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == rdoWeekly) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(weeklyPanel);
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == rdoMonthly) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(monthlyPanel);
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == rdoYearly) {
      panelOptionDetail.setLayout(new FlowLayout(FlowLayout.LEFT));
      panelOptionDetail.removeAll();
      panelOptionDetail.add(yearlyPanel);
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").close();
      WindowManager.getDefault().findTopComponent("CalendarOptionCreatorTopComponent").open();
    }
    if (e.getSource() == btnOk) {
      if (chkEnableOption.isSelected()) {
        if (rdoDaily.isSelected()) {
          int dailyId = Integer.parseInt(dailyPanel.getSprEvery().getValue().toString());
          int weeklyId = 0;
          int monthlyId = 0;
          int yearlyId = 0;
          saleOffOptionLookup = new SaleOffOptionLookup();
          saleOffOptionLookup.setDailyID(dailyId);
          saleOffOptionLookup.setIsDaily(true);
          saleOffOptionLookup.setIsMonthly(false);
          saleOffOptionLookup.setIsWeekly(false);
          saleOffOptionLookup.setWeeklyID(weeklyId);
          saleOffOptionLookup.setMonthlyID(monthlyId);
          saleOffOptionLookup.setYearlyID(yearlyId);

          content.set(Collections.singleton(saleOffOptionLookup), null);
        }
      }
    }
  }
  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());
  }
Пример #11
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);
  }
Пример #12
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);
  }
Пример #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);
 }
 public void turn(MIMEResolver c) {
   ArrayList<Object> l = new ArrayList<Object>();
   l.add(err);
   l.add(c);
   ic.set(l, null);
 }
 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();
      }
    }
Пример #17
0
 public RtcPlanItemNoneGroup(RtcPlanItem[] planItems) {
   this.folder = new NonGroupElement();
   this.planItems = planItems;
   ic.add(folder);
   lookup = new AbstractLookup(ic);
 }
Пример #18
0
 /** Reload all nodes. Unlike refresh, this will update existing nodes. */
 private void reload() {
   content.set(Arrays.asList(new F1RefreshEvent(true)), null);
 }
Пример #19
0
 /**
  * Refresh all nodes. Will update all nodes created by ChildFactories that are listening to the
  * F1Service lookup for F1RefreshEvents().
  */
 @Override
 public void refresh() {
   content.set(Arrays.asList(new F1RefreshEvent()), null);
 }
 private Lkp(org.openide.util.lookup.InstanceContent ic) {
   super(ic);
   ic.add(new Repository(testedFS));
 }
Пример #21
0
 public void add(Object instance) {
   content.add(instance);
 }
Пример #22
0
 public void clear() {
   content.set(Collections.EMPTY_LIST, null);
 }
Пример #23
0
 /**
  * Unregisters the object <code>o</code> with this lookup.
  *
  * @see org.openide.util.Lookup.Provider.
  * @param o the object to be registered.
  */
 public void remove(Object o) {
   ic.remove(o);
 }
Пример #24
0
 protected AbstractTGDatasetService() {
   content.add(this);
   lookup = new AbstractLookup(content);
 }
Пример #25
0
 public void remove(Object instance) {
   content.remove(instance);
 }