use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.
the class SqlServerPropertyView method showProperty.
// @Override
public void showProperty(SqlServerProperty property) {
SqlServerEntity entity = property.getServer().entity();
Subscription subscription = Azure.az(AzureAccount.class).account().getSubscription(entity.getSubscriptionId());
if (subscription != null) {
overview.getSubscriptionTextField().setText(subscription.getName());
}
databaseComboBox.setServer(property.getServer());
overview.getResourceGroupTextField().setText(entity.getResourceGroupName());
overview.getStatusTextField().setText(entity.getState());
overview.getLocationTextField().setText(entity.getRegion().getLabel());
overview.getSubscriptionIDTextField().setText(entity.getSubscriptionId());
overview.getServerNameTextField().setText(entity.getFullyQualifiedDomainName());
overview.getServerNameTextField().setCaretPosition(0);
overview.getServerAdminLoginNameTextField().setText(entity.getAdministratorLoginName() + "@" + entity.getName());
overview.getServerAdminLoginNameTextField().setCaretPosition(0);
overview.getVersionTextField().setText(entity.getVersion());
if ("Ready".equals(entity.getState())) {
List<FirewallRuleEntity> firewallRules = property.getFirewallRules();
originalAllowAccessToAzureServices = firewallRules.stream().anyMatch(e -> FirewallRuleEntity.ACCESS_FROM_AZURE_SERVICES_FIREWALL_RULE_NAME.equalsIgnoreCase(e.getName()));
connectionSecurity.getAllowAccessFromAzureServicesCheckBox().setSelected(originalAllowAccessToAzureServices);
originalAllowAccessToLocal = firewallRules.stream().anyMatch(e -> StringUtils.equalsIgnoreCase(FirewallRuleEntity.getAccessFromLocalFirewallRuleName(), e.getName()));
connectionSecurity.getAllowAccessFromLocalMachineCheckBox().setSelected(originalAllowAccessToLocal);
} else {
connectionSecuritySeparator.collapse();
connectionSecuritySeparator.setEnabled(false);
connectionStringsSeparator.collapse();
connectionStringsSeparator.setEnabled(false);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.
the class SqlServerCreationAdvancedPanel method onSubscriptionChanged.
private void onSubscriptionChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof Subscription) {
final Subscription subscription = (Subscription) e.getItem();
this.resourceGroupComboBox.setSubscription(subscription);
this.serverNameTextField.setSubscriptionId(subscription.getId());
this.regionComboBox.setSubscription(subscription);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.
the class SqlServerCreationDialog method createUIComponents.
private void createUIComponents() {
List<Subscription> selectedSubscriptions = Azure.az(AzureAccount.class).account().getSelectedSubscriptions();
Preconditions.checkArgument(CollectionUtils.isNotEmpty(selectedSubscriptions), "There is no subscription in your account.");
SqlServerConfig config = SqlServerConfig.getDefaultConfig(selectedSubscriptions.get(0));
basic = new SqlServerCreationBasicPanel(config);
advanced = new SqlServerCreationAdvancedPanel(config);
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method initWidgetListeners.
private void initWidgetListeners() {
txtRedisName.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent documentEvent) {
validateEmptyFields();
}
@Override
public void removeUpdate(DocumentEvent documentEvent) {
validateEmptyFields();
}
@Override
public void changedUpdate(DocumentEvent documentEvent) {
validateEmptyFields();
}
});
cbSubs.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
currentSub = (Subscription) cbSubs.getSelectedItem();
cbLocations.setSubscription(currentSub);
fillResourceGrps(currentSub);
validateEmptyFields();
}
});
rdoCreateNewGrp.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
txtNewResGrp.setVisible(true);
cbUseExist.setVisible(false);
newResGrp = true;
validateEmptyFields();
}
});
txtNewResGrp.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent documentEvent) {
validateEmptyFields();
}
@Override
public void removeUpdate(DocumentEvent documentEvent) {
validateEmptyFields();
}
@Override
public void changedUpdate(DocumentEvent documentEvent) {
validateEmptyFields();
}
});
rdoUseExist.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
txtNewResGrp.setVisible(false);
cbUseExist.setVisible(true);
newResGrp = false;
validateEmptyFields();
}
});
cbUseExist.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateEmptyFields();
}
});
cbLocations.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateEmptyFields();
}
});
lblPricing.addMouseListener(new LinkListener(PRICING_LINK));
cbPricing.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
validateEmptyFields();
}
});
chkNoSSL.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (chkNoSSL.isSelected()) {
noSSLPort = true;
} else {
noSSLPort = false;
}
}
});
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by Microsoft.
the class RedisCreationDialog method onSubscriptionChanged.
private void onSubscriptionChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final Subscription subscription = (Subscription) e.getItem();
this.resourceGroupComboBox.setSubscription(subscription);
this.regionComboBox.setSubscription(subscription);
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
this.resourceGroupComboBox.setSubscription(null);
this.regionComboBox.setSubscription(null);
}
}
Aggregations