/** TabbedPaneDemo Constructor */
  public TabbedPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "TabbedPaneDemo", "toolbar/JTabbedPane.gif");

    // create tab position controls
    JPanel tabControls = new JPanel();
    tabControls.add(new JLabel(getString("TabbedPaneDemo.label")));
    top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top")));
    left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left")));
    bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom")));
    right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right")));
    getDemoPanel().add(tabControls, BorderLayout.NORTH);

    group = new ButtonGroup();
    group.add(top);
    group.add(bottom);
    group.add(left);
    group.add(right);

    top.setSelected(true);

    top.addActionListener(this);
    bottom.addActionListener(this);
    left.addActionListener(this);
    right.addActionListener(this);

    // create tab
    tabbedpane = new JTabbedPane();
    getDemoPanel().add(tabbedpane, BorderLayout.CENTER);

    String name = getString("TabbedPaneDemo.laine");
    JLabel pix = new JLabel(createImageIcon("tabbedpane/laine.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.ewan");
    pix = new JLabel(createImageIcon("tabbedpane/ewan.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.hania");
    pix = new JLabel(createImageIcon("tabbedpane/hania.jpg", name));
    tabbedpane.add(name, pix);

    name = getString("TabbedPaneDemo.bounce");
    spin = new HeadSpin();
    tabbedpane.add(name, spin);

    tabbedpane
        .getModel()
        .addChangeListener(
            new ChangeListener() {
              public void stateChanged(ChangeEvent e) {
                SingleSelectionModel model = (SingleSelectionModel) e.getSource();
                if (model.getSelectedIndex() == tabbedpane.getTabCount() - 1) {
                  spin.go();
                }
              }
            });
  }
  private void updateTabBar(Vector vtThread) {
    pnlThread.removeAll();
    for (int iThreadIndex = 0; iThreadIndex < vtThread.size(); iThreadIndex++) {
      try {
        Vector vtThreadInfo = (Vector) vtThread.elementAt(iThreadIndex);
        PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel);

        String strThreadID = (String) vtThreadInfo.elementAt(0);
        String strThreadName = (String) vtThreadInfo.elementAt(1);
        int iThreadStatus = Integer.parseInt((String) vtThreadInfo.elementAt(2));
        mntTemp.setThreadID(strThreadID);
        mntTemp.setThreadName(strThreadName);
        mntTemp.setThreadStatus(iThreadStatus);
        showResult(mntTemp.txtMonitor, (String) vtThreadInfo.elementAt(3));
        mntTemp.addPropertyChangeListener(this);

        pnlThread.add(strThreadName, mntTemp);
        mntTemp.updateStatus();
      } catch (Exception e) {
        e.printStackTrace();
        MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
      }
    }
    Skin.applySkin(this);
  }
 public void setMetricsResults(MetricDisplaySpecification displaySpecification, MetricsRun run) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final String type = MetricsCategoryNameUtil.getShortNameForCategory(category);
     final MetricTableSpecification tableSpecification =
         displaySpecification.getSpecification(category);
     final MetricsResult results = run.getResultsForCategory(category);
     final MetricTableModel model = new MetricTableModel(results, type, tableSpecification);
     table.setModel(model);
     final Container tab = table.getParent().getParent();
     if (model.getRowCount() == 0) {
       tabbedPane.remove(tab);
       continue;
     }
     final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category);
     tabbedPane.add(tab, longName);
     final MyColumnListener columnListener = new MyColumnListener(tableSpecification, table);
     final TableColumnModel columnModel = table.getColumnModel();
     columnModel.addColumnModelListener(columnListener);
     final int columnCount = columnModel.getColumnCount();
     for (int i = 0; i < columnCount; i++) {
       final TableColumn column = columnModel.getColumn(i);
       column.addPropertyChangeListener(columnListener);
     }
     setRenderers(table, type);
     setColumnWidths(table, tableSpecification);
   }
 }
Esempio n. 4
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());
  }
