Exemplo n.º 1
0
  /**
   * Descripción de Método
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    this.setLayout(mainLayout);
    this.add(splitPane, BorderLayout.CENTER);
    splitPane.setOpaque(false);
    graphPanel.setLayout(graphLayout);

    //

    splitPane.add(graphPanel, JSplitPane.LEFT);
    splitPane.add(cardPanel, JSplitPane.RIGHT);
    splitPane.setBorder(null);
    splitPane.setName("gc_splitPane");

    //

    cardPanel.setLayout(cardLayout);
    cardPanel.add(srPane, "srPane"); // Sequence Important!
    cardPanel.add(mrPane, "mrPane");
    cardPanel.setBorder(null);
    cardPanel.setName("gc_cardPanel");

    // single row (w/o xPane it would be centered)

    srPane.setBorder(null);
    srPane.setName("gc_srPane");
    srPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    srPane.add(vPane, JSplitPane.TOP);
    srPane.setTopComponent(vPane);
    vPane.getViewport().add(xPanel, null);
    xPanel.add(vPanel);
    vPane.setBorder(null);
    xPanel.setLayout(xLayout);
    xPanel.setName("gc_xPanel");
    xLayout.setAlignment(FlowLayout.LEFT);
    xLayout.setHgap(0);
    xLayout.setVgap(0);

    // multi-row

    mrPane.setBorder(null);
    mrPane.getViewport().add(vTable, null);
    mrPane.setName("gc_mrPane");

    //

    graphPanel.setBorder(null);
    graphPanel.setName("gc_graphPanel");
    srPane.setDividerLocation(200);
  } // jbInit
  public JExperimentManagerMainFrame(EMUI expmanUI, String s) {

    this.expmanUI = expmanUI;
    jltp = new JLeftTabbedPanel(expmanUI);
    fs = new FileSystemTree(expmanUI, s);
    fs.addTreeSelectionListener(new FileSystemTreeSelectionListener(this));
    fs.addMouseListener(new FileSystemTreeMouseListener(this, fs));
    fs.addMouseListener(new JFileSystemPopupMenu(fs));

    leftScrollPane = new JScrollPane();
    rightTopPanel = new JPanel();
    rightTopPanel.setPreferredSize(new Dimension(500, 500));

    leftScrollPane.getViewport().add(fs);
    leftScrollPane.setPreferredSize(new Dimension(300, 500));
    jsplitpaneTree_Panels_LEFT_RIGHT =
        new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, jtsrtp);
    jsplitpaneTree_Panels_LEFT_RIGHT.setOpaque(true);
    jsplitpaneTree_Panels_LEFT_RIGHT.setDividerLocation(0.3);

    this.jltp.displayPanelAddingIfNecessary("Setup & Templates", jsplitpaneTree_Panels_LEFT_RIGHT);

    jos = new JOutputPanels();

    jsplitpaneDebugOutput_TOP_BOTTOM = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jltp, jos);

    this.setLayout(new BorderLayout());
    this.getContentPane().add(jsplitpaneDebugOutput_TOP_BOTTOM, BorderLayout.CENTER);

    mbh = new MenuBarHandler(this);
    mbh.buildMenu();

    this.pack();
    // System.exit(-1234510);
    this.validate();
    jsplitpaneDebugOutput_TOP_BOTTOM.setDividerLocation(
        jsplitpaneDebugOutput_TOP_BOTTOM.getHeight() - 160);
    this.pack();
    this.validate();
    this.setVisible(true);
  }
Exemplo n.º 3
0
  private void initGui() {
    _listScrollPane.getViewport().add(_shoutsList);
    JScrollPane inputScrollPane = new JScrollPane();
    JPanel horizontalLimit =
        new JPanel() {
          @Override
          public Dimension getPreferredSize() {
            Dimension preferredSize = super.getPreferredSize();
            preferredSize.setSize(getWidth() - 30, preferredSize.getHeight());
            return preferredSize;
          }
        };
    horizontalLimit.setLayout(new BorderLayout());
    horizontalLimit.add(_messageInputPane.getComponent());
    inputScrollPane.getViewport().add(horizontalLimit);

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, _listScrollPane, inputScrollPane);
    split.setBorder(new EmptyBorder(0, 0, 0, 0));

    split.setOpaque(false);
    split.setDividerLocation((int) (getHeight() * 0.68));
    split.setDividerSize(3);
    setLayout(new BorderLayout());
    add(split, BorderLayout.CENTER);

    _shoutsList.setBorder(new EmptyBorder(0, 0, 0, 0));
    _messageInputPane.getComponent().setBorder(new EmptyBorder(0, 0, 0, 0));

    _shoutsList.addFocusListener(
        new FocusListener() {
          @Override
          public void focusGained(FocusEvent e) {
            _shoutsList.setEditable(false);
          }

          @Override
          public void focusLost(FocusEvent e) {
            _shoutsList.setEditable(true);
          }
        });
  }
Exemplo n.º 4
0
  /** {@inheritDoc} */
  private Component createSplitPane() {
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    pane.setOpaque(true); // content panes must be opaque

    treePane = new TreePanel();
    Utilities.setBorder(treePane, new EmptyBorder(10, 0, 10, 0));

    entryPane = new IndexBrowserRightPanel();
    treeScroll = Utilities.createScrollPane(treePane);

    entryPane.addIndexSelectionListener(
        new IndexSelectionListener() {
          /** {@inheritDoc} */
          public void indexSelected(IndexSelectionEvent ev) {
            AbstractIndexDescriptor index = ev.getIndex();
            TreeNode parentNode;
            if (index instanceof IndexDescriptor) {
              parentNode = standardIndexes;
            } else {
              parentNode = vlvIndexes;
            }
            DefaultTreeModel model = (DefaultTreeModel) treePane.getTree().getModel();
            int n = model.getChildCount(parentNode);
            for (int i = 0; i < n; i++) {
              AbstractIndexTreeNode node = (AbstractIndexTreeNode) model.getChild(parentNode, i);
              if (node.getName().equals(index.getName())) {
                TreePath newSelectionPath = new TreePath(node.getPath());
                treePane.getTree().setSelectionPath(newSelectionPath);
                treePane.getTree().scrollPathToVisible(newSelectionPath);
                break;
              }
            }
          }
        });

    //  Create a split pane
    pane.setLeftComponent(treeScroll);
    pane.setRightComponent(entryPane);
    pane.setResizeWeight(0.0);

    treePane
        .getTree()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              /** {@inheritDoc} */
              public void valueChanged(TreeSelectionEvent ev) {
                if (!ignoreSelectionEvents) {
                  TreePath[] paths = treePane.getTree().getSelectionPaths();

                  if (entryPane.mustCheckUnsavedChanges()) {
                    ignoreSelectionEvents = true;
                    treePane.getTree().setSelectionPath(lastIndexTreePath);
                    switch (entryPane.checkUnsavedChanges()) {
                      case DO_NOT_SAVE:
                        break;
                      case SAVE:
                        break;
                      case CANCEL:
                        ignoreSelectionEvents = false;
                        return;
                    }
                    if (paths != null) {
                      treePane.getTree().setSelectionPaths(paths);
                    } else {
                      treePane.getTree().clearSelection();
                    }
                    ignoreSelectionEvents = false;
                  }

                  boolean deletableElementsSelected = false;
                  boolean nonDeletableElementsSelected = false;
                  if (paths != null) {
                    for (TreePath path : paths) {
                      Object node = path.getLastPathComponent();
                      if (node instanceof IndexTreeNode) {
                        IndexDescriptor index = ((IndexTreeNode) node).getIndex();
                        if (index.isDatabaseIndex()) {
                          nonDeletableElementsSelected = true;
                        } else {
                          deletableElementsSelected = true;
                        }
                      } else if (node instanceof VLVIndexTreeNode) {
                        deletableElementsSelected = true;
                      }
                    }
                  }
                  deleteMenuItem.setEnabled(
                      deletableElementsSelected && !nonDeletableElementsSelected);
                  updateEntryPane();
                }
              }
            });
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Tree root");
    for (DefaultMutableTreeNode node : categoryNodes) {
      root.add(node);
    }
    DefaultTreeModel model = new DefaultTreeModel(root);
    JTree tree = treePane.getTree();
    tree.setModel(model);
    tree.setRootVisible(false);
    tree.setVisibleRowCount(20);
    tree.expandPath(new TreePath(root));
    tree.setCellRenderer(new IndexTreeCellRenderer());
    addPopupMenu();

    treeScroll.setPreferredSize(
        new Dimension(
            2 * treeScroll.getPreferredSize().width, 8 * treeScroll.getPreferredSize().height));
    entryPane.setBorder(getRightPanelBorder());
    entryPane.setPreferredSize(
        new Dimension(
            (treeScroll.getPreferredSize().width * 5) / 2, treeScroll.getPreferredSize().height));
    pane.setDividerLocation(treeScroll.getPreferredSize().width);
    entryPane.displayVoid();
    return pane;
  }
