public OscillogramNavigatorPanel() {

    setLayout(new BorderLayout());
    manager = new ExplorerManager();

    ActionMap map = getActionMap();
    map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
    map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
    map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
    map.put("delete", ExplorerUtils.actionDelete(manager, true));

    lookup = ExplorerUtils.createLookup(manager, map);
    listView = new BeanTreeView();
    add(listView);
  }
 @Override
 public void panelDeactivated() {
   Logger.getLogger(OscillogramNavigatorPanel.class.getName()).log(Level.INFO, "pd");
   this.result.removeLookupListener(this);
   this.result = null;
   ExplorerUtils.activateActions(manager, false);
 }
 @Override
 public void panelActivated(Lookup lkp) {
   Logger.getLogger(OscillogramNavigatorPanel.class.getName()).log(Level.INFO, "pa");
   this.result = Utilities.actionsGlobalContext().lookupResult(ChannelList.class);
   this.result.addLookupListener(this);
   ExplorerUtils.activateActions(manager, true);
   resultChanged(new LookupEvent(result));
 }
 public ZIPExplorer() {
   setName(Bundle.CTL_ZIPTopComponent());
   setToolTipText(Bundle.HINT_ZIPTopComponent());
   setLayout(new BorderLayout());
   Node rootNode = new AbstractNode(Children.create(new ZIPChildFactory(), false));
   rootNode.setDisplayName("Root");
   BeanTreeView btv = new BeanTreeView();
   btv.setRootVisible(false);
   add(btv, BorderLayout.CENTER);
   ActionMap map = this.getActionMap();
   map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(mgr));
   map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(mgr));
   map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(mgr));
   map.put("delete", ExplorerUtils.actionDelete(mgr, true)); // or false
   mgr.setRootContext(rootNode);
   associateLookup(ExplorerUtils.createLookup(mgr, map));
 }
 public PersonViewerTopComponent() {
   initComponents();
   setName(Bundle.CTL_PersonViewerTopComponent());
   setToolTipText(Bundle.HINT_PersonViewerTopComponent());
   setLayout(new BorderLayout());
   BeanTreeView btv = new BeanTreeView();
   btv.setRootVisible(false);
   add(btv, BorderLayout.CENTER);
   em.setRootContext(new AbstractNode(Children.create(new PersonChildFactory(), true)));
   associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
 }
  public ClusterExplorerTopComponent() {
    initComponents();
    setName(
        NbBundle.getMessage(ClusterExplorerTopComponent.class, "CTL_ClusterExplorerTopComponent"));
    setToolTipText(
        NbBundle.getMessage(ClusterExplorerTopComponent.class, "HINT_ClusterExplorerTopComponent"));

    associateLookup(ExplorerUtils.createLookup(mgr, getActionMap()));

    setLayout(new BorderLayout());
    this.treeView = new BeanTreeView();
    // treeView.setRootVisible(false);
    add(treeView, BorderLayout.CENTER);
  }
  public TreeBrowserTopComponent() {
    initComponents();
    setName(Bundle.CTL_TreeBrowserTopComponent());
    setToolTipText(Bundle.HINT_TreeBrowserTopComponent());

    associateLookup(ExplorerUtils.createLookup(explorerManager, getActionMap()));
    explorerManager.setRootContext(new ServersNode(getServersChildren()));

    ConnectionInformation info = new ConnectionInformation();
    info.setDomain("");

    if (INSTANCE == null) {
      INSTANCE = this;
    }
  }
Exemple #8
0
  // <editor-fold defaultstate="collapsed" desc="Constructors">
  public GoalsTopComponent() {
    initComponents();
    setName(Bundle.CTL_GoalsTopComponent());
    setToolTipText(Bundle.HINT_GoalsTopComponent());

    this.em = new ExplorerManager();
    ActionMap map = this.getActionMap();
    InputMap keys = this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    this.lookup = ExplorerUtils.createLookup(this.em, map);
    this.associateLookup(this.lookup);

    // Make the root node invisible in the view:
    ((TreeTableView) goalsView).setRootVisible(false);
    ((TreeTableView) goalsView).setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);

    updateGoalsList();
  }
 @Override
 public void resultChanged(LookupEvent ev) {
   Collection lcs = lcResult.allInstances();
   if (lcs.isEmpty()) {
     setEnabled(false);
   } else {
     // assuming that there'll be only one layercontroller in context
     LayerController lc = (LayerController) lcs.iterator().next();
     if (delegate != null) {
       delegate.removePropertyChangeListener(this);
     }
     ExplorerManager em = lc.getExplorerManager();
     delegate = ExplorerUtils.actionDelete(em, false);
     delegate.addPropertyChangeListener(this);
     setEnabled(delegate.isEnabled());
   }
 }
  public CustomerViewerTopComponent() {
    initComponents();
    setName(Bundle.CTL_CustomerViewerTopComponent());
    setToolTipText(Bundle.HINT_CustomerViewerTopComponent());

    EntityManager entityManager =
        Persistence.createEntityManagerFactory("CustomerLibraryPU").createEntityManager();
    Query query = entityManager.createNamedQuery("Customer.findAll");
    List<Customer> resultList = query.getResultList();

    em.setRootContext(
        new AbstractNode(Children.create(new CustomerChildFactory(resultList), true)));
    //	for (Customer c : resultList) {
    //        jTextArea1.append(c.getName() + " (" + c.getCity() + ")" + "\n");
    // }

    associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
  }
  public AssignmentViewerTopComponent() {
    initComponents();
    setName(Bundle.CTL_AssignmentViewerTopComponent());
    setToolTipText(Bundle.HINT_AssignmentViewerTopComponent());
    putClientProperty(TopComponent.PROP_DRAGGING_DISABLED, Boolean.TRUE);
    putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE);
    if (null != System.getProperty("derbyHostUrl")) {
      Map properties = new HashMap();
      properties.put("javax.persistence.jdbc.url", System.getProperty("derbyHostUrl"));
      EntityManager entityManager =
          Persistence.createEntityManagerFactory("mpsLibraryPU", properties).createEntityManager();
      properties = null;
      Query query = entityManager.createNamedQuery("Assignments.findAll");
      List<Assignments> resultList = query.getResultList();

      em.setRootContext(
          new AbstractNode(Children.create(new AssignmentChildFactory(resultList), true)));
      em.getRootContext().setDisplayName("Assignments");
    }
    associateLookup(ExplorerUtils.createLookup(em, getActionMap()));
  }