Esempio n. 5
0
  /** Sets up the editor, does the layout, and so on. */
  protected void setup(String resultLabel) {
    setLayout(new BorderLayout());
    add(getToolbar(), BorderLayout.WEST);

    modelStatsText = new JTextArea();
    tabbedPane = new JTabbedPane();
    tabbedPane.add("Pattern", gesDisplay());

    add(tabbedPane, BorderLayout.CENTER);
    add(menuBar(), BorderLayout.NORTH);
  }
  public TabbedEditor(org.colos.ejs.osejs.Osejs _ejs, String _type, String _header) {
    ejs = _ejs;
    defaultType = _type;
    defaultHeader = _header;
    defaultString = new String(res.getString(defaultHeader + ".Page"));

    MyActionListener al = new MyActionListener();

    popupMenu = new PopupMenu();
    customMenuItems(al); // Creates the top menu items
    // common menu items
    copyPage = createMenuItem("copyPage", defaultHeader, al);
    upPage = createMenuItem("upPage", defaultHeader, al);
    dnPage = createMenuItem("dnPage", defaultHeader, al);
    renamePage = createMenuItem("renamePage", defaultHeader, al);
    popupMenu.addSeparator();
    togglePage = createMenuItem("togglePage", defaultHeader, al);
    removePage = createMenuItem("removePage", defaultHeader, al);

    JPanel firstPanel = createFirstPanel();

    tabbedPanel = new JTabbedPane();
    tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPanel.add(popupMenu);
    // tabbedPanel.setPreferredSize (res.getDimension("TabbedEditor.PreferredSize"));
    tabbedPanel.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mousePressed(java.awt.event.MouseEvent evt) {
            if (OSPRuntime.isPopupTrigger(evt)) // SwingUtilities.isRightMouseButton(evt))
            showMenu(evt.getComponent(), evt.getX(), evt.getY());
          }
        });
    cardLayout = new CardLayout();
    finalPanel = new JPanel(cardLayout);
    finalPanel.add(tabbedPanel, "TabbedPanel");
    finalPanel.add(firstPanel, "FirstPanel");
    setFont(finalPanel.getFont());

    Font font = InterfaceUtils.font(null, res.getString("Editor.TitleFont"));
    addPageMI.setFont(font);
    copyPage.setFont(font);
    upPage.setFont(font);
    dnPage.setFont(font);
    togglePage.setFont(font);
    removePage.setFont(font);
    renamePage.setFont(font);
    myFont = font.deriveFont(Font.PLAIN);
    showFirstPage();
  }
  public void loadThread(String threadID, String threadName, String threadStatus) {
    try {
      PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel);
      int iThreadStatus = Integer.parseInt(threadStatus);
      mntTemp.setThreadID(threadID);
      mntTemp.setThreadName(threadName);
      mntTemp.setThreadStatus(iThreadStatus);
      mntTemp.addPropertyChangeListener(this);

      pnlThread.add(threadName, mntTemp);
      mntTemp.updateStatus();
      Skin.applySkin(mntTemp);
    } catch (Exception e) {
      e.printStackTrace();
      MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
    }
  }
 public MetricsDisplay(@NotNull Project project) {
   final JTable projectMetricsTable = new JBTable();
   tables.put(MetricCategory.Project, projectMetricsTable);
   final JTable fileTypeMetricsTable = new JBTable();
   tables.put(MetricCategory.FileType, fileTypeMetricsTable);
   final JTable moduleMetricsTable = new JBTable();
   tables.put(MetricCategory.Module, moduleMetricsTable);
   final JTable packageMetricsTable = new JBTable();
   tables.put(MetricCategory.Package, packageMetricsTable);
   final JTable classMetricsTable = new JBTable();
   tables.put(MetricCategory.Class, classMetricsTable);
   final JTable interfaceMetricsTable = new JBTable();
   tables.put(MetricCategory.Interface, interfaceMetricsTable);
   final JTable methodMetricsTable = new JBTable();
   tables.put(MetricCategory.Method, methodMetricsTable);
   setupTable(projectMetricsTable, project);
   setupTable(fileTypeMetricsTable, project);
   setupTable(moduleMetricsTable, project);
   setupTable(packageMetricsTable, project);
   setupTable(classMetricsTable, project);
   setupTable(interfaceMetricsTable, project);
   setupTable(methodMetricsTable, project);
   tabbedPane.add(
       MetricsReloadedBundle.message("project.metrics"),
       ScrollPaneFactory.createScrollPane(projectMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("file.type.metrics"),
       ScrollPaneFactory.createScrollPane(fileTypeMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("module.metrics"),
       ScrollPaneFactory.createScrollPane(moduleMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("package.metrics"),
       ScrollPaneFactory.createScrollPane(packageMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("class.metrics"),
       ScrollPaneFactory.createScrollPane(classMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("interface.metrics"),
       ScrollPaneFactory.createScrollPane(interfaceMetricsTable));
   tabbedPane.add(
       MetricsReloadedBundle.message("method.metrics"),
       ScrollPaneFactory.createScrollPane(methodMetricsTable));
 }
 public void removeDiffOverlay(MetricDisplaySpecification displaySpecification) {
   final MetricCategory[] categories = MetricCategory.values();
   for (final MetricCategory category : categories) {
     final JTable table = tables.get(category);
     final MetricTableModel model = (MetricTableModel) table.getModel();
     model.setPrevResults(null);
     final Container tab = table.getParent().getParent();
     if (model.getRowCount() == 0) {
       tabbedPane.remove(tab);
       continue;
     }
     final String longName = MetricsCategoryNameUtil.getLongNameForCategory(category);
     tabbedPane.add(tab, longName);
     final String shortName = MetricsCategoryNameUtil.getShortNameForCategory(category);
     setRenderers(table, shortName);
     final MetricTableSpecification specification =
         displaySpecification.getSpecification(category);
     setColumnWidths(table, specification);
   }
   hasOverlay = false;
 }
Esempio n. 10
0
 /**
  * Method for adding a new Panel
  *
  * @param object The new Panel
  */
 public void addPanel(GPropertiesPanel object, String title) {
   pane.add(object, title);
   objects.add(object);
 }
Esempio n. 11
0
 public Component addTab(String title, Component component) {
   return tabs.add(title, component);
 }
Esempio n. 12
0
  public SketchProperties(Editor e, Sketch s) {
    super();

    editor = e;
    sketch = s;

    fields = new HashMap<String, JComponent>();

    this.setPreferredSize(new Dimension(500, 400));
    this.setMinimumSize(new Dimension(500, 400));
    this.setMaximumSize(new Dimension(500, 400));
    this.setSize(new Dimension(500, 400));
    Point eLoc = editor.getLocation();
    int x = eLoc.x;
    int y = eLoc.y;

    Dimension eSize = editor.getSize();
    int w = eSize.width;
    int h = eSize.height;

    int cx = x + (w / 2);
    int cy = y + (h / 2);

    this.setLocation(new Point(cx - 250, cy - 200));
    this.setModal(true);

    outer = new JPanel(new BorderLayout());
    outer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    this.add(outer);

    win = new JPanel();
    win.setLayout(new BorderLayout());
    outer.add(win, BorderLayout.CENTER);

    buttonBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    saveButton = new JButton("OK");
    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            save();
            SketchProperties.this.dispose();
          }
        });

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            SketchProperties.this.dispose();
          }
        });

    buttonBar.add(saveButton);
    buttonBar.add(cancelButton);

    win.add(buttonBar, BorderLayout.SOUTH);

    tabs = new JTabbedPane();

    overviewPane = new JPanel();
    overviewPane.setLayout(new BoxLayout(overviewPane, BoxLayout.PAGE_AXIS));
    overviewPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    addTextField(overviewPane, "author", "Sketch author:");
    addTextArea(overviewPane, "summary", "Summary:");
    addTextArea(overviewPane, "license", "Copyright / License:");
    tabs.add("Overview", overviewPane);

    objectsPane = new JPanel();
    objectsPane.setLayout(new BoxLayout(objectsPane, BoxLayout.PAGE_AXIS));
    objectsPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    addTextField(objectsPane, "board", "Board:");
    addTextField(objectsPane, "core", "Core:");
    addTextField(objectsPane, "compiler", "Compiler:");
    addTextField(objectsPane, "port", "Serial port:");
    addTextField(objectsPane, "programmer", "Programmer:");
    JButton setDef = new JButton("Set to current IDE values");
    setDef.setMaximumSize(setDef.getPreferredSize());
    setDef.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setObjectValues();
          }
        });
    objectsPane.add(Box.createVerticalGlue());
    objectsPane.add(setDef);

    tabs.add("Objects", objectsPane);

    win.add(tabs, BorderLayout.CENTER);

    this.setTitle("Sketch Properties");

    this.pack();
    this.setVisible(true);
  }