protected void createParametersPanel() { if (myParamTable != null) { myCenterPanel.remove(myParamTable); } myParamTable = createParameterTableComponent(); myParamTable.setMinimumSize(JBUI.size(500, 100)); myCenterPanel.add(myParamTable, BorderLayout.CENTER); final JTable table = UIUtil.findComponentOfType(myParamTable, JTable.class); myCenterPanel.add(SeparatorFactory.createSeparator("&Parameters", table), BorderLayout.NORTH); if (table != null) { table.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { if (table.getRowCount() > 0) { final int col = table.getSelectedColumn(); final int row = table.getSelectedRow(); if (col == -1 || row == -1) { table.getSelectionModel().setSelectionInterval(0, 0); table.getColumnModel().getSelectionModel().setSelectionInterval(0, 0); } } } }); } }
protected void createParametersPanel() { if (myParamTable != null) { myCenterPanel.remove(myParamTable); } myParamTable = createParameterTableComponent(); myParamTable.setMinimumSize(new Dimension(500, 100)); myCenterPanel.add(myParamTable, BorderLayout.CENTER); final JTable table = UIUtil.findComponentOfType(myParamTable, JTable.class); myCenterPanel.add(SeparatorFactory.createSeparator("&Parameters", table), BorderLayout.NORTH); if (table != null) { table.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { if (table.getRowCount() > 0) { final int col = table.getSelectedColumn(); final int row = table.getSelectedRow(); if (col == -1 || row == -1) { table.getSelectionModel().setSelectionInterval(0, 0); table.getColumnModel().getSelectionModel().setSelectionInterval(0, 0); } } } }); } }
protected JComponent createSignaturePanel() { final JPanel panel = new JPanel(new BorderLayout()); panel.add(SeparatorFactory.createSeparator(RefactoringBundle.message("signature.preview.border.title"), null), BorderLayout.NORTH); panel.add(mySignature, BorderLayout.CENTER); updateSignature(); return panel; }
/** * @param title if title contains 'm' - it would look and feel as mnemonic */ public MemberSelectionPanel(String title, List<MemberInfo> memberInfo, String abstractColumnHeader) { super(); setLayout(new BorderLayout()); myTable = createMemberSelectionTable(memberInfo, abstractColumnHeader); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); add(SeparatorFactory.createSeparator(title, myTable), BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); }
@Nullable private JComponent createSearchScopePanel() { if (isInFileOnly()) return null; JPanel optionsPanel = new JPanel(new BorderLayout()); String scope = myFindUsagesOptions.searchScope.getDisplayName(); myScopeCombo = new ScopeChooserCombo(myProject, mySearchInLibrariesAvailable, true, scope); Disposer.register(myDisposable, myScopeCombo); optionsPanel.add(myScopeCombo, BorderLayout.CENTER); JComponent separator = SeparatorFactory.createSeparator(FindBundle.message("find.scope.label"), myScopeCombo.getComboBox()); optionsPanel.add(separator, BorderLayout.NORTH); return optionsPanel; }
/** * @param title if title contains 'm' - it would look and feel as mnemonic */ public MemberSelectionPanelBase(String title, Table table) { super(); setLayout(new BorderLayout()); myTable = table; JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); add(SeparatorFactory.createSeparator(title, myTable), BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); }
public TypeSelectionPanel(String title, List<TypeInfo> memberInfo) { super(); setLayout(new BorderLayout()); myTable = createMemberSelectionTable(memberInfo); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); add(SeparatorFactory.createSeparator(title, myTable), BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); }
@Nullable @Override public JComponent createComponent() { templateSettings = TemplateSettings.getInstance(); editor = createEditorInPanel(templateSettings.provideTemplateForName(templateName)); JPanel panel = new JPanel(new BorderLayout()); panel.setPreferredSize(new Dimension(400, 300)); panel.add(SeparatorFactory.createSeparator(templateHeaderText, null), BorderLayout.PAGE_START); panel.add(new ToolbarPanel(editorPanel, new DefaultActionGroup(new ResetToDefaultAction())), BorderLayout.CENTER); return panel; }
protected void createParametersPanel() { if(myParamTable != null) { myCenterPanel.remove(myParamTable); } myParamTable = createParameterTableComponent(); myParamTable.setMinimumSize(JBUI.size(500, 100)); myCenterPanel.add(myParamTable, BorderLayout.CENTER); final JTable table = UIUtil.findComponentOfType(myParamTable, JTable.class); myCenterPanel.add(SeparatorFactory.createSeparator("&Parameters", table), BorderLayout.NORTH); if(table != null) { table.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { if(table.getRowCount() > 0) { final int col = table.getSelectedColumn(); final int row = table.getSelectedRow(); if(col == -1 || row == -1) { table.getSelectionModel().setSelectionInterval(0, 0); table.getColumnModel().getSelectionModel().setSelectionInterval(0, 0); } } } }); } }
public FrameworkSupportOptionsComponent(FrameworkSupportModelBase model, LibrariesContainer container, Disposable parentDisposable, final FrameworkSupportInModuleProvider provider, final FrameworkSupportInModuleConfigurable configurable) { myModel = model; myConfigurable = configurable; VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 3, true, false); layout.setVerticalFill(true); myMainPanel = new JPanel(layout); myModel.registerOptionsComponent(provider, this); List<FrameworkVersion> versions = provider.getFrameworkType().getVersions(); if (!versions.isEmpty()) { myFrameworkVersionComponent = new FrameworkVersionComponent(model, provider.getFrameworkType().getId(), versions, "Versions:"); myMainPanel.add(myFrameworkVersionComponent.getMainPanel()); } else { myFrameworkVersionComponent = null; } final JComponent component = myConfigurable.createComponent(); if (component != null) { myMainPanel.add(component); } final boolean addSeparator = component != null || myFrameworkVersionComponent != null; myLibraryOptionsPanelWrapper = new JPanel(new BorderLayout()); myMainPanel.add(myLibraryOptionsPanelWrapper); if (myConfigurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) { ((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper)myConfigurable).getConfigurable().addListener( new FrameworkSupportConfigurableListener() { public void frameworkVersionChanged() { updateLibrariesPanel(); } }); } model.addFrameworkListener(new FrameworkSupportModelAdapter() { @Override public void wizardStepUpdated() { updateLibrariesPanel(); } }, parentDisposable); final CustomLibraryDescription description = myConfigurable.createLibraryDescription(); if (description != null) { myLibraryOptionsPanel = new LibraryOptionsPanel(description, new NotNullComputable<String>() { @NotNull @Override public String compute() { return myModel.getBaseDirectoryForLibrariesPath(); } }, createLibraryVersionFilter(), container, !myConfigurable.isOnlyLibraryAdded()) { @Override protected void onVersionChanged(@Nullable String version) { if (myFrameworkVersionComponent == null) { myModel.setSelectedLibraryVersion(provider.getId(), version); } } }; myLibraryOptionsPanel.setLibraryProvider(myModel.getLibraryProvider()); Disposer.register(myConfigurable, myLibraryOptionsPanel); if (addSeparator) { JComponent separator1 = SeparatorFactory.createSeparator("Libraries", null); separator1.setBorder(IdeBorderFactory.createEmptyBorder(5, 0, 5, 5)); myLibraryOptionsPanelWrapper.add(BorderLayout.NORTH, separator1); } myLibraryOptionsPanelWrapper.add(BorderLayout.CENTER, myLibraryOptionsPanel.getMainPanel()); myLibraryOptionsPanelWrapper.setVisible(myConfigurable.isVisible()); } }
public JComponent createCenterPanel() { final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); final Splitter splitter = new Splitter(true, 0.8f); myChangesBrowser = new RepositoryChangesBrowser(myProject, Collections.singletonList(myChangeList), new ArrayList<Change>(myChangeList.getChanges()), myChangeList, myToSelect) { @Override protected void buildToolBar(DefaultActionGroup toolBarGroup) { super.buildToolBar(toolBarGroup); toolBarGroup.add(ActionManager.getInstance().getAction(VcsActions.ACTION_COPY_REVISION_NUMBER)); } @Override protected void showDiffForChanges(final Change[] changesArray, final int indexInSelection) { if (myInAir && (myConvertor != null)) { final Change[] convertedChanges = new Change[changesArray.length]; for (int i = 0; i < changesArray.length; i++) { Change change = changesArray[i]; convertedChanges[i] = myConvertor.fun(change); } super.showDiffForChanges(convertedChanges, indexInSelection); } else { super.showDiffForChanges(changesArray, indexInSelection); } } }; myChangesBrowser.setUseCase(myInAir ? CommittedChangesBrowserUseCase.IN_AIR : null); splitter.setFirstComponent(myChangesBrowser); if (myCommitMessageArea != null) { JPanel commitPanel = new JPanel(new BorderLayout()); JComponent separator = SeparatorFactory.createSeparator(VcsBundle.message("label.commit.comment"), myCommitMessageArea); commitPanel.add(separator, BorderLayout.NORTH); commitPanel.add(commitMessageScroll, BorderLayout.CENTER); splitter.setSecondComponent(commitPanel); } mainPanel.add(splitter, BorderLayout.CENTER); final String description = getDescription(); if (description != null) { JPanel descPanel = new JPanel(); descPanel.add(new JLabel(XmlStringUtil.wrapInHtml(description))); descPanel.setBorder(BorderFactory.createEtchedBorder()); mainPanel.add(descPanel, BorderLayout.NORTH); } return mainPanel; }
@Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constr; // list label constr = new GridBagConstraints(); constr.gridy = 0; constr.anchor = GridBagConstraints.WEST; constr.fill = GridBagConstraints.HORIZONTAL; panel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.macros"), null), constr); // macros list constr = new GridBagConstraints(); constr.gridy = 1; constr.weightx = 1; constr.weighty = 1; constr.fill = GridBagConstraints.BOTH; constr.anchor = GridBagConstraints.WEST; panel.add(ScrollPaneFactory.createScrollPane(myMacrosList), constr); myMacrosList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myMacrosList.setPreferredSize(null); // preview label constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 2; constr.anchor = GridBagConstraints.WEST; constr.fill = GridBagConstraints.HORIZONTAL; panel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.macro.preview"), null), constr); // preview constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 3; constr.weightx = 1; constr.weighty = 1; constr.fill = GridBagConstraints.BOTH; constr.anchor = GridBagConstraints.WEST; panel.add(ScrollPaneFactory.createScrollPane(myPreviewTextarea), constr); myPreviewTextarea.setEditable(false); myPreviewTextarea.setLineWrap(true); myPreviewTextarea.setPreferredSize(null); panel.setPreferredSize(JBUI.size(400, 500)); return panel; }
public FrameworkSupportOptionsComponent(FrameworkSupportModelBase model, LibrariesContainer container, Disposable parentDisposable, FrameworkSupportInModuleProvider provider, final FrameworkSupportInModuleConfigurable configurable) { myModel = model; myConfigurable = configurable; VerticalFlowLayout layout = new VerticalFlowLayout(); layout.setVerticalFill(true); myMainPanel = new JPanel(layout); myModel.registerOptionsComponent(provider, this); List<FrameworkVersion> versions = provider.getFrameworkType().getVersions(); if (!versions.isEmpty()) { myFrameworkVersionComponent = new FrameworkVersionComponent(model, provider.getFrameworkType().getId(), versions); myMainPanel.add(myFrameworkVersionComponent.getMainPanel()); } final JComponent component = myConfigurable.createComponent(); if (component != null) { myMainPanel.add(component); } final boolean addSeparator = component != null || myFrameworkVersionComponent != null; myLibraryOptionsPanelWrapper = new JPanel(new BorderLayout()); myMainPanel.add(myLibraryOptionsPanelWrapper); if (myConfigurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) { ((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper)myConfigurable).getConfigurable().addListener( new FrameworkSupportConfigurableListener() { public void frameworkVersionChanged() { updateLibrariesPanel(); } }); } model.addFrameworkListener(new FrameworkSupportModelAdapter() { @Override public void wizardStepUpdated() { updateLibrariesPanel(); } }, parentDisposable); final CustomLibraryDescription description = myConfigurable.createLibraryDescription(); if (description != null) { myLibraryOptionsPanel = new LibraryOptionsPanel(description, myModel.getBaseDirectoryForLibrariesPath(), createLibraryVersionFilter(), container, !myConfigurable.isOnlyLibraryAdded()); Disposer.register(myConfigurable, myLibraryOptionsPanel); if (addSeparator) { JComponent separator1 = SeparatorFactory.createSeparator("Libraries", null); separator1.setBorder(IdeBorderFactory.createEmptyBorder(5, 0, 5, 5)); myLibraryOptionsPanelWrapper.add(BorderLayout.NORTH, separator1); } myLibraryOptionsPanelWrapper.add(BorderLayout.CENTER, myLibraryOptionsPanel.getMainPanel()); myLibraryOptionsPanelWrapper.setVisible(myConfigurable.isVisible()); } }
public JComponent createCenterPanel() { final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); final Splitter splitter = new Splitter(true, 0.8f); myChangesBrowser = new RepositoryChangesBrowser(myProject, Collections.singletonList(myChangeList), new ArrayList<Change>(myChangeList.getChanges()), myChangeList, myToSelect) { @Override protected void buildToolBar(DefaultActionGroup toolBarGroup) { super.buildToolBar(toolBarGroup); toolBarGroup.add(new CopyRevisionNumberAction()); } @Override public Object getData(@NonNls String dataId) { Object data = super.getData(dataId); if (data != null) { return data; } return ChangeListViewerDialog.this.getData(dataId); } @Override protected void showDiffForChanges(final Change[] changesArray, final int indexInSelection) { if (myInAir && (myConvertor != null)) { final Change[] convertedChanges = new Change[changesArray.length]; for (int i = 0; i < changesArray.length; i++) { Change change = changesArray[i]; convertedChanges[i] = myConvertor.fun(change); } super.showDiffForChanges(convertedChanges, indexInSelection); } else { super.showDiffForChanges(changesArray, indexInSelection); } } }; myChangesBrowser.setUseCase(myInAir ? CommittedChangesBrowserUseCase.IN_AIR : null); splitter.setFirstComponent(myChangesBrowser); if (myCommitMessageArea != null) { JPanel commitPanel = new JPanel(new BorderLayout()); JComponent separator = SeparatorFactory.createSeparator(VcsBundle.message("label.commit.comment"), myCommitMessageArea); commitPanel.add(separator, BorderLayout.NORTH); commitPanel.add(commitMessageScroll, BorderLayout.CENTER); splitter.setSecondComponent(commitPanel); } mainPanel.add(splitter, BorderLayout.CENTER); final String description = getDescription(); if (description != null) { JPanel descPanel = new JPanel(); descPanel.add(new JLabel(XmlStringUtil.wrapInHtml(description))); descPanel.setBorder(BorderFactory.createEtchedBorder()); mainPanel.add(descPanel, BorderLayout.NORTH); } return mainPanel; }
@Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constr; // list label constr = new GridBagConstraints(); constr.gridy = 0; constr.anchor = GridBagConstraints.WEST; constr.fill = GridBagConstraints.HORIZONTAL; panel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.macros"), null), constr); // macros list constr = new GridBagConstraints(); constr.gridy = 1; constr.weightx = 1; constr.weighty = 1; constr.fill = GridBagConstraints.BOTH; constr.anchor = GridBagConstraints.WEST; panel.add(ScrollPaneFactory.createScrollPane(myMacrosList), constr); myMacrosList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myMacrosList.setPreferredSize(null); // preview label constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 2; constr.anchor = GridBagConstraints.WEST; constr.fill = GridBagConstraints.HORIZONTAL; panel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.macro.preview"), null), constr); // preview constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 3; constr.weightx = 1; constr.weighty = 1; constr.fill = GridBagConstraints.BOTH; constr.anchor = GridBagConstraints.WEST; panel.add(ScrollPaneFactory.createScrollPane(myPreviewTextarea), constr); myPreviewTextarea.setEditable(false); myPreviewTextarea.setLineWrap(true); myPreviewTextarea.setPreferredSize(null); panel.setPreferredSize(new Dimension(400, 500)); return panel; }
public JComponent createCenterPanel() { final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); final Splitter splitter = new Splitter(true, 0.8f); myChangesBrowser = new RepositoryChangesBrowser(myProject, Collections.singletonList(myChangeList), new ArrayList<Change>(myChangeList.getChanges()), myChangeList, myToSelect) { @Override protected void buildToolBar(DefaultActionGroup toolBarGroup) { super.buildToolBar(toolBarGroup); toolBarGroup.add(ActionManager.getInstance().getAction("Vcs.CopyRevisionNumberAction")); } @Override public Object getData(@Nonnull @NonNls Key dataId) { Object data = super.getData(dataId); if (data != null) { return data; } return ChangeListViewerDialog.this.getData(dataId); } @Override protected void showDiffForChanges(final Change[] changesArray, final int indexInSelection) { if (myInAir && (myConvertor != null)) { final Change[] convertedChanges = new Change[changesArray.length]; for (int i = 0; i < changesArray.length; i++) { Change change = changesArray[i]; convertedChanges[i] = myConvertor.fun(change); } super.showDiffForChanges(convertedChanges, indexInSelection); } else { super.showDiffForChanges(changesArray, indexInSelection); } } }; myChangesBrowser.setUseCase(myInAir ? CommittedChangesBrowserUseCase.IN_AIR : null); splitter.setFirstComponent(myChangesBrowser); if (myCommitMessageArea != null) { JPanel commitPanel = new JPanel(new BorderLayout()); JComponent separator = SeparatorFactory.createSeparator(VcsBundle.message("label.commit.comment"), myCommitMessageArea); commitPanel.add(separator, BorderLayout.NORTH); commitPanel.add(commitMessageScroll, BorderLayout.CENTER); splitter.setSecondComponent(commitPanel); } mainPanel.add(splitter, BorderLayout.CENTER); final String description = getDescription(); if (description != null) { JPanel descPanel = new JPanel(); descPanel.add(new JLabel(XmlStringUtil.wrapInHtml(description))); descPanel.setBorder(BorderFactory.createEtchedBorder()); mainPanel.add(descPanel, BorderLayout.NORTH); } return mainPanel; }
protected JComponent createCenterPanel() { myTable = new JBTable(myTableModel); myTable.setStriped(true); TableColumn nameColumn = myTable.getColumnModel().getColumn(NAME_COLUMN); TableColumn valueColumn = myTable.getColumnModel().getColumn(VALUE_COLUMN); Project project = myClass.getProject(); nameColumn.setCellRenderer(new MyCellRenderer()); nameColumn.setCellEditor(new StringTableCellEditor(project)); valueColumn.setCellRenderer(new MyCodeFragmentTableCellRenderer()); valueColumn.setCellEditor(new JavaCodeFragmentTableCellEditor(project)); myTable.setPreferredScrollableViewportSize(new Dimension(210, myTable.getRowHeight() * 4)); myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myTable.getSelectionModel().setSelectionInterval(0, 0); myTable.setSurrendersFocusOnKeystroke(true); myTable.setCellSelectionEnabled(true); myTable.setFocusCycleRoot(true); if (myHideDefaultValueColumn) { final TableColumn defaultValue = myTable.getColumnModel().getColumn(VALUE_COLUMN); myTable.removeColumn(defaultValue); myTable.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (e.getType() == TableModelEvent.INSERT) { myTable.getModel().removeTableModelListener(this); final TableColumnAnimator animator = new TableColumnAnimator(myTable); animator.setStep(20); animator.addColumn(defaultValue, myTable.getWidth() / 2); animator.startAndDoWhenDone(new Runnable() { @Override public void run() { myTable.editCellAt(myTable.getRowCount() - 1, 0); } }); animator.start(); } } }); } final JPanel panel = new JPanel(new BorderLayout()); panel.add(SeparatorFactory.createSeparator(RefactoringBundle.message("changeClassSignature.parameters.panel.border.title"), myTable), BorderLayout.NORTH); panel.add(ToolbarDecorator.createDecorator(myTable).createPanel(), BorderLayout.CENTER); return panel; }