示例#1
0
  // Add all the tabbed panes.
  // I seperate each pane into a different class to make the code cleaner.
  // This however causes a lot of parameters to be passed.
  private void addTabPane() throws InvalidFormatException, IOException {
    tabbedPane = new JTabbedPane();
    tabbedPane.setMinimumSize(new Dimension(0, 500));
    panel1 = new pastCrimePanel(myWebView, map, precincts, rpaAggregate, crimeDistEstimJFrame);
    tabbedPane.addTab("Past Crime", panel1);
    panel2 = new simulateCrimePanel(myModel, precincts, rpaAggregate, myWebView);
    tabbedPane.addTab("Simulated Crime", panel2);
    panel3 = new HeatMapPanel(myWebView, precincts, rpaAggregate, myModel);
    tabbedPane.addTab("Spacial Crime Density", panel3);
    panel4 =
        new temporalCrimePanel(
            myWebView, precincts, rpaAggregate, myModel, crimeDistEstimJFrame, map);
    tabbedPane.addTab("Temporal Crime Density", panel4);
    panel5 = new StatisticsPanel(map, precincts, rpaAggregate, myWebView, crimeDistEstimJFrame);
    tabbedPane.addTab("Stastics", panel5);
    tabbedPane.addChangeListener(
        new ChangeListener() {
          int prevState = -1;

          @Override
          public void stateChanged(ChangeEvent e) {
            // TODO Auto-generated method stub
            clear();
            if (enableRpa) {
              if (tabbedPane.getSelectedIndex() == 4) {
                myWebView.showOverMap2();
              } else {
                myWebView.showOverMap1();
              }
            }
            if (tabbedPane.getSelectedIndex() == 3 || tabbedPane.getSelectedIndex() == 2) {
              if (prevState != 3 && prevState != 2) {
                myWebView.addRpaListeners();
              }
            } else if (prevState == 3 || prevState == 2) {
              myWebView.clearRpaListeners();
            }
            prevState = tabbedPane.getSelectedIndex();
          }
        });
  }
示例#2
0
  public JipViewer(String title, JipRun run) {
    super(title);

    addKeyListener(this);
    mMethodModel.addChangeListener(this);

    // build the call tree
    mCallTreeRoot = new TreeNode(title);
    buildTree(run, mCallTreeRoot);

    mCallTree = new JTree(mCallTreeRoot);
    mCallTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    mCallTree.addTreeSelectionListener(this);
    mCallTree.addKeyListener(this);

    // build the allMethods table
    Collection<JipRun.PerMethodInfo> perMethodInfos = run.perMethodsInTotalTimeOrder();
    long totalTimeForAllThreads = run.getTotalTimeForAllThreads();
    for (JipRun.PerMethodInfo perMethod : perMethodInfos) {
      MethodRow row = new MethodRow(perMethod.getMethod());
      for (JipFrame frame : perMethod.allFrames()) {
        if (!frame.isReentrant()) {
          row.addFrame(frame);
        }
        row.setTimeDenominator(totalTimeForAllThreads);
      }
      mAllMethodsModel.add(row);
    }
    mMethods = MethodViewer.makeTableForMethodRows(mAllMethodsModel);
    mMethods.getSelectionModel().addListSelectionListener(this);
    mMethods.addKeyListener(this);
    mAllMethodsSorterModel = (TableSorter) mMethods.getModel();

    // make the ByPackageViewer
    mPkgViewer = new ByPackageViewer(run);
    mPkgViewer.addKeyListener(this);

    // make the RemoteController
    mRemoteController = new RemoteController();
    mRemoteController.addKeyListener(this);

    // make the methodViewer
    MethodViewer methodViewer = new MethodViewer(run, mMethodModel);

    // combine all the views
    JTabbedPane tabPane = new JTabbedPane();
    tabPane.addTab("call tree", new JScrollPane(mCallTree));
    tabPane.addTab("methods", new JScrollPane(mMethods));
    tabPane.addTab("by package", new JScrollPane(mPkgViewer));
    tabPane.addTab("remote control", mRemoteController);
    tabPane.addTab("help", new HelpViewer());
    tabPane.addKeyListener(this);
    tabPane.setMinimumSize(new Dimension(100, 200));

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tabPane, methodViewer);
    setContentPane(split);

    pack();
    setSize(new Dimension(1024, 768));
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
示例#3
0
  /**
   * Creates a new help viewer for the specified URL.
   *
   * @param url The URL
   */
  public HelpViewer(String url) {
    super(jEdit.getProperty("helpviewer.title"));

    setIconImage(GUIUtilities.getEditorIcon());

    try {
      baseURL =
          new File(MiscUtilities.constructPath(jEdit.getJEditHome(), "doc")).toURL().toString();
    } catch (MalformedURLException mu) {
      Log.log(Log.ERROR, this, mu);
      // what to do?
    }

    ActionHandler actionListener = new ActionHandler();

    JTabbedPane tabs = new JTabbedPane();
    tabs.addTab(jEdit.getProperty("helpviewer.toc.label"), toc = new HelpTOCPanel(this));
    tabs.addTab(jEdit.getProperty("helpviewer.search.label"), new HelpSearchPanel(this));
    tabs.setMinimumSize(new Dimension(0, 0));

    JPanel rightPanel = new JPanel(new BorderLayout());

    Box toolBar = new Box(BoxLayout.X_AXIS);
    // toolBar.setFloatable(false);

    toolBar.add(title = new JLabel());
    toolBar.add(Box.createGlue());
    historyModel = new HelpHistoryModel(25);
    back = new HistoryButton(HistoryButton.BACK, historyModel);
    back.addActionListener(actionListener);
    toolBar.add(back);
    forward = new HistoryButton(HistoryButton.FORWARD, historyModel);
    forward.addActionListener(actionListener);
    toolBar.add(forward);
    back.setPreferredSize(forward.getPreferredSize());
    rightPanel.add(BorderLayout.NORTH, toolBar);

    viewer = new JEditorPane();
    viewer.setEditable(false);
    viewer.addHyperlinkListener(new LinkHandler());
    viewer.setFont(new Font("Monospaced", Font.PLAIN, 12));
    viewer.addPropertyChangeListener(new PropertyChangeHandler());
    viewer.addKeyListener(new KeyHandler());

    viewerScrollPane = new JScrollPane(viewer);

    rightPanel.add(BorderLayout.CENTER, viewerScrollPane);

    splitter =
        new JSplitPane(
            JSplitPane.HORIZONTAL_SPLIT,
            jEdit.getBooleanProperty("appearance.continuousLayout"),
            tabs,
            rightPanel);
    splitter.setBorder(null);

    getContentPane().add(BorderLayout.CENTER, splitter);

    historyModel.addHelpHistoryModelListener(this);
    historyUpdated();

    gotoURL(url, true, 0);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    getRootPane().setPreferredSize(new Dimension(750, 500));

    pack();
    GUIUtilities.loadGeometry(this, "helpviewer");
    GUIUtilities.addSizeSaver(this, "helpviewer");

    EditBus.addToBus(this);

    setVisible(true);

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            splitter.setDividerLocation(jEdit.getIntegerProperty("helpviewer.splitter", 250));
            viewer.requestFocus();
          }
        });
  } // }}}
