com.intellij.ui.JBSplitter Java Examples

The following examples show how to use com.intellij.ui.JBSplitter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GodClassPreviewResultDialog.java    From IntelliJDeodorant with MIT License 6 votes vote down vote up
MyCacheDiffRequestChainProcessor(@Nullable Project project, @NotNull DiffRequestChain requestChain) {
    super(project, requestChain);
    JPanel myPanel = new JPanel();
    BorderLayout layout = new BorderLayout();
    myPanel.setLayout(layout);
    createTablePanel();
    layout.addLayoutComponent(scrollPane, BorderLayout.CENTER);
    myPanel.add(scrollPane);
    getComponent().add(myPanel, BorderLayout.NORTH);

    JBSplitter splitter = new JBSplitter(true, "DiffRequestProcessor.BottomComponentSplitter", 0.5f);
    splitter.setFirstComponent(myPanel);
    JPanel initialDiffPanel = (JPanel) getComponent().getComponent(0);
    splitter.setSecondComponent(initialDiffPanel);
    getComponent().add(splitter, BorderLayout.CENTER);
}
 
Example #2
Source File: IMPanel.java    From SmartIM4IntelliJ with Apache License 2.0 6 votes vote down vote up
private void initUI() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new LoginAction(this));
    group.add(new HideContactAction(this));
    group.add(new DisconnectAction(this));
    createBroadcastAction(group);
    group.add(new SettingsAction(this));
    MockConsoleAction test = new MockConsoleAction(this);
    //group.add(test);

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("SmartQQ", group, false);
    // toolbar.getComponent().addFocusListener(createFocusListener());
    toolbar.setTargetComponent(this);
    setToolbar(toolbar.getComponent());

    left = createContactsUI();
    left.onLoadContacts(false);

    tabbedChat = new ClosableTabHost(this);

    splitter = new JBSplitter(false);
    splitter.setSplitterProportionKey("main.splitter.key");
    splitter.setFirstComponent(left.getPanel());
    splitter.setSecondComponent(tabbedChat);
    splitter.setProportion(0.3f);
    setContent(splitter);
}
 
Example #3
Source File: LibraryDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
private void initBinaryFilesTab() {
    pTabBinaryFiles = new JPanel(new MigLayout(new LC()));

    // List
    createBinaryFileList();

    //Content (right panel)
    JPanel panelBinaryFilesContent = new JPanel(new MigLayout());
    btnBinaryFilePath = new TextFieldWithBrowseButton();
    btnBinaryFilePath.setText("");
    btnBinaryFilePath.addBrowseFolderListener(Localizer.get("library.ChooseBinaryFile"), "", project, FileReaderUtil.getBinaryFileDescriptor());

    tfBinaryFileAlias = new EditorTextField("ExampleAlias");

    panelBinaryFilesContent.add(tfBinaryFileAlias, new CC().wrap());
    panelBinaryFilesContent.add(btnBinaryFilePath, new CC().wrap().gapY("8pt", "0"));

    //Splitter
    JBSplitter splitter = new JBSplitter(0.3f);
    splitter.setFirstComponent(listBinaryFiles);
    splitter.setSecondComponent(panelBinaryFilesContent);

    pTabBinaryFiles.add(splitter, new CC().push().grow());
    tabbedPane.addTab("Tab1", pTabBinaryFiles);
}
 
Example #4
Source File: MainPanel.java    From railways with MIT License 6 votes vote down vote up
/**
 * Initializes splitter that divides routes table and info panel.
 * We do this manually as there were difficulties with UI designer and
 * the splitter.
 */
private void initSplitter() {
    // Remove required components from main panel
    mainRoutePanel.remove(routeInfoPanel);
    mainRoutePanel.remove(routesScrollPane);

    mySplitter = new JBSplitter(true, 0.8f);

    mySplitter.setHonorComponentsMinimumSize(true);
    mySplitter.setAndLoadSplitterProportionKey("Railways.SplitterProportion");
    mySplitter.setOpaque(false);
    mySplitter.setShowDividerControls(false);
    mySplitter.setShowDividerIcon(false);

    mySplitter.setFirstComponent(routesScrollPane);
    mySplitter.setSecondComponent(routeInfoPanel);

    mainRoutePanel.add(mySplitter, BorderLayout.CENTER);
}
 
Example #5
Source File: TextEditorWithPreview.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public JComponent getComponent() {
  if (myComponent == null) {
    final JBSplitter splitter = new JBSplitter(false, 0.5f, 0.15f, 0.85f);
    splitter.setSplitterProportionKey(getSplitterProportionKey());
    splitter.setFirstComponent(myEditor.getComponent());
    splitter.setSecondComponent(myPreview.getComponent());

    myToolbarWrapper = new SplitEditorToolbar(splitter);
    myToolbarWrapper.addGutterToTrack(((EditorGutterComponentEx)(myEditor).getEditor().getGutter()));

    if (myPreview instanceof TextEditor) {
      myToolbarWrapper.addGutterToTrack(((EditorGutterComponentEx)((TextEditor)myPreview).getEditor().getGutter()));
    }

    if (myLayout == null) {
      String lastUsed = PropertiesComponent.getInstance().getValue(getLayoutPropertyName());
      myLayout = Layout.fromName(lastUsed, Layout.SHOW_EDITOR_AND_PREVIEW);
    }
    adjustEditorsVisibility();

    myComponent = JBUI.Panels.simplePanel(splitter).addToTop(myToolbarWrapper);
  }
  return myComponent;
}
 
