Exemplo n.º 1
0
 /**
  * Returns the contents of the specified transferable.
  *
  * @param tr transferable
  * @return contents
  */
 @SuppressWarnings("unchecked")
 public static ArrayList<Object> contents(final Transferable tr) {
   final ArrayList<Object> list = new ArrayList<>();
   try {
     if (tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
       for (final File fl : (List<File>) tr.getTransferData(DataFlavor.javaFileListFlavor))
         list.add(fl);
     } else if (tr.isDataFlavorSupported(DataFlavor.stringFlavor)) {
       list.add(tr.getTransferData(DataFlavor.stringFlavor));
     }
   } catch (final Exception ex) {
     Util.stack(ex);
   }
   return list;
 }
Exemplo n.º 2
0
  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());
  }