示例#4
0
  public void createAndShowGUI() {
    setLayout(new BorderLayout());
    setTransferHandler(new PathwayImportHandler());
    swingEngine.getEngine().addApplicationEventListener(this);

    actions = swingEngine.getActions();

    toolBar = new JToolBar();
    toolBar.setFloatable(
        false); // disable floatable toolbar, aka Abomination of interaction design.
    addToolBarActions(swingEngine, toolBar);

    add(toolBar, BorderLayout.PAGE_START);
    // menuBar will be added by container (JFrame or JApplet)

    pathwayScrollPane = new JScrollPane();
    // set background color when no VPathway is loaded, override l&f because it is usually white.
    pathwayScrollPane.getViewport().setBackground(Color.LIGHT_GRAY);

    objectsPane = new ObjectsPane(swingEngine);
    int numItemsPerRow = 10;
    objectsPane.addButtons(actions.newDatanodeActions, "Data Nodes", numItemsPerRow);
    objectsPane.addButtons(actions.newInteractionActions, "Basic interactions", numItemsPerRow);
    // objectsPane.addButtons(actions.newRLInteractionActions, "Receptor/ligand", numItemsPerRow);
    objectsPane.addButtons(actions.newMIMInteractionActions, "MIM interactions", numItemsPerRow);
    // objectsPane.addButtons(actions.newAnnotationActions, "Annotations", numItemsPerRow);
    objectsPane.addButtons(actions.newShapeActions, "Graphical elements", numItemsPerRow);

    objectsPane.addButtons(
        actions.newCellularComponentActions, "Cellular compartments", numItemsPerRow);

    objectsPane.addButtons(actions.newTemplateActions, "Templates", numItemsPerRow);

    propertyTable =
        new JTable(model) {

          public TableCellRenderer getCellRenderer(int row, int column) {
            TableCellRenderer r = model.getCellRenderer(row, column);
            return r == null ? super.getCellRenderer(row, column) : r;
          }

          public TableCellEditor getCellEditor(int row, int column) {
            TableCellEditor e = model.getCellEditor(row, column);
            return e == null ? super.getCellEditor(row, column) : e;
          }
        };
    // TODO: make this prettier, it's not good for the tablemodel to have
    // a reference to the table. Quick fix for preventing TableCellEditor
    // to remain open upon selecting a new PathwayElement
    model.setTable(propertyTable);

    propertiesScrollPane = new JScrollPane(propertyTable);

    bpt = new BackpageTextProvider();
    bpt.addBackpageHook(new BackpageAttributes(swingEngine.getGdbManager().getCurrentGdb()));
    bpt.addBackpageHook(new BackpageXrefs(swingEngine.getGdbManager().getCurrentGdb()));

    backpagePane = new BackpagePane(bpt, swingEngine.getEngine());
    backpagePane.addHyperlinkListener(swingEngine);

    sidebarTabbedPane = new JTabbedPane();
    sidebarTabbedPane.addTab("Objects", objectsPane);
    sidebarTabbedPane.addTab("Properties", propertiesScrollPane);
    sidebarTabbedPane.addTab("Backpage", new JScrollPane(backpagePane));

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, pathwayScrollPane, sidebarTabbedPane);

    // set a small minimum size, to make sure we can keep resizing the side panel
    sidebarTabbedPane.setMinimumSize(new Dimension(50, 50));

    splitPane.setResizeWeight(1);
    splitPane.setOneTouchExpandable(true);
    add(splitPane, BorderLayout.CENTER);
    Action[] keyStrokeActions =
        new Action[] {
          actions.copyAction, actions.pasteAction,
        };
    InputMap im = getInputMap();
    ActionMap am = getActionMap();

    // define shortcuts
    for (Action a : keyStrokeActions) {
      im.put((KeyStroke) a.getValue(Action.ACCELERATOR_KEY), a.getValue(Action.NAME));
      am.put(a.getValue(Action.NAME), a);
    }

    menuBar = new JMenuBar();
    addMenuActions(menuBar);
  }
  /** Initialises the GUI */
  public void initGUI() {
    mainPanel = new JPanel();
    JPanel southPanel = new JPanel();
    // buttonPanel.setBackground(UIManager.getLookAndFeelDefaults().getColor(
    // "ToolTip.background"));

    JPanel buttonPanel = new JPanel(new FlowLayout());
    southPanel.add(buttonPanel, BorderLayout.SOUTH);

    table = new JTable();
    table.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            int column = table.getColumnModel().getColumnIndexAtX(e.getX()); // get
            // the
            // coloum
            // of
            // the
            // button
            int row = e.getY() / table.getRowHeight(); // get the row of the
            // button

            /* Checking the row or column is valid or not */
            if (row < table.getRowCount()
                && row >= 0
                && column < table.getColumnCount()
                && column >= 0) {
              Object value = table.getValueAt(row, column);
              if (value instanceof JButton) {
                /* perform a click event */
                ((JButton) value).doClick();
              }
            }
          }
        });
    loadTableModel(new HashSet<AnnotationRule>());
    table.setDefaultRenderer(Object.class, new MyCellRenderer());
    table.getTableHeader().setFont(new Font("Times New Roman", Font.BOLD, 16));
    // table.setPreferredSize(new Dimension(1200,1200));
    // table.setAutoCreateColumnsFromModel(true);
    // table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    // table.setPreferredScrollableViewportSize(new Dimension(1200,
    // 70));
    // table.setFillsViewportHeight(true);
    // table.setAutoscrolls(true);

    JButton addButton = new JButton("Add Rule");
    buttonPanel.add(addButton);

    JButton saveButton = new JButton("Save");
    buttonPanel.add(saveButton);
    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ruleStore.saveRules();
          }
        });

    southPanel.add(buttonPanel);
    JTabbedPane rightTabbedPane = new JTabbedPane();
    rightTabbedPane.setMinimumSize(new Dimension(250, 200));
    rightTabbedPane.setPreferredSize(new Dimension(250, 200));
    this.japelatesTreePanel = new JapelateTreePanel(this);

    // lets create the OntologyTree Component
    ontologyTreePanelClasses = new OntologyTreePanel(this, false);
    OntologyTreeListenerBasic ontoTreeListenerClasses =
        new OntologyTreeListenerBasic(ontologyTreePanelClasses, this);
    ontologyTreePanelClasses.setListener(ontoTreeListenerClasses);
    ontologyTreePanelProperties = new OntologyTreePanel(this, true);
    OntologyTreeListenerBasic ontoTreeListenerProperties =
        new OntologyTreeListenerBasic(ontologyTreePanelProperties, this);
    ontologyTreePanelProperties.setListener(ontoTreeListenerProperties);

    rightTabbedPane.addTab("Japelates", japelatesTreePanel);
    rightTabbedPane.addTab("Ontology Classes", ontologyTreePanelClasses);
    rightTabbedPane.addTab("Ontology Relations", ontologyTreePanelProperties);

    mainPanel.setLayout(new BorderLayout());
    scrollP = new JScrollPane(table);
    mainPanel.add(scrollP, BorderLayout.CENTER);
    mainPanel.add(rightTabbedPane, BorderLayout.EAST);
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    mainPanel.setBackground(Color.white);
    this.setLayout(new java.awt.BorderLayout());
    this.add(mainPanel, java.awt.BorderLayout.CENTER);
    // it is important to call this last as it needs getGUI()
    addButton.addActionListener(new AnnotationRuleEditor(RuleBaseViewer.this, ruleStore));
  }
