コード例 #1
0
ファイル: OWLVizView.java プロジェクト: protegeproject/owlviz
  /**
   * Sets up the main listeners that are required by the tab, including selection listeners, and
   * knowledgebase listeners.
   */
  protected void setupListeners(final GraphComponent graphComponent) {
    /*
     * Listen to node clicks so that if there is a double click we can
     * display the Protege Info View
     */
    graphComponent
        .getGraphView()
        .addNodeClickedListener(
            new NodeClickedListener() {
              /**
               * Invoked when a <code>Node</code> has been clicked by the mouse in the <code>
               * GraphView</code>
               *
               * @param evt The event associated with this action.
               */
              public void nodeClicked(NodeClickedEvent evt) {
                // if(evt.getMouseEvent().getClickCount() == 2) {
                // Object selObj = graphComponent.getSelectedObject();
                // if(selObj != null) {
                // if(selObj instanceof Instance) {
                // showInstance((Instance) selObj);
                // }
                // }
                // }
              }
            });

    graphComponent.addGraphSelectionModelListener(
        new GraphSelectionModelListener() {
          public void selectionChanged(GraphSelectionModelEvent event) {
            Object selObj = event.getSource().getSelectedObject();
            if (selObj instanceof OWLClass) {
              selectionModel.setSelectedClass((OWLClass) selObj);
              setGlobalSelection((OWLClass) selObj);
            }
          }
        });

    tabbedPane.addContainerListener(
        new ContainerListener() {
          public void componentAdded(ContainerEvent e) {
            // Do nothing
          }

          public void componentRemoved(ContainerEvent e) {
            // Remove components from hash sets etc.
            componentGroupMap.remove(e.getChild());
            closableTabs.remove(e.getChild());
            graphComponents.remove(e.getChild());
            OWLVizGraphPanel panel = (OWLVizGraphPanel) e.getChild();
            panel.dispose();
          }
        });
  }
コード例 #2
0
ファイル: OWLVizView.java プロジェクト: protegeproject/owlviz
 protected OptionsDialog setupOptionsDialog() {
   OptionsDialog optionsDialog = new OptionsDialog((Frame) getWorkspace().getTopLevelAncestor());
   optionsDialog.addOptionsPage(new ModeOptionsPage(getOptions()), "Mode");
   optionsDialog.addOptionsPage(
       new LayoutDirectionOptionsPage(
           assertedGraphComponent.getController(), inferredGraphComponent.getController()),
       "Layout");
   optionsDialog.addOptionsPage(new GlobalOptionsPage(getOWLEditorKit()), "Global");
   // optionsDialog.addOptionsPage(new DisplayOptionsPage(), "Display
   // Options");
   // optionsDialog.addOptionsPage(new UIOptionsPage(), "UI Options");
   return optionsDialog;
 }
コード例 #3
0
ファイル: OWLVizView.java プロジェクト: protegeproject/owlviz
  protected void createOWLVizTabUI() {
    setLayout(new BorderLayout());
    // Create the tabbed pane
    tabbedPane = new JTabbedPane();
    add(tabbedPane);

    // /////////////////////////////////////////////////////////////////////
    //
    // Build the asserted subclass hierarchy tabs
    //
    // ////////////////////////////////////////////////////////////////////
    assertedGraphModel = new OWLClassGraphAssertedModel(getOWLModelManager());
    OWLVizGraphPanel assertedPanel =
        new OWLVizGraphPanel("Asserted hierarchy", this, getOWLEditorKit(), assertedGraphModel);
    assertedGraphComponent = assertedPanel.getGraphComponent();
    setupListeners(assertedGraphComponent);
    tabbedPane.add(assertedPanel.getName(), assertedPanel);
    graphComponents.add(assertedGraphComponent);

    // /////////////////////////////////////////////////////////////////////
    //
    // Build the inferred subclass hierarchy tabs
    //
    // ////////////////////////////////////////////////////////////////////
    inferredGraphModel = new OWLClassGraphInferredModel(getOWLModelManager());
    OWLVizGraphPanel inferredPanel =
        new OWLVizGraphPanel("Inferred hierarchy", this, getOWLEditorKit(), inferredGraphModel);
    inferredGraphComponent = inferredPanel.getGraphComponent();
    tabbedPane.add(inferredPanel.getName(), inferredPanel);
    graphComponents.add(inferredGraphComponent);

    // Group the asserted and inferred hierarchy tabs, so that operations
    // such as showing subclasses etc. are applied to both tabs.
    ArrayList<GraphComponent> list = new ArrayList<GraphComponent>();
    list.add(assertedGraphComponent);
    list.add(inferredGraphComponent);
    componentGroupMap.put(assertedPanel, list);
    componentGroupMap.put(inferredPanel, list);

    // Create the toolbar
    createToolBar(assertedGraphComponent.getController(), assertedGraphComponent.getController());
  }
コード例 #4
0
ファイル: OWLVizView.java プロジェクト: protegeproject/owlviz
 protected void forceRepaint() {
   for (Iterator<GraphComponent> it = getGraphComponents().iterator(); it.hasNext(); ) {
     GraphComponent curGraphComponent = it.next();
     curGraphComponent.getGraphView().repaint();
   }
 }