@Override public void reset() { super.reset(); myProjectJdksModel.reset(myProject); myRoot.removeAllChildren(); final Map<Sdk, Sdk> sdks = myProjectJdksModel.getProjectSdks(); for (Sdk sdk : sdks.keySet()) { final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject); addNode(new MyNode(configurable), myRoot); } selectJdk(myProjectJdksModel.getProjectSdk()); //restore selection JBSplitter splitter = extractSplitter(); if (splitter != null) { splitter.setAndLoadSplitterProportionKey("project.jdk.splitter"); } }
@NotNull public static JBSplitter createNavigationSplitter(@Nullable JComponent leftPanelContents, @Nullable JComponent rightPanelContents) { JBPanel navigationPanel = new JBPanel(new BorderLayout()); navigationPanel.setBackground(JBColor.background()); if (leftPanelContents != null) { navigationPanel.add(leftPanelContents, BorderLayout.CENTER); } JBPanel contextInformationPanel = new JBPanel(new BorderLayout()); contextInformationPanel.setBackground(JBColor.background()); if (rightPanelContents != null) { contextInformationPanel.add(rightPanelContents, BorderLayout.CENTER); } JBSplitter navigationSplitter = new JBSplitter(false); navigationSplitter.setFirstComponent(navigationPanel); navigationSplitter.setSecondComponent(contextInformationPanel); navigationSplitter.setDividerWidth(DIVIDER_WIDTH); return navigationSplitter; }
public void resize() { ThreeComponentsSplitter threePane = getThreePanes(); assert (threePane.getLastComponent() instanceof JBSplitter); JBSplitter bottomSplitter = (JBSplitter)threePane.getLastComponent(); assert (threePane.getInnerComponent() instanceof JBSplitter); JBSplitter middleSplitter = (JBSplitter)threePane.getInnerComponent(); int scrubberHeight = getScrubberScrollPane().getMinimumSize().height; if (threePane.getFirstSize() < scrubberHeight) { int totalHeight = threePane.getHeight(); int residualHeightAfter = Math.max(0, totalHeight - scrubberHeight); threePane.setFirstSize(scrubberHeight); int middleSize = middleSplitter.getPreferredSize().height; int bottomSize = bottomSplitter.getPreferredSize().height; if (bottomSize + middleSize > 0) { threePane.setLastSize(residualHeightAfter * bottomSize / (bottomSize + middleSize)); // Split the middle and bottom panes evenly. } else { threePane.setLastSize(residualHeightAfter / 2); } } }
/** * 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); }
@NotNull private JComponent createComponent() { final JBSplitter splitter = new JBSplitter(false, 0.5f, 0.15f, 0.85f); splitter.setSplitterProportionKey(MY_PROPORTION_KEY); splitter.setFirstComponent(myMainEditor.getComponent()); splitter.setSecondComponent(mySecondEditor.getComponent()); if (myMainEditor instanceof TextEditor) { myToolbarWrapper = new AsciiDocToolbarPanel(((TextEditor) myMainEditor).getEditor()); } if (mySecondEditor instanceof TextEditor) { myToolbarWrapper = new AsciiDocToolbarPanel(((TextEditor) mySecondEditor).getEditor()); } final JPanel result = new JPanel(new BorderLayout()); result.add(myToolbarWrapper, BorderLayout.NORTH); result.add(splitter, BorderLayout.CENTER); adjustEditorsVisibility(); return result; }
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; }
private void initUI() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new LoginAction(this, toolWindow)); group.add(new HideContactAction(this)); //group.add(new TestAction(this)); AnAction action = new DisconnectAction(this); group.add(action); group.add(new AbstractAction("Settings", "Settgins", AllIcons.General.Settings, this) { @Override public void actionPerformed(AnActionEvent anActionEvent) { ShowSettingsUtil.getInstance().editConfigurable(project, new SmartSettingsPanel()); } }); // group.add(new TestAction(this)); 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); }
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 (e.getKeyCode() == KeyEvent.VK_ENTER) { String input = inputWidget.getText(); if (!input.isEmpty()) { inputWidget.setText(""); send(input); } e.consume(); } } }); initToolBar(); initHistoryWidget(); }
@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()); }
private JComponent createComponent() { final JBSplitter splitter = new JBSplitter(false, 0.5f, 0.15f, 0.85f); splitter.setFirstComponent(swaggerEditor.getComponent()); splitter.setSecondComponent(swaggerViewer); swaggerUIToolbar = new SwaggerUIToolbar(splitter); JPanel result = new JPanel(new BorderLayout()); result.add(swaggerUIToolbar, BorderLayout.NORTH); result.add(splitter, BorderLayout.CENTER); return result; }
@Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); JBSplitter splitter = new JBSplitter(true, .5F, .2F, .8F); splitter.setFirstComponent(new JBScrollPane(myRequestsTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); splitter.setSecondComponent( new JBScrollPane(myStacktrace, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)); panel.add(splitter, BorderLayout.CENTER); return panel; }
@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); }
private void splitWindow() { Component console = getComponent(0); removeAll(); JBSplitter p = new JBSplitter(false, 2f/3); p.setFirstComponent((JComponent)console); p.setSecondComponent(mySplitView.getPanel()); p.setShowDividerControls(true); p.setHonorComponentsMinimumSize(true); add(p, BorderLayout.CENTER); validate(); repaint(); }
public void restoreWindow() { JBSplitter pane = (JBSplitter)getComponent(0); removeAll(); if (mySplitView != null) { Disposer.dispose(mySplitView); mySplitView = null; } add(pane.getFirstComponent(), BorderLayout.CENTER); validate(); repaint(); }
private void initializeToolWindow() { JBPanel mainPanel = new JBPanel(new BorderLayout()); JBPanel addressPanel = new JBPanel(new FlowLayout(FlowLayout.LEFT)); ActionToolbar rightToolbar = createToolbar(); JBLabel addressLabel = new JBLabel("Location: "); addressTextField = new JBTextField(25); addressPanel.add(addressLabel); addressPanel.add(addressTextField); mainPanel.add(addressPanel, BorderLayout.NORTH); requestTextField = new EditorTextField(); responseTextField = new EditorTextField(); requestTextField.setPlaceholder("Request"); responseTextField.setPlaceholder("Response"); JBSplitter splitter = new JBSplitter(false, 0.5f); splitter.setShowDividerControls(true); splitter.setFirstComponent(requestTextField); splitter.setSecondComponent(responseTextField); mainPanel.add(splitter, BorderLayout.CENTER); setContent(mainPanel); setToolbar(rightToolbar.getComponent()); }
@Override public JComponent createComponent() { myComponent = new MyPanel(); mySplitter = Registry.is("ide.new.project.settings") ? new OnePixelSplitter(false, .15f) : new JBSplitter(false, .15f); mySplitter.setSplitterProportionKey("ProjectStructure.TopLevelElements"); mySplitter.setHonorComponentsMinimumSize(true); initSidePanel(); final JPanel left = new JPanel(new BorderLayout()) { @Override public Dimension getMinimumSize() { final Dimension original = super.getMinimumSize(); return new Dimension(Math.max(original.width, 100), original.height); } }; final DefaultActionGroup toolbarGroup = new DefaultActionGroup(); toolbarGroup.add(new BackAction(myComponent)); toolbarGroup.add(new ForwardAction(myComponent)); final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarGroup, true); toolbar.setTargetComponent(myComponent); myToolbarComponent = toolbar.getComponent(); if (Registry.is("ide.new.project.settings")) { left.setBackground(UIUtil.SIDE_PANEL_BACKGROUND); myToolbarComponent.setBackground(UIUtil.SIDE_PANEL_BACKGROUND); } left.add(myToolbarComponent, BorderLayout.NORTH); left.add(mySidePanel, BorderLayout.CENTER); mySplitter.setFirstComponent(left); mySplitter.setSecondComponent(myDetails); myComponent.add(mySplitter, BorderLayout.CENTER); if (!Registry.is("ide.new.project.settings")) { myErrorsComponent = new ConfigurationErrorsComponent(myProject); myComponent.add(myErrorsComponent, BorderLayout.SOUTH); } myUiInitialized = true; return myComponent; }
@Nullable private JBSplitter extractSplitter() { final Component[] components = myWholePanel.getComponents(); return components.length == 1 && components[0] instanceof JBSplitter ? (JBSplitter)components[0] : null; }
@Override public JPanel createComponentImpl() { final Module module = getModule(); final Project project = module.getProject(); myContentEntryEditorListener = new MyContentEntryEditorListener(); final JPanel mainPanel = new JPanel(new BorderLayout()); if (!Registry.is("ide.new.project.settings")) { mainPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); } addAdditionalSettingsToPanel(mainPanel); 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, Registry.is("ide.new.project.settings")); final ToolbarPanel toolbarPanel = new ToolbarPanel(myScrollPane, group); if (Registry.is("ide.new.project.settings")) { toolbarPanel.setBorder(new CustomLineBorder(1,0,0,0)); } entriesPanel.add(toolbarPanel, BorderLayout.CENTER); final JBSplitter splitter = Registry.is("ide.new.project.settings") ? new OnePixelSplitter(false) : new JBSplitter(false); splitter.setProportion(0.6f); splitter.setHonorComponentsMinimumSize(true); myRootTreeEditor = createContentEntryTreeEditor(project); final JComponent component = myRootTreeEditor.createComponent(); if (Registry.is("ide.new.project.settings")) { component.setBorder(new CustomLineBorder(1,0,0,0)); } splitter.setFirstComponent(component); splitter.setSecondComponent(entriesPanel); JPanel contentPanel = new JPanel(new GridBagLayout()); if (!Registry.is("ide.new.project.settings")) { contentPanel.setBorder(BorderFactory.createEtchedBorder()); } 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 Insets(0, 10, 0, 10), 0, 0)); contentPanel.add(actionToolbar.getComponent(), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(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 Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(contentPanel, BorderLayout.CENTER); final JPanel innerPanel = createBottomControl(module); if (innerPanel != null) { mainPanel.add(innerPanel, BorderLayout.SOUTH); } final ModifiableRootModel model = getModel(); if (model != null) { final ContentEntry[] contentEntries = model.getContentEntries(); if (contentEntries.length > 0) { for (final ContentEntry contentEntry : contentEntries) { addContentEntryPanel(contentEntry.getUrl()); } selectContentEntry(contentEntries[0].getUrl()); } } return mainPanel; }
private void createUIComponents() { MouseAdapter l = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.getSource() == myCloseLabel) { closeSearchComponent(); } else if (e.getSource() == mySearchLabel) { showSearchComponent(); } else if (e.getSource() == myZoomFitLabel) { myTraceViewCanvas.zoomFit(); } } }; myDefaultHeaderPanel = new EditorHeaderComponent(); mySearchLabel = new JLabel(AllIcons.Actions.Search); mySearchLabel.addMouseListener(l); mySearchLabel.setToolTipText("Find (Ctrl + F)"); myZoomFitLabel = new JLabel(AndroidIcons.ZoomFit); myZoomFitLabel.setToolTipText("Zoom Fit"); myZoomFitLabel.addMouseListener(l); myFindPanel = new EditorHeaderComponent(); myFindFieldWrapper = new NonOpaquePanel(new BorderLayout()); mySearchField = createSearchField(); myFindFieldWrapper.add(mySearchField); myCloseLabel = new JLabel(AllIcons.Actions.Cross); myCloseLabel.addMouseListener(l); myVmStatsTreeTableModel = new VmStatsTreeTableModel(); myTreeTable = new TreeTable(myVmStatsTreeTableModel); myTraceViewCanvas = new TraceViewCanvasWrapper(); JBScrollPane scrollPane = new JBScrollPane(myTreeTable); mySplitter = new JBSplitter(true, 0.75f); mySplitter.setShowDividerControls(true); mySplitter.setShowDividerIcon(true); mySplitter.setFirstComponent(myTraceViewCanvas); mySplitter.setSecondComponent(scrollPane); }
private JBSplitter getSplitter() { return (JBSplitter)mySplitParent.getComponents()[0]; }
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); }
@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; }