Search in sources :

Example 56 with DefaultTableModel

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

the class WebAppDeployDialog method createUIComponents.

private void createUIComponents() {
    DefaultTableModel tableModel = new DefaultTableModel() {

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    tableModel.addColumn("Name");
    tableModel.addColumn("JDK");
    tableModel.addColumn("Web container");
    tableModel.addColumn("Resource group");
    table = new JBTable(tableModel);
    table.setRowSelectionAllowed(true);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting())
                return;
            //System.out.println("row : " + table.getValueAt(table.getSelectedRow(), 0).toString());
            fillAppServiceDetails();
        }
    });
    AnActionButton refreshAction = new AnActionButton("Refresh", AllIcons.Actions.Refresh) {

        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            refreshAppServices();
        }
    };
    ToolbarDecorator tableToolbarDecorator = ToolbarDecorator.createDecorator(table).setAddAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            createAppService();
        }
    }).setRemoveAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            deleteAppService();
        }
    }).setRemoveActionUpdater(new AnActionButtonUpdater() {

        @Override
        public boolean isEnabled(AnActionEvent e) {
            return table.getSelectedRow() != -1;
        }
    }).disableUpDownActions().addExtraActions(refreshAction);
    panelTable = tableToolbarDecorator.createPanel();
}
Also used : AnActionButtonRunnable(com.intellij.ui.AnActionButtonRunnable) AnActionButtonUpdater(com.intellij.ui.AnActionButtonUpdater) DefaultTableModel(javax.swing.table.DefaultTableModel) ListSelectionEvent(javax.swing.event.ListSelectionEvent) ToolbarDecorator(com.intellij.ui.ToolbarDecorator) JBTable(com.intellij.ui.table.JBTable) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnActionButton(com.intellij.ui.AnActionButton) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 57 with DefaultTableModel

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

the class WebAppDeployDialog method editAppService.

private void editAppService() {
    int selectedRow = table.getSelectedRow();
    if (selectedRow >= 0) {
        DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
        String appServiceName = (String) tableModel.getValueAt(selectedRow, 0);
        WebAppDetails wad = webAppWebAppDetailsMap.get(appServiceName);
        AppServiceChangeSettingsDialog d = AppServiceChangeSettingsDialog.go(wad, project);
        if (d == null) {
            // something went wrong - report an error!
            return;
        }
        WebApp wa = d.getWebApp();
        doFillTable();
        selectTableRowWithWebAppName(wa.name());
    }
//fillAppServiceDetails();
}
Also used : WebAppDetails(com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails) DefaultTableModel(javax.swing.table.DefaultTableModel) WebApp(com.microsoft.azure.management.appservice.WebApp)

Example 58 with DefaultTableModel

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

the class WebAppDeployDialog method fillAppServiceDetails.

private void fillAppServiceDetails() {
    DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
    int selectedRow = table.getSelectedRow();
    if (selectedRow >= 0) {
        String appServiceName = (String) tableModel.getValueAt(selectedRow, 0);
        WebAppDetails wad = webAppWebAppDetailsMap.get(appServiceName);
        SubscriptionDetail sd = wad.subscriptionDetail;
        AppServicePlan asp = wad.appServicePlan;
        StringBuilder sb = new StringBuilder();
        sb.append("<div style=\"margin: 7px 7px 7px 7px;\">");
        sb.append(String.format("App Service Name:&nbsp;<b>%s</b><br/>", appServiceName));
        sb.append(String.format("Subscription Name:&nbsp;<b>%s</b>;&nbsp;ID:&nbsp;<b>%s</b><br/>", sd.getSubscriptionName(), sd.getSubscriptionId()));
        String aspName = asp == null ? "N/A" : asp.name();
        String aspPricingTier = asp == null ? "N/A" : asp.pricingTier().toString();
        sb.append(String.format("App Service Plan Name:&nbsp;<b>%s</b>;&nbsp;Pricing Tier:&nbsp;<b>%s</b><br/>", aspName, aspPricingTier));
        String link = buildSiteLink(wad.webApp, null);
        sb.append(String.format("Link:&nbsp;<a href=\"%s\">%s</a>", link, link));
        sb.append("</div>");
        editorPaneAppServiceDetails.setText(sb.toString());
    }
//        listWebAppDetails.setModel(listModel);
}
Also used : WebAppDetails(com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails) DefaultTableModel(javax.swing.table.DefaultTableModel) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail) AppServicePlan(com.microsoft.azure.management.appservice.AppServicePlan)

Example 59 with DefaultTableModel

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

the class WebAppDeployDialog method doValidate.

@Nullable
@Override
protected ValidationInfo doValidate() {
    int selectedRow = table.getSelectedRow();
    if (selectedRow < 0) {
        return new ValidationInfo("Please select an App Service to deploy to", table);
    }
    DefaultTableModel tableModel = (DefaultTableModel) table.getModel();
    WebAppDetails wad = webAppWebAppDetailsMap.get(tableModel.getValueAt(selectedRow, 0));
    if (wad.webApp.javaVersion() == JavaVersion.OFF) {
        return new ValidationInfo("Please select java based App Service", table);
    }
    return super.doValidate();
}
Also used : WebAppDetails(com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails) ValidationInfo(com.intellij.openapi.ui.ValidationInfo) DefaultTableModel(javax.swing.table.DefaultTableModel) Nullable(org.jetbrains.annotations.Nullable)

Example 60 with DefaultTableModel

use of javax.swing.table.DefaultTableModel in project MassBank-web by MassBank.

the class SearchPage method getSpectrumForQuery.

/**
 * �X�y�N�g���擾
 * DB����X�y�N�g�����擾����
 * @param searchName
 */
private void getSpectrumForQuery(String searchName) {
    String param = "";
    if (!searchName.equals("")) {
        String wc = "&wc=";
        boolean wcStart = false;
        boolean wcEnd = false;
        if (searchName.substring(0, 1).equals("*")) {
            wcStart = true;
        }
        if (searchName.substring(searchName.length() - 1).equals("*")) {
            wcEnd = true;
        }
        if (wcStart) {
            if (wcEnd) {
                wc += "both";
            } else {
                wc += "start";
            }
        } else {
            if (wcEnd) {
                wc += "end";
            } else {
                wc = "";
            }
        }
        searchName = searchName.replace("*", "");
        param = "name=" + searchName + wc;
    }
    // �T�[�u���b�g�Ăяo��-�}���`�X���b�h��CGI���N��
    String cgiType = MassBankCommon.CGI_TBL[MassBankCommon.CGI_TBL_NUM_TYPE][MassBankCommon.CGI_TBL_TYPE_GNAME];
    ArrayList<String> result = mbcommon.execMultiDispatcher(baseUrl, cgiType, param);
    DefaultTableModel dataModel = (DefaultTableModel) querySorter.getTableModel();
    dataModel.setRowCount(0);
    if (result == null || result.size() == 0) {
        return;
    }
    // �\�[�g
    Collections.sort(result);
    nameList.clear();
    for (int i = 0; i < result.size(); i++) {
        String nameId = (String) result.get(i);
        String[] cutNameId = nameId.split("\t");
        String name = cutNameId[0];
        String id = cutNameId[1];
        String site = cutNameId[2];
        String[] cutIdNameSite = new String[] { id, name, site };
        nameList.add(cutIdNameSite);
        site = siteNameList[Integer.parseInt(site)];
        String[] idNameSite2 = new String[] { id, name, site, String.valueOf(i + 1) };
        // �擾�l���e�[�u���ɃZ�b�g
        dataModel.addRow(idNameSite2);
    }
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel) Point(java.awt.Point)

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