Example #6
Source File: VcsSelectionHistoryDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
private JComponent createBottomPanel(final JComponent addComp) {
  JBSplitter splitter = new JBSplitter(true, COMMENTS_SPLITTER_PROPORTION_KEY, COMMENTS_SPLITTER_PROPORTION);
  splitter.setDividerWidth(4);

  JPanel tablePanel = new JPanel(new BorderLayout());
  tablePanel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);

  JPanel statusPanel = new JPanel(new FlowLayout());
  statusPanel.add(myStatusSpinner);
  statusPanel.add(myStatusLabel);

  JPanel separatorPanel = new JPanel(new BorderLayout());
  separatorPanel.add(myChangesOnlyCheckBox, BorderLayout.WEST);
  separatorPanel.add(statusPanel, BorderLayout.EAST);

  tablePanel.add(separatorPanel, BorderLayout.NORTH);

  splitter.setFirstComponent(tablePanel);
  splitter.setSecondComponent(createComments(addComp));

  return splitter;
}
 
Example #7
Source File: IMChatConsole.java    From SmartIM4IntelliJ with Apache License 2.0 5 votes vote down vote up
public void initUI() {
    top = new ChatHistoryPane();
    bottom = new ChatInputPane();
    historyWidget = top.getEditorPane();
    inputWidget = bottom.getTextPane();
    btnSend = bottom.getBtnSend();
    btnSend.setVisible(SmartIMSettings.getInstance().getState().SHOW_SEND);
    btnSend.addActionListener(new SendAction());
    inputWidget.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Send");
    inputWidget.getActionMap().put("Send", btnSend.getAction());

    splitter = new JBSplitter(true);
    splitter.setSplitterProportionKey("chat.splitter.key");
    splitter.setFirstComponent(top.getPanel());
    splitter.setSecondComponent(bottom.getPanel());
    setContent(splitter);
    splitter.setPreferredSize(new Dimension(-1, 200));
    splitter.setProportion(0.85f);

    inputWidget.addKeyListener(new KeyAdapter() {
        @Override public void keyPressed(KeyEvent e) {
            super.keyPressed(e);
            if (SmartIMSettings.getInstance().getState().KEY_SEND.equals(SwingUtils.key2string(e))) {
                String input = inputWidget.getText();
                if (!input.isEmpty()) {
                    inputWidget.setText("");
                    send(input);
                }
                e.consume();
            }
        }
    });
    initToolBar();
    initHistoryWidget();
}
 
Example #8
Source File: RegexpHelperDialog.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
@Override
public void preShow() {
    setTitle(Localizer.get("title.RegexpHelper"));
    panel.setLayout(new MigLayout(new LC().gridGap("0", "8pt")));

    JLabel jlPattern = new JLabel(Localizer.get("label.RegexpPattern"));

    tfPattern = new EditorTextField(".*My[\\w]+\\.html.*", project, RegExpFileType.INSTANCE);
    tfPattern.setOneLineMode(false);

    JLabel jlText = new JLabel(Localizer.get("label.Text"));
    tfText = new EditorTextField("Bla bla bla\nMyUniqueTextFragment.html\nBla bla bla");
    tfText.setOneLineMode(false);

    JPanel secondPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("0", "4pt")));
    secondPanel.add(jlText, new CC().wrap());
    secondPanel.add(tfText, new CC().wrap().push().grow());

    JBSplitter splitter = new JBSplitter(true, 0.35f);
    splitter.setFirstComponent(tfPattern);
    splitter.setSecondComponent(secondPanel);
    splitter.setShowDividerControls(true);
    splitter.setHonorComponentsMinimumSize(true);

    btnTry = new JButton(Localizer.get("TryIt"));
    btnTry.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            doMatch();
        }
    });
    jlResult = new JLabel(Localizer.get("ResultWillBeHere"));

    panel.add(jlPattern, new CC().wrap().spanX());
    panel.add(splitter, new CC().wrap().push().grow().spanX());
    panel.add(btnTry, new CC().spanX().split(2));
    panel.add(jlResult, new CC().wrap().pushX().growX());
}
 
Example #9
Source File: CodeFragmentInputComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void addComponent(JPanel contentPanel, JPanel resultPanel) {
  final JBSplitter splitter = new JBSplitter(true, 0.3f, 0.2f, 0.7f);
  splitter.setSplitterProportionKey(mySplitterProportionKey);
  contentPanel.add(splitter, BorderLayout.CENTER);
  splitter.setFirstComponent(myMainPanel);
  splitter.setSecondComponent(resultPanel);
}
 