示例#6
0
/**
示例#7
0
  /** Creates an instance of <tt>ZrtpConfigurePanel</tt>. */
  public ZrtpConfigurePanel() {
    super(new BorderLayout());

    ResourceManagementService resources = NeomediaActivator.getResources();

    JPanel mainPanel = new TransparentPanel(new BorderLayout(0, 10));

    final JButton stdButton =
        new JButton(resources.getI18NString("impl.media.security.zrtp.STANDARD"));
    stdButton.setOpaque(false);

    final JButton mandButton =
        new JButton(resources.getI18NString("impl.media.security.zrtp.MANDATORY"));
    mandButton.setOpaque(false);

    final JButton saveButton = new JButton(resources.getI18NString("service.gui.SAVE"));
    saveButton.setOpaque(false);

    JPanel buttonBar = new TransparentPanel(new GridLayout(1, 7));
    buttonBar.add(stdButton);
    buttonBar.add(mandButton);
    buttonBar.add(Box.createHorizontalStrut(10));
    buttonBar.add(saveButton);

    ConfigurationService cfg = NeomediaActivator.getConfigurationService();
    boolean trusted = cfg.getBoolean(TRUSTED_PROP, false);
    boolean sasSign = cfg.getBoolean(SASSIGN_PROP, false);

    JPanel checkBar = new TransparentPanel(new GridLayout(1, 2));
    final JCheckBox trustedMitM =
        new SIPCommCheckBox(resources.getI18NString("impl.media.security.zrtp.TRUSTED"), trusted);
    final JCheckBox sasSignature =
        new SIPCommCheckBox(
            resources.getI18NString("impl.media.security.zrtp.SASSIGNATURE"), sasSign);
    checkBar.add(trustedMitM);
    checkBar.add(sasSignature);
    mainPanel.add(checkBar, BorderLayout.NORTH);

    ActionListener buttonListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Object source = event.getSource();
            if (source == stdButton) {
              inActive.clear();
              active.setStandardConfig();
              pkc.setStandard();
              hc.setStandard();
              sc.setStandard();
              cc.setStandard();
              lc.setStandard();
            } else if (source == mandButton) {
              inActive.clear();
              active.setMandatoryOnly();
              pkc.setStandard();
              hc.setStandard();
              sc.setStandard();
              cc.setStandard();
              lc.setStandard();
            } else if (source == saveButton) {
              ConfigurationService cfg = NeomediaActivator.getConfigurationService();

              cfg.setProperty(TRUSTED_PROP, String.valueOf(active.isTrustedMitM()));
              cfg.setProperty(SASSIGN_PROP, String.valueOf(active.isSasSignature()));
              pkc.saveConfig();
              hc.saveConfig();
              sc.saveConfig();
              cc.saveConfig();
              lc.saveConfig();
            } else return;
          }
        };
    stdButton.addActionListener(buttonListener);
    mandButton.addActionListener(buttonListener);
    saveButton.addActionListener(buttonListener);

    ItemListener itemListener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Object source = e.getItemSelectable();

            if (source == trustedMitM) {
              active.setTrustedMitM(trustedMitM.isSelected());
            } else if (source == sasSignature) {
              active.setSasSignature(sasSignature.isSelected());
            }
          }
        };
    trustedMitM.addItemListener(itemListener);
    sasSignature.addItemListener(itemListener);

    JTabbedPane algorithmsPane = new SIPCommTabbedPane();

    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.PUB_KEYS"), pkc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.HASHES"), hc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.SYM_CIPHERS"), cc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.SAS_TYPES"), sc);
    algorithmsPane.addTab(resources.getI18NString("impl.media.security.zrtp.SRTP_LENGTHS"), lc);

    algorithmsPane.setMinimumSize(new Dimension(400, 100));
    algorithmsPane.setPreferredSize(new Dimension(400, 200));
    mainPanel.add(algorithmsPane, BorderLayout.CENTER);

    mainPanel.add(buttonBar, BorderLayout.SOUTH);

    add(mainPanel);
  }