use of com.intellij.ui.table.JBTable in project AndroidWiFiADB by pedrovgs.
the class CardLayoutDevices method createTableDevices.
private void createTableDevices() {
AndroidDevicesTableModel model = new AndroidDevicesTableModel();
for (Device device : devices) {
model.add(device);
}
tableDevices = new JBTable(model);
configureTableAppearance();
panelDevices = new JPanel(new BorderLayout());
panelDevices.add(tableDevices.getTableHeader(), BorderLayout.NORTH);
panelDevices.add(tableDevices, BorderLayout.CENTER);
}
use of com.intellij.ui.table.JBTable in project azure-tools-for-java by Microsoft.
the class AzureSelectDockerHostStep method createUIComponents.
private void createUIComponents() {
final DefaultTableModel dockerListTableModel = new DefaultTableModel() {
@Override
public boolean isCellEditable(int row, int col) {
return (col == 0);
}
public Class<?> getColumnClass(int colIndex) {
return getValueAt(0, colIndex).getClass();
}
};
dockerListTableModel.addColumn("");
dockerListTableModel.addColumn("Name");
dockerListTableModel.addColumn("State");
dockerListTableModel.addColumn("OS");
dockerListTableModel.addColumn("API URL");
dockerHostsTable = new JBTable(dockerListTableModel);
dockerHostsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
TableColumn column = dockerHostsTable.getColumnModel().getColumn(0);
column.setMinWidth(23);
column.setMaxWidth(23);
column = dockerHostsTable.getColumnModel().getColumn(1);
column.setPreferredWidth(150);
column = dockerHostsTable.getColumnModel().getColumn(2);
column.setPreferredWidth(30);
column = dockerHostsTable.getColumnModel().getColumn(3);
column.setPreferredWidth(110);
column = dockerHostsTable.getColumnModel().getColumn(4);
column.setPreferredWidth(150);
dockerListTableModel.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent tableEvent) {
if (tableEvent.getType() == TableModelEvent.UPDATE) {
DockerHostsTableSelection currentSelection = new DockerHostsTableSelection();
// int column = dockerHostsTable.getSelectedColumn();
int column = tableEvent.getColumn();
currentSelection.row = tableEvent.getFirstRow();
if (column == 0) {
DefaultTableModel tableModel = (DefaultTableModel) dockerHostsTable.getModel();
if ((Boolean) tableModel.getValueAt(currentSelection.row, 0)) {
if (dockerHostsTableSelection == null) {
dockerHostsTableSelection = currentSelection;
dockerHostsTableSelection.host = dockerManager.getDockerHostForURL((String) tableModel.getValueAt(currentSelection.row, 4));
if (dockerHostsTableSelection.host != null) {
model.setSubscription(dockerManager.getSubscriptionsMap().get(dockerHostsTableSelection.host.sid));
}
} else {
int oldRow = dockerHostsTableSelection.row;
dockerHostsTableSelection = null;
if (currentSelection.row != oldRow) {
// disable previous selection
tableModel.setValueAt(false, oldRow, 0);
dockerHostsTableSelection = currentSelection;
dockerHostsTableSelection.host = dockerManager.getDockerHostForURL((String) tableModel.getValueAt(dockerHostsTable.getSelectedRow(), 4));
if (dockerHostsTableSelection.host != null) {
model.setSubscription(dockerManager.getSubscriptionsMap().get(dockerHostsTableSelection.host.sid));
}
}
}
setFinishButtonState(doValidate(false) == null);
setNextButtonState(doValidate(false) == null);
} else {
dockerHostsTableSelection = null;
setFinishButtonState(false);
setNextButtonState(false);
}
}
}
}
});
AnActionButton viewDockerHostsAction = new ToolbarDecorator.ElementActionButton("Details", AllIcons.Actions.Export) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
onViewDockerHostAction();
}
};
AnActionButton refreshDockerHostsAction = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
AppInsightsClient.createByType(AppInsightsClient.EventType.DockerContainer, "", "Refresh", null);
onRefreshDockerHostAction();
}
};
ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(dockerHostsTable).setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
onAddNewDockerHostAction();
}
}).setEditAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton anActionButton) {
onEditDockerHostAction();
}
}).setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
onRemoveDockerHostAction();
}
}).setEditActionUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
return dockerHostsTable.getSelectedRow() != -1;
}
}).setRemoveActionUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
return dockerHostsTable.getSelectedRow() != -1;
}
}).disableUpDownActions().addExtraActions(viewDockerHostsAction, refreshDockerHostsAction);
dockerHostsPanel = tableToolbarDecorator.createPanel();
}
use of com.intellij.ui.table.JBTable in project azure-tools-for-java by Microsoft.
the class SrvPriCreationStatusDialog method createUIComponents.
private void createUIComponents() {
// TODO: place custom component creation code here
statusTable = new JBTable();
statusTable.setRowSelectionAllowed(false);
statusTable.setCellSelectionEnabled(false);
}
use of com.intellij.ui.table.JBTable in project azure-tools-for-java by Microsoft.
the class SubscriptionsDialog method createUIComponents.
private void createUIComponents() {
DefaultTableModel model = new SubscriptionTableModel();
model.addColumn("");
model.addColumn("Subscription name");
model.addColumn("Subscription ID");
table = new JBTable();
table.setModel(model);
TableColumn column = table.getColumnModel().getColumn(0);
column.setMinWidth(23);
column.setMaxWidth(23);
table.setRowSelectionAllowed(false);
table.setCellSelectionEnabled(false);
AnActionButton refreshAction = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
AppInsightsClient.createByType(AppInsightsClient.EventType.Subscription, "", "Refresh", null);
refreshSubscriptions();
}
};
ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(table).disableUpDownActions().addExtraActions(refreshAction);
panelTable = tableToolbarDecorator.createPanel();
}
use of com.intellij.ui.table.JBTable in project intellij-community by JetBrains.
the class EditVariableDialog method createVariablesTable.
private JComponent createVariablesTable() {
final String[] names = { CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined") };
// Create a model of the data.
TableModel dataModel = new VariablesModel(names);
// Create the table
myTable = new JBTable(dataModel);
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.setPreferredScrollableViewportSize(new Dimension(500, myTable.getRowHeight() * 8));
myTable.getColumn(names[0]).setPreferredWidth(120);
myTable.getColumn(names[1]).setPreferredWidth(200);
myTable.getColumn(names[2]).setPreferredWidth(200);
myTable.getColumn(names[3]).setPreferredWidth(100);
if (myVariables.size() > 0) {
myTable.getSelectionModel().setSelectionInterval(0, 0);
}
Predicate<Macro> isAcceptableInContext = macro -> myContextTypes.stream().anyMatch(macro::isAcceptableInContext);
Stream<String> availableMacroNames = Arrays.stream(MacroFactory.getMacros()).filter(isAcceptableInContext).map(Macro::getPresentableName).sorted();
Set<String> uniqueNames = availableMacroNames.collect(Collectors.toCollection(LinkedHashSet::new));
ComboBox comboField = new ComboBox();
uniqueNames.forEach(comboField::addItem);
comboField.setEditable(true);
DefaultCellEditor cellEditor = new DefaultCellEditor(comboField);
cellEditor.setClickCountToStart(1);
myTable.getColumn(names[1]).setCellEditor(cellEditor);
myTable.setRowHeight(comboField.getPreferredSize().height);
JTextField textField = new JTextField();
/*textField.addMouseListener(
new PopupHandler(){
public void invokePopup(Component comp,int x,int y){
showCellPopup((JTextField)comp,x,y);
}
}
);*/
cellEditor = new DefaultCellEditor(textField);
cellEditor.setClickCountToStart(1);
myTable.setDefaultEditor(String.class, cellEditor);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction();
return decorator.createPanel();
}
Aggregations