Search in sources :

Example 1 with ContainerSettingPanel

use of com.microsoft.azure.toolkit.intellij.webapp.docker.ContainerSettingPanel in project azure-tools-for-java by Microsoft.

the class SettingPanel method createUIComponents.

private void createUIComponents() {
    containerSettingPanel = new ContainerSettingPanel(project);
    // create table of Web App on Linux
    final DefaultTableModel tableModel = new DefaultTableModel() {

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    tableModel.addColumn(TABLE_HEAD_WEB_APP_NAME);
    tableModel.addColumn(TABLE_HEAD_RESOURCE_GROUP);
    webAppTable = new JBTable(tableModel);
    webAppTable.getEmptyText().setText(TABLE_LOADING_MESSAGE);
    webAppTable.setRowSelectionAllowed(true);
    webAppTable.setDragEnabled(false);
    webAppTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    webAppTable.getSelectionModel().addListSelectionListener(event -> {
        final int index = webAppTable.getSelectedRow();
        if (cachedWebAppList != null && index >= 0 && index < cachedWebAppList.size()) {
            textSelectedAppName.setText(cachedWebAppList.get(webAppTable.getSelectedRow()).name());
        }
    });
    btnRefresh = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {

        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            btnRefresh.setEnabled(false);
            webAppTable.getEmptyText().setText(TABLE_LOADING_MESSAGE);
            final DefaultTableModel model = (DefaultTableModel) webAppTable.getModel();
            model.getDataVector().clear();
            model.fireTableDataChanged();
            textSelectedAppName.setText("");
            webAppOnLinuxDeployPresenter.onRefreshList();
        }
    };
    final ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(webAppTable).addExtraActions(btnRefresh).setToolbarPosition(ActionToolbarPosition.TOP);
    pnlWebAppOnLinuxTable = tableToolbarDecorator.createPanel();
}
Also used : ContainerSettingPanel(com.microsoft.azure.toolkit.intellij.webapp.docker.ContainerSettingPanel) DefaultTableModel(javax.swing.table.DefaultTableModel) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) JBTable(com.intellij.ui.table.JBTable) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnActionButton(com.intellij.ui.AnActionButton)

Aggregations

AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 AnActionButton (com.intellij.ui.AnActionButton)1 ToolbarDecorator (com.intellij.ui.ToolbarDecorator)1 JBTable (com.intellij.ui.table.JBTable)1 ContainerSettingPanel (com.microsoft.azure.toolkit.intellij.webapp.docker.ContainerSettingPanel)1 DefaultTableModel (javax.swing.table.DefaultTableModel)1