use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class OverridingMethodsDialog method createCenterPanel.
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 4, 0));
final MyTableModel tableModel = new MyTableModel();
myTable = new Table(tableModel);
myTable.setShowGrid(false);
TableColumnModel columnModel = myTable.getColumnModel();
// columnModel.getColumn(DISPLAY_NAME_COLUMN).setCellRenderer(new MemberSelectionTable.MyTableRenderer());
TableColumn checkboxColumn = columnModel.getColumn(CHECK_COLUMN);
TableUtil.setupCheckboxColumn(checkboxColumn);
checkboxColumn.setCellRenderer(new BooleanTableCellRenderer());
// make SPACE check/uncheck selected rows
@NonNls InputMap inputMap = myTable.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "enable_disable");
@NonNls final ActionMap actionMap = myTable.getActionMap();
actionMap.put("enable_disable", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
if (myTable.isEditing())
return;
int[] rows = myTable.getSelectedRows();
if (rows.length > 0) {
boolean valueToBeSet = false;
for (int row : rows) {
if (!myChecked[row]) {
valueToBeSet = true;
break;
}
}
for (int row : rows) {
myChecked[row] = valueToBeSet;
}
tableModel.updateData();
}
}
});
/*Border titledBorder = IdeBorderFactory.createBoldTitledBorder("Select methods");
Border emptyBorder = BorderFactory.createEmptyBorder(0, 5, 5, 5);
Border border = BorderFactory.createCompoundBorder(titledBorder, emptyBorder);
panel.setBorder(border);*/
panel.setLayout(new BorderLayout());
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
panel.add(scrollPane, BorderLayout.CENTER);
ListSelectionListener selectionListener = new ListSelectionListener() {
public void valueChanged(final ListSelectionEvent e) {
int index = myTable.getSelectionModel().getLeadSelectionIndex();
if (index != -1) {
UsageInfo usageInfo = myOverridingMethods.get(index);
myUsagePreviewPanel.updateLayout(Collections.singletonList(usageInfo));
} else {
myUsagePreviewPanel.updateLayout(null);
}
}
};
myTable.getSelectionModel().addListSelectionListener(selectionListener);
final Splitter splitter = new Splitter(true, 0.3f);
splitter.setFirstComponent(panel);
splitter.setSecondComponent(myUsagePreviewPanel);
myUsagePreviewPanel.updateLayout(null);
Disposer.register(myDisposable, new Disposable() {
public void dispose() {
splitter.dispose();
}
});
if (tableModel.getRowCount() != 0) {
myTable.getSelectionModel().addSelectionInterval(0, 0);
}
return splitter;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class ReplaceConstructorWithBuilderDialog method createCenterPanel.
protected JComponent createCenterPanel() {
final Splitter splitter = new Splitter(true);
splitter.setFirstComponent(createTablePanel());
splitter.setSecondComponent(myWholePanel);
final ActionListener enableDisableListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
setEnabled(myCreateBuilderClassRadioButton.isSelected());
IdeFocusManager.getInstance(myProject).requestFocus(myCreateBuilderClassRadioButton.isSelected() ? myNewClassName : myExistentClassTF.getChildComponent(), true);
validateButtons();
}
};
myCreateBuilderClassRadioButton.addActionListener(enableDisableListener);
myExistingBuilderClassRadioButton.addActionListener(enableDisableListener);
myCreateBuilderClassRadioButton.setSelected(true);
setEnabled(true);
final DocumentAdapter validateButtonsListener = new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateButtons();
}
};
myNewClassName.getDocument().addDocumentListener(validateButtonsListener);
final PsiClass psiClass = myConstructors[0].getContainingClass();
LOG.assertTrue(psiClass != null);
myNewClassName.setText(psiClass.getName() + "Builder");
return splitter;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class FileTemplateConfigurable method createComponent.
@Override
public JComponent createComponent() {
myMainPanel = new JPanel(new GridBagLayout());
myNameField = new JTextField();
myExtensionField = new JTextField();
mySplitter = new Splitter(true, myProportion);
myAdjustBox = new JCheckBox(IdeBundle.message("checkbox.reformat.according.to.style"));
myLiveTemplateBox = new JCheckBox(IdeBundle.message("checkbox.enable.live.templates"));
myTemplateEditor = createEditor();
myDescriptionComponent = new JEditorPane(UIUtil.HTML_MIME, EMPTY_HTML);
myDescriptionComponent.setEditable(false);
myDescriptionComponent.addHyperlinkListener(new BrowserHyperlinkListener());
myTopPanel = new JPanel(new GridBagLayout());
JPanel descriptionPanel = new JPanel(new GridBagLayout());
descriptionPanel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.description"), null), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.insetsBottom(2), 0, 0));
descriptionPanel.add(ScrollPaneFactory.createScrollPane(myDescriptionComponent), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insetsTop(2), 0, 0));
myMainPanel.add(myTopPanel, new GridBagConstraints(0, 0, 4, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0));
myMainPanel.add(mySplitter, new GridBagConstraints(0, 2, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0));
mySplitter.setSecondComponent(descriptionPanel);
setShowInternalMessage(null);
myNameField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(@NotNull FocusEvent e) {
onNameChanged();
}
});
myExtensionField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(@NotNull FocusEvent e) {
onNameChanged();
}
});
myMainPanel.setPreferredSize(JBUI.size(400, 300));
return myMainPanel;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class SelectTemplateDialog method createCenterPanel.
protected JComponent createCenterPanel() {
final JPanel centerPanel = new JPanel(new BorderLayout());
Splitter splitter;
centerPanel.add(BorderLayout.CENTER, splitter = new Splitter(false, 0.3f));
centerPanel.add(splitter);
splitter.setFirstComponent(showHistory ? existingTemplatesComponent.getHistoryPanel() : existingTemplatesComponent.getTemplatesPanel());
final JPanel panel;
splitter.setSecondComponent(panel = new JPanel(new BorderLayout()));
searchPatternEditor = UIUtil.createEditor(EditorFactory.getInstance().createDocument(""), project, false, true, ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), TemplateContextType.class));
JComponent centerComponent;
if (replace) {
replacePatternEditor = UIUtil.createEditor(EditorFactory.getInstance().createDocument(""), project, false, true, ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), TemplateContextType.class));
centerComponent = new Splitter(true);
((Splitter) centerComponent).setFirstComponent(searchPatternEditor.getComponent());
((Splitter) centerComponent).setSecondComponent(replacePatternEditor.getComponent());
} else {
centerComponent = searchPatternEditor.getComponent();
}
myCardLayout = new CardLayout();
myPreviewPanel = new JPanel(myCardLayout);
myPreviewPanel.add(centerComponent, PREVIEW_CARD);
JPanel selectPanel = new JPanel(new GridBagLayout());
GridBagConstraints gb = new GridBagConstraints(0, 0, 0, 0, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
selectPanel.add(new JLabel(SSRBundle.message("selecttemplate.template.label.please.select.template")), gb);
myPreviewPanel.add(selectPanel, SELECT_TEMPLATE_CARD);
panel.add(BorderLayout.CENTER, myPreviewPanel);
final JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0));
labelPanel.add(new JLabel(SSRBundle.message("selecttemplate.template.preview")));
labelPanel.add(UIUtil.createCompleteMatchInfo(() -> {
final Configuration[] configurations = getSelectedConfigurations();
return configurations.length != 1 ? null : configurations[0];
}));
panel.add(BorderLayout.NORTH, labelPanel);
return centerPanel;
}
use of com.intellij.openapi.ui.Splitter in project intellij-community by JetBrains.
the class CallerChooserBase method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
Splitter splitter = new Splitter(false, (float) 0.6);
JPanel result = new JPanel(new BorderLayout());
if (myTree == null) {
myTree = createTree();
} else {
final CheckedTreeNode root = (CheckedTreeNode) myTree.getModel().getRoot();
myRoot = (MethodNodeBase) root.getFirstChild();
}
myTreeSelectionListener = new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
final TreePath path = e.getPath();
if (path != null) {
final MethodNodeBase<M> node = (MethodNodeBase) path.getLastPathComponent();
myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> updateEditorTexts(node), 300);
}
}
};
myTree.getSelectionModel().addTreeSelectionListener(myTreeSelectionListener);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
splitter.setFirstComponent(scrollPane);
final JComponent callSitesViewer = createCallSitesViewer();
TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath == null) {
selectionPath = new TreePath(myRoot.getPath());
myTree.getSelectionModel().addSelectionPath(selectionPath);
}
final MethodNodeBase<M> node = (MethodNodeBase) selectionPath.getLastPathComponent();
updateEditorTexts(node);
splitter.setSecondComponent(callSitesViewer);
result.add(splitter);
return result;
}
Aggregations