Exemple #12
0
  private void initLookup() {
    Lookup explorerLookup; // lookup for EpxlorerManager
    Lookup plainContentLookup; // general util using ic
    Lookup dataObjectLookup; // to make sure DO is in lookup WHEN no node selected
    if (lookup == null) {
      lookup = new FormProxyLookup();

      explorerLookup = null;

      // general utility content
      // add itself (for satellite view)
      ic.add(this);
      // add calibrated zoom
      ic.add(new FixCenterCalibratedZoom(0.1));
      ic.add(new FixCenterCalibratedZoom(0.25));
      ic.add(new FixCenterCalibratedZoom(0.5));
      ic.add(new FixCenterCalibratedZoom(0.75));
      ic.add(new FixCenterCalibratedZoom(1));
      ic.add(new FixCenterCalibratedZoom(2));
      ic.add(new FixCenterCalibratedZoom(4));
      ic.add(new FixCenterCalibratedZoom(8));
      ic.add(new FixCenterCalibratedZoom(16));
      plainContentLookup = new AbstractLookup(ic);

      dataObjectLookup = null;
    } else {
      Lookup[] lookups = lookup.getSubLookups();
      explorerLookup = lookups[0];
      plainContentLookup = lookups[1];
      dataObjectLookup = lookups[2];
    }
    if (dataObjectLookup == null) {
      dataObjectLookup = dataObject.getNodeDelegate().getLookup();
    }
    if (explorerLookup == null) {
      ActionMap map = new ActionMap();
      explorerLookup = ExplorerUtils.createLookup(layerController.getExplorerManager(), map);
    }
    lookup.setSubLookups(new Lookup[] {explorerLookup, plainContentLookup, dataObjectLookup});
  }
  /** the constructor */
  private DirectoryTreeTopComponent() {
    initComponents();

    // only allow one item to be selected at a time
    ((BeanTreeView) jScrollPane1).setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    // remove the close button
    putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
    setName(NbBundle.getMessage(DirectoryTreeTopComponent.class, "CTL_DirectoryTreeTopComponent"));
    setToolTipText(
        NbBundle.getMessage(DirectoryTreeTopComponent.class, "HINT_DirectoryTreeTopComponent"));

    subscribeToChangeEvents();
    associateLookup(ExplorerUtils.createLookup(em, getActionMap()));

    this.pcs = new PropertyChangeSupport(this);

    // set the back & forward list and also disable the back & forward button
    this.backList = new LinkedList<>();
    this.forwardList = new LinkedList<>();
    backButton.setEnabled(false);
    forwardButton.setEnabled(false);
  }
  private void initComponents() {

    setLayout(new BorderLayout());

    bar = new JToolBar();
    bar.setFloatable(false);
    bar.addSeparator();

    Component newQuery = CallableSystemAction.get(NewQueryAction.class).getToolbarPresenter();
    Component editQuery = CallableSystemAction.get(EditQueryAction.class).getToolbarPresenter();
    Component prevQuery = CallableSystemAction.get(PrevQueryAction.class).getToolbarPresenter();
    Component refresh = CallableSystemAction.get(RefreshAction.class).getToolbarPresenter();

    bar.add(newQuery);
    bar.add(editQuery);
    bar.add(prevQuery);
    bar.addSeparator();
    bar.add(refresh);

    // add(ResultsToolbar.getDefault().getToolbar(), BorderLayout.NORTH);
    add(bar, BorderLayout.NORTH);
    lookup = new AbstractLookup(ic);
    associateLookup(new ProxyLookup(ExplorerUtils.createLookup(manager, getActionMap()), lookup));
  }