Example #10
Source File: CruciblePanel.java    From Crucible4IDEA with MIT License 4 votes vote down vote up
public CruciblePanel(@NotNull final Project project) {
  super(false);
  myProject = project;

  final JBSplitter splitter = new JBSplitter(false, 0.2f);

  myReviewModel = new CrucibleReviewModel(project);
  myReviewTable = new JBTable(myReviewModel);
  myReviewTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myReviewTable.setStriped(true);
  myReviewTable.setExpandableItemsEnabled(false);

  final TableColumnModel columnModel = myReviewTable.getColumnModel();
  columnModel.getColumn(1).setCellRenderer(new DescriptionCellRenderer());

  setUpColumnWidths(myReviewTable);
  myReviewTable.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
      if (e.getClickCount() == 2) {
        final int viewRow = myReviewTable.getSelectedRow();
        if (viewRow >= 0 &&  viewRow < myReviewTable.getRowCount()) {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              final Review review =
                CrucibleManager.getInstance(myProject).getDetailsForReview((String)myReviewTable.
                  getValueAt(viewRow, myReviewTable.getColumnModel().getColumnIndex(CrucibleBundle.message("crucible.id"))));
              if (review != null) {
                openDetailsToolWindow(review);
                myReviewTable.clearSelection();
              }
            }
          }, ModalityState.stateForComponent(myReviewTable));

        }
      }
  }});

  final TableRowSorter<TableModel> rowSorter = new TableRowSorter<TableModel>(myReviewModel);
  rowSorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(4, SortOrder.ASCENDING)));
  rowSorter.sort();
  myReviewTable.setRowSorter(rowSorter);

  final JScrollPane detailsScrollPane = ScrollPaneFactory.createScrollPane(myReviewTable);

  final SimpleTreeStructure reviewTreeStructure = createTreeStructure();
  final DefaultTreeModel model = new CrucibleTreeModel();
  final SimpleTree reviewTree = new SimpleTree(model);

  new AbstractTreeBuilder(reviewTree, model, reviewTreeStructure, null);
  reviewTree.invalidate();

  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(reviewTree);
  splitter.setFirstComponent(scrollPane);
  splitter.setSecondComponent(detailsScrollPane);
  setContent(splitter);
}
 
Example #11
Source File: ContentEntriesEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JPanel createComponentImpl() {
  final Module module = getModule();
  final Project project = module.getProject();

  myContentEntryEditorListener = new MyContentEntryEditorListener();

  final JPanel mainPanel = new JPanel(new BorderLayout());

  final JPanel entriesPanel = new JPanel(new BorderLayout());

  final DefaultActionGroup group = new DefaultActionGroup();
  final AddContentEntryAction action = new AddContentEntryAction();
  action.registerCustomShortcutSet(KeyEvent.VK_C, InputEvent.ALT_DOWN_MASK, mainPanel);
  group.add(action);

  myEditorsPanel = new ScrollablePanel(new VerticalStackLayout());
  myEditorsPanel.setBackground(BACKGROUND_COLOR);
  JScrollPane myScrollPane = ScrollPaneFactory.createScrollPane(myEditorsPanel, true);
  entriesPanel.add(new ToolbarPanel(myScrollPane, group), BorderLayout.CENTER);

  final JBSplitter splitter = new OnePixelSplitter(false);
  splitter.setProportion(0.6f);
  splitter.setHonorComponentsMinimumSize(true);

  myRootTreeEditor = new ContentEntryTreeEditor(project, myState);
  JComponent component = myRootTreeEditor.createComponent();
  component.setBorder(new CustomLineBorder(JBUI.scale(1),0,0,0));

  splitter.setFirstComponent(component);
  splitter.setSecondComponent(entriesPanel);
  JPanel contentPanel = new JPanel(new GridBagLayout());

  final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, myRootTreeEditor.getEditingActionsGroup(), true);
  contentPanel.add(new JLabel("Mark as:"),
                   new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, 0, new JBInsets(0, 5, 0, 5), 0,
                                          0));
  contentPanel.add(actionToolbar.getComponent(),
                   new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
                                          new JBInsets(0, 0, 0, 0), 0, 0));
  contentPanel.add(splitter,
                   new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
                                          new JBInsets(0, 0, 0, 0), 0, 0));

  mainPanel.add(contentPanel, BorderLayout.CENTER);

  final ModifiableRootModel model = getModel();
  if (model != null) {
    final ContentEntry[] contentEntries = model.getContentEntries();
    if (contentEntries.length > 0) {
      for (final ContentEntry contentEntry : contentEntries) {
        addContentEntryPanel(contentEntry);
      }
      selectContentEntry(contentEntries[0]);
    }
  }

  return mainPanel;
}