Exemplo n.º 5
0
 EditorPane(QueryExecutorCreator queryExecutorCreator) {
   super(new BorderLayout());
   this.queryExecutorCreator = queryExecutorCreator;
   setOpaque(false);
   JPanel northPanel = new JPanel(new BorderLayout());
   northPanel.setOpaque(false);
   JToolBar northWestPanel = new JToolBar();
   northWestPanel.setOpaque(false);
   northWestPanel.setFloatable(false);
   startButton =
       new JButton(
           new ImageIcon(getClass().getResource("/org/jooq/debug/console/resources/Play16.png")));
   startButton.setOpaque(false);
   startButton.setFocusable(false);
   //        startButton.setMargin(new Insets(2, 2, 2, 2));
   startButton.setToolTipText("Run the (selected) text (F5)");
   startButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           evaluateInternal();
         }
       });
   northWestPanel.add(startButton);
   stopButton =
       new JButton(
           new ImageIcon(getClass().getResource("/org/jooq/debug/console/resources/Stop16.png")));
   stopButton.setVisible(false);
   stopButton.setOpaque(false);
   stopButton.setFocusable(false);
   //        stopButton.setMargin(new Insets(2, 2, 2, 2));
   stopButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           closeLastExecution();
         }
       });
   northWestPanel.add(stopButton);
   northPanel.add(northWestPanel, BorderLayout.WEST);
   JPanel northEastPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 2));
   northEastPanel.setOpaque(false);
   JCheckBox limitCheckBox = new JCheckBox("Parse 10000 rows max", isUsingMaxRowCount);
   limitCheckBox.addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           isUsingMaxRowCount = e.getStateChange() == ItemEvent.SELECTED;
         }
       });
   limitCheckBox.setOpaque(false);
   northEastPanel.add(limitCheckBox);
   northEastPanel.add(Box.createHorizontalStrut(5));
   northEastPanel.add(new JLabel("No display when rows >"));
   NumberFormat numberFormat = NumberFormat.getIntegerInstance();
   displayedRowCountField = new JFormattedTextField(numberFormat);
   displayedRowCountField.setHorizontalAlignment(JFormattedTextField.RIGHT);
   displayedRowCountField.setValue(100000);
   displayedRowCountField.setColumns(7);
   northEastPanel.add(displayedRowCountField);
   northPanel.add(northEastPanel, BorderLayout.CENTER);
   add(northPanel, BorderLayout.NORTH);
   editorTextArea = new SqlTextArea();
   editorTextArea.addKeyListener(
       new KeyAdapter() {
         @Override
         public void keyPressed(KeyEvent e) {
           boolean isControlDown = e.isControlDown();
           switch (e.getKeyCode()) {
             case KeyEvent.VK_SPACE:
               if (isControlDown) {
                 showCompletion();
               }
               break;
             case KeyEvent.VK_F5:
               if (startButton.isVisible()) {
                 evaluateInternal();
               }
               break;
             case KeyEvent.VK_ESCAPE:
               new Thread("SQLConsole - Interruption") {
                 @Override
                 public void run() {
                   closeLastExecution();
                 }
               }.start();
               break;
           }
         }
       });
   RTextScrollPane editorTextAreaScrollPane = new RTextScrollPane(editorTextArea);
   southPanel = new JPanel(new BorderLayout());
   southPanel.setOpaque(false);
   JSplitPane verticalSplitPane =
       new InvisibleSplitPane(
           JSplitPane.VERTICAL_SPLIT, true, editorTextAreaScrollPane, southPanel);
   verticalSplitPane.setOpaque(false);
   add(verticalSplitPane, BorderLayout.CENTER);
   verticalSplitPane.setDividerLocation(150);
 }
