Search in sources :

Example 21 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project nhin-d by DirectProject.

the class PKCS11SecretKeyManager method initUI.

private void initUI() {
    this.getContentPane().setLayout(new BorderLayout(5, 5));
    // Top Panel
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAESKeyButton = new JButton("Add AES Key");
    addAESKeyButton.setSize(new Dimension(30, 100));
    addGenericKeyButton = new JButton("Add Text Key");
    addGenericKeyButton.setSize(new Dimension(30, 100));
    removeKeyButton = new JButton("Remove Key(s)");
    removeKeyButton.setSize(new Dimension(30, 100));
    topPanel.add(addAESKeyButton);
    topPanel.add(addGenericKeyButton);
    topPanel.add(removeKeyButton);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    // Middle and list panel
    JPanel midPanel = new JPanel();
    midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    midPanel.setLayout(new BorderLayout(5, 5));
    JLabel keyListLabel = new JLabel("Secret Keys:");
    Object[][] data = {};
    String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
    keyDataModel = new DefaultTableModel(data, columnNames);
    keyDataTable = new JTable(keyDataModel);
    JScrollPane scrollPane = new JScrollPane(keyDataTable);
    keyDataTable.setFillsViewportHeight(true);
    midPanel.add(keyListLabel, BorderLayout.NORTH);
    midPanel.add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(midPanel, BorderLayout.CENTER);
    // Bottom Panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    quitButton = new JButton("Quit");
    quitButton.setSize(new Dimension(30, 100));
    bottomPanel.add(quitButton);
    this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 22 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project nhin-d by DirectProject.

the class PKCS11SecretKeyManagerUI method initUI.

private void initUI() {
    this.getContentPane().setLayout(new BorderLayout(5, 5));
    // Top Panel
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    addAESKeyButton = new JButton("Add AES Key");
    addAESKeyButton.setSize(new Dimension(30, 100));
    addGenericKeyButton = new JButton("Add Text Key");
    addGenericKeyButton.setSize(new Dimension(30, 100));
    removeKeyButton = new JButton("Remove Key(s)");
    removeKeyButton.setSize(new Dimension(30, 100));
    topPanel.add(addAESKeyButton);
    topPanel.add(addGenericKeyButton);
    topPanel.add(removeKeyButton);
    this.getContentPane().add(topPanel, BorderLayout.NORTH);
    // Middle and list panel
    JPanel midPanel = new JPanel();
    midPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    midPanel.setLayout(new BorderLayout(5, 5));
    JLabel keyListLabel = new JLabel("Secret Keys:");
    Object[][] data = {};
    String[] columnNames = { "Key Alias", "Key Type", "Key Value" };
    keyDataModel = new DefaultTableModel(data, columnNames);
    keyDataTable = new JTable(keyDataModel);
    JScrollPane scrollPane = new JScrollPane(keyDataTable);
    keyDataTable.setFillsViewportHeight(true);
    midPanel.add(keyListLabel, BorderLayout.NORTH);
    midPanel.add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(midPanel, BorderLayout.CENTER);
    // Bottom Panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    quitButton = new JButton("Quit");
    quitButton.setSize(new Dimension(30, 100));
    bottomPanel.add(quitButton);
    this.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) DefaultTableModel(javax.swing.table.DefaultTableModel) JTable(javax.swing.JTable) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 23 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project azure-tools-for-java by Microsoft.

the class AzureSelectDockerHostStep method onRemoveDockerHostAction.

private void onRemoveDockerHostAction() {
    DefaultTableModel tableModel = (DefaultTableModel) dockerHostsTable.getModel();
    String apiURL = (String) tableModel.getValueAt(dockerHostsTable.getSelectedRow(), 4);
    DockerHost deleteHost = dockerManager.getDockerHostForURL(apiURL);
    Azure azureClient = dockerManager.getSubscriptionsMap().get(deleteHost.sid).azureClient;
    int option = AzureDockerUIResources.deleteAzureDockerHostConfirmationDialog(azureClient, deleteHost);
    if (option != 1 && option != 2) {
        if (AzureDockerUtils.DEBUG)
            System.out.format("User canceled delete Docker host op: %d\n", option);
        return;
    }
    AppInsightsClient.createByType(AppInsightsClient.EventType.DockerHost, deleteHost.name, "Remove");
    int currentRow = dockerHostsTable.getSelectedRow();
    tableModel.removeRow(currentRow);
    tableModel.fireTableDataChanged();
    if (dockerHostsTableSelection.row == currentRow) {
        dockerHostsTableSelection = null;
    }
    AzureDockerUIResources.deleteDockerHost(model.getProject(), azureClient, deleteHost, option, new Runnable() {

        @Override
        public void run() {
            dockerManager.refreshDockerHostDetails();
            ApplicationManager.getApplication().invokeLater(new Runnable() {

                @Override
                public void run() {
                    refreshDockerHostsTable();
                }
            });
        }
    });
    setFinishButtonState(doValidate(false) == null);
    setNextButtonState(doValidate(false) == null);
}
Also used : Azure(com.microsoft.azure.management.Azure) DefaultTableModel(javax.swing.table.DefaultTableModel) DockerHost(com.microsoft.azure.docker.model.DockerHost) EditableDockerHost(com.microsoft.azure.docker.model.EditableDockerHost)

Example 24 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project azure-tools-for-java by Microsoft.

the class AzureSelectDockerHostStep method onAddNewDockerHostAction.

private void onAddNewDockerHostAction() {
    AppInsightsClient.createByType(AppInsightsClient.EventType.DockerHost, "", "Add");
    AzureNewDockerWizardModel newDockerHostModel = new AzureNewDockerWizardModel(model.getProject(), dockerManager);
    AzureNewDockerWizardDialog wizard = new AzureNewDockerWizardDialog(newDockerHostModel);
    wizard.setTitle("Create Docker Host");
    wizard.show();
    if (wizard.getExitCode() == 0) {
        dockerHostsTable.setEnabled(false);
        DockerHost host = newDockerHostModel.getDockerHost();
        dockerImageDescription.host = host;
        dockerImageDescription.hasNewDockerHost = true;
        dockerImageDescription.sid = host.sid;
        model.setSubscription(this.dockerManager.getSubscriptionsMap().get(host.sid));
        AzureDockerPreferredSettings dockerPrefferedSettings = dockerManager.getDockerPreferredSettings();
        if (dockerPrefferedSettings == null) {
            dockerPrefferedSettings = new AzureDockerPreferredSettings();
        }
        dockerPrefferedSettings.region = host.hostVM.region;
        dockerPrefferedSettings.vmSize = host.hostVM.vmSize;
        dockerPrefferedSettings.vmOS = host.hostOSType.name();
        dockerManager.setDockerPreferredSettings(dockerPrefferedSettings);
        final DefaultTableModel tableModel = (DefaultTableModel) dockerHostsTable.getModel();
        if (dockerHostsTableSelection != null && (Boolean) tableModel.getValueAt(dockerHostsTableSelection.row, 0)) {
            tableModel.setValueAt(false, dockerHostsTableSelection.row, 0);
        }
        Vector<Object> row = new Vector<>();
        row.add(false);
        row.add(host.name);
        row.add("TO_BE_CREATED");
        row.add(host.hostOSType.toString());
        row.add(host.apiUrl);
        tableModel.insertRow(0, row);
        tableModel.setValueAt(true, 0, 0);
        dockerHostsTable.setRowSelectionInterval(0, 0);
        setFinishButtonState(doValidate(false) == null);
        setNextButtonState(doValidate(false) == null);
    }
}
Also used : AzureNewDockerWizardDialog(com.microsoft.intellij.docker.wizards.createhost.AzureNewDockerWizardDialog) DockerHost(com.microsoft.azure.docker.model.DockerHost) EditableDockerHost(com.microsoft.azure.docker.model.EditableDockerHost) DefaultTableModel(javax.swing.table.DefaultTableModel) AzureNewDockerWizardModel(com.microsoft.intellij.docker.wizards.createhost.AzureNewDockerWizardModel) Vector(java.util.Vector) AzureDockerPreferredSettings(com.microsoft.azure.docker.model.AzureDockerPreferredSettings)

Example 25 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project azure-tools-for-java by Microsoft.

the class TablesQueryDesigner method addClause.

private void addClause() {
    DefaultTableModel model = (DefaultTableModel) queryTable.getModel();
    model.addRow(new Object[] { "", LogicalOperator.And, QueryField.PartitionKey, Operator.EqualsTo, "" });
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel)

Aggregations

DefaultTableModel (javax.swing.table.DefaultTableModel)139 JTable (javax.swing.JTable)18 Dimension (java.awt.Dimension)14 Vector (java.util.Vector)14 JScrollPane (javax.swing.JScrollPane)14 TableColumn (javax.swing.table.TableColumn)12 JBTable (com.intellij.ui.table.JBTable)10 Point (java.awt.Point)10 ActionEvent (java.awt.event.ActionEvent)9 JPanel (javax.swing.JPanel)9 ListSelectionEvent (javax.swing.event.ListSelectionEvent)9 ListSelectionListener (javax.swing.event.ListSelectionListener)9 JButton (javax.swing.JButton)8 ActionListener (java.awt.event.ActionListener)7 WebAppDetails (com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails)6 Color (java.awt.Color)6 ArrayList (java.util.ArrayList)6 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)5 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5