use of javax.swing.table.DefaultTableModel in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method cleanTable.
private void cleanTable() {
DefaultTableModel dm = (DefaultTableModel) table.getModel();
dm.getDataVector().removeAllElements();
webAppWebAppDetailsMap.clear();
dm.fireTableDataChanged();
}
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();
}
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();
}
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: <b>%s</b><br/>", appServiceName));
sb.append(String.format("Subscription Name: <b>%s</b>; ID: <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: <b>%s</b>; Pricing Tier: <b>%s</b><br/>", aspName, aspPricingTier));
String link = buildSiteLink(wad.webApp, null);
sb.append(String.format("Link: <a href=\"%s\">%s</a>", link, link));
sb.append("</div>");
editorPaneAppServiceDetails.setText(sb.toString());
}
// listWebAppDetails.setModel(listModel);
}
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();
}
Aggregations