private void createUIComponents() { defaultExtensionLabel = new JBLabel(TesterBundle.message("settings.defaultExtension")); defaultExtensionCombobox = new ComboBox<>(new String[]{"phpt", "php"}); bootstrapFileLabel = new JBLabel(TesterBundle.message("settings.bootstrapFile")); bootstrapFileField = new TextFieldWithBrowseButton(); bootstrapFileField.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php")); namespaceMappingTable = new NamespaceMappingTable(project); namespaceMappingPanel = ToolbarDecorator.createDecorator(namespaceMappingTable.getTableView(), new ElementProducer<TesterNamespaceMapping>() { @Override public TesterNamespaceMapping createElement() { return new TesterNamespaceMapping(); } @Override public boolean canCreateElement() { return true; } }).createPanel(); namespaceMappingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY), TesterBundle.message("settings.namespaceMappings.title"))); }
TableToolbarDecorator(@NotNull JTable table, @Nullable final ElementProducer<?> producer) { myTable = table; myProducer = producer; myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = isModelEditable(); if (isModelEditable()) { createDefaultTableActions(producer); } myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateButtons(); } }); myTable.addPropertyChangeListener("enabled", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateButtons(); } }); }
TreeToolbarDecorator(JTree tree, @Nullable final ElementProducer<?> producer) { myTree = tree; myProducer = producer; myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = myTree.getModel() instanceof EditableTreeModel; if (myTree.getModel() instanceof EditableTreeModel) { createDefaultTreeActions(); } myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { updateButtons(); } }); myTree.addPropertyChangeListener("enabled", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateButtons(); } }); }
TableToolbarDecorator(@Nonnull JTable table, @Nullable final ElementProducer<?> producer) { myTable = table; myProducer = producer; myAddActionEnabled = myRemoveActionEnabled = myUpActionEnabled = myDownActionEnabled = isModelEditable(); if (isModelEditable()) { createDefaultTableActions(producer); } myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateButtons(); } }); myTable.addPropertyChangeListener("enabled", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateButtons(); } }); }
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<MethodSignatureSetting>() { @Override public MethodSignatureSetting createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> MethodSignatureTypeSettingsForm.this.openTwigPathDialog(MethodSignatureTypeSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> MethodSignatureTypeSettingsForm.this.openTwigPathDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<MethodParameterSetting>() { @Override public MethodParameterSetting createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> MethodParameterReferenceSettingsForm.this.openTwigPathDialog(MethodParameterReferenceSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> MethodParameterReferenceSettingsForm.this.openTwigPathDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
private static ToolbarDecorator createDecorator(@NotNull JTree tree, @Nullable ElementProducer<?> producer) { return new TreeToolbarDecorator(tree, producer).initPosition(); }
public static <T> ToolbarDecorator createDecorator(@NotNull TableView<T> table, @Nullable ElementProducer<T> producer) { return new TableToolbarDecorator(table, producer).initPosition(); }
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<UseAliasOption>() { @Override public UseAliasOption createElement() { return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> { UseAliasOption useAliasOption = tableView.getSelectedObject(); if(useAliasOption == null) { return; } UseAliasForm.create(panel1, useAliasOption, option -> { tableView.getTableViewModel().fireTableDataChanged(); changed = true; }); }); tablePanel.setAddAction(anActionButton -> UseAliasForm.create(panel1, option -> { tableView.getListTableModel().addRow(option); changed = true; })); tablePanel.setRemoveAction(anActionButton -> { modelList.removeRow(tableView.getSelectedRow()); tableView.getTableViewModel().fireTableDataChanged(); changed = true; }); tablePanel.disableDownAction(); tablePanel.disableUpAction(); this.panel1.add(tablePanel.createPanel()); return this.panel; }
private static ToolbarDecorator createDecorator(@Nonnull JTree tree, @Nullable ElementProducer<?> producer) { return new TreeToolbarDecorator(tree, producer).initPosition(); }
public static <T> ToolbarDecorator createDecorator(@Nonnull TableView<T> table, @Nullable ElementProducer<T> producer) { return new TableToolbarDecorator(table, producer).initPosition(); }