Exemplo n.º 6
0
  private void init() {
    setLayout(new GridBagLayout());
    setBackground(Color.white);

    splitPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.setOneTouchExpandable(false);

    verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    add(
        verticalSplit,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    verticalSplit.setBorder(BorderFactory.createEmptyBorder());
    verticalSplit.setOneTouchExpandable(false);
    verticalSplit.setTopComponent(splitPane);
    textScroller.setAutoscrolls(true);
    textScroller.getVerticalScrollBar().setBlockIncrement(50);
    textScroller.getVerticalScrollBar().setUnitIncrement(20);

    chatWindowPanel = new JPanel();
    chatWindowPanel.setLayout(new GridBagLayout());
    chatWindowPanel.add(
        textScroller,
        new GridBagConstraints(
            0,
            10,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));
    chatWindowPanel.setOpaque(false);

    chatPanel.add(
        chatWindowPanel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 5, 0, 5),
            0,
            0));
    splitPane.setLeftComponent(chatPanel);

    editorBar.setOpaque(false);
    chatPanel.setOpaque(false);

    bottomPanel.setOpaque(false);
    splitPane.setOpaque(false);
    bottomPanel.setLayout(new GridBagLayout());
    bottomPanel.add(
        chatAreaButton,
        new GridBagConstraints(
            0,
            1,
            5,
            1,
            1.0,
            1.0,
            GridBagConstraints.WEST,
            GridBagConstraints.BOTH,
            new Insets(0, 5, 5, 5),
            0,
            15));
    bottomPanel.add(
        editorBar,
        new GridBagConstraints(
            0,
            0,
            5,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 5, 0, 5),
            0,
            0));

    bottomPanel.setBorder(BorderFactory.createEmptyBorder());
    verticalSplit.setOpaque(false);

    verticalSplit.setBottomComponent(bottomPanel);
    verticalSplit.setResizeWeight(1.0);
    verticalSplit.setDividerSize(2);

    chatAreaButton.getButton().addActionListener(this);
    getChatInputEditor().getDocument().addDocumentListener(this);
    chatEditorKeyListener =
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            checkForEnter(e);
          }
        };
    getChatInputEditor().addKeyListener(chatEditorKeyListener);
    getChatInputEditor()
        .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke("ctrl F4"), "closeTheRoom");
    getChatInputEditor()
        .getActionMap()
        .put(
            "closeTheRoom",
            new AbstractAction("closeTheRoom") {
              public void actionPerformed(ActionEvent evt) {
                closeChatRoom();
              }
            });
  }
  public AncestralStatesPanel(BeautiFrame parent) {

    super();

    this.frame = parent;

    partitionTableModel = new PartitionTableModel();
    partitionTable = new JTable(partitionTableModel);

    partitionTable.getTableHeader().setReorderingAllowed(false);
    partitionTable.getTableHeader().setResizingAllowed(false);
    //        modelTable.getTableHeader().setDefaultRenderer(
    //                new HeaderRenderer(SwingConstants.LEFT, new Insets(0, 4, 0, 4)));

    final TableColumnModel model = partitionTable.getColumnModel();
    final TableColumn tableColumn0 = model.getColumn(0);

    TableEditorStopper.ensureEditingStopWhenTableLosesFocus(partitionTable);

    partitionTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    partitionTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent evt) {
                selectionChanged();
              }
            });

    JScrollPane scrollPane =
        new JScrollPane(
            partitionTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setOpaque(false);

    JPanel panel = new JPanel(new BorderLayout(0, 0));
    panel.setOpaque(false);
    panel.add(scrollPane, BorderLayout.CENTER);
    panel.setMinimumSize(new Dimension(MINIMUM_TABLE_WIDTH, 0));

    optionsPanelParent = new JPanel(new FlowLayout(FlowLayout.CENTER));
    optionsPanelParent.setOpaque(false);
    optionsBorder = new TitledBorder("Ancestral state options:");
    optionsPanelParent.setBorder(optionsBorder);

    setCurrentPartition(null);

    JScrollPane scrollPane2 =
        new JScrollPane(
            optionsPanelParent,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane2.setOpaque(false);
    scrollPane2.setBorder(null);
    scrollPane2.getViewport().setOpaque(false);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, scrollPane2);
    splitPane.setDividerLocation(MINIMUM_TABLE_WIDTH);
    splitPane.setContinuousLayout(true);
    splitPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.setOpaque(false);

    setOpaque(false);
    setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));
    setLayout(new BorderLayout(0, 0));
    add(splitPane, BorderLayout.CENTER);
  }