use of com.microsoft.tooling.msservices.model.ReplicationTypes in project azure-tools-for-java by Microsoft.
the class CreateArmStorageAccountForm method fillFields.
public void fillFields(final SubscriptionDetail subscription, Location region) {
if (subscription == null) {
// loadRegions();
accoountKindCombo.setModel(new DefaultComboBoxModel(Kind.values()));
accoountKindCombo.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
fillPerformanceComboBox();
fillReplicationTypes();
boolean isBlobKind = e.getItem().equals(Kind.BLOB_STORAGE);
accessTeirComboBox.setVisible(isBlobKind);
accessTierLabel.setVisible(isBlobKind);
}
}
});
accessTeirComboBox.setModel(new DefaultComboBoxModel(AccessTier.values()));
subscriptionComboBox.setEnabled(true);
try {
AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
// not signed in
if (azureManager == null) {
return;
}
SubscriptionManager subscriptionManager = azureManager.getSubscriptionManager();
List<SubscriptionDetail> subscriptionDetails = subscriptionManager.getSubscriptionDetails();
List<SubscriptionDetail> selectedSubscriptions = subscriptionDetails.stream().filter(SubscriptionDetail::isSelected).collect(Collectors.toList());
subscriptionComboBox.setModel(new DefaultComboBoxModel<>(selectedSubscriptions.toArray(new SubscriptionDetail[selectedSubscriptions.size()])));
if (selectedSubscriptions.size() > 0) {
loadRegions();
}
} catch (Exception ex) {
DefaultLoader.getUIHelper().logError("An error occurred when trying to load Subscriptions\n\n" + ex.getMessage(), ex);
}
subscriptionComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent itemEvent) {
loadRegions();
}
});
} else {
// if you create SA while creating VM
this.subscription = subscription;
subscriptionComboBox.addItem(subscription);
// only General purpose accounts supported for VMs
accoountKindCombo.addItem(Kind.STORAGE);
accoountKindCombo.setEnabled(false);
// Access tier is not available for General purpose accounts
accessTeirComboBox.setVisible(false);
accessTierLabel.setVisible(false);
regionComboBox.addItem(region);
regionComboBox.setEnabled(false);
loadGroups();
}
//performanceComboBox.setModel(new DefaultComboBoxModel(SkuTier.values()));
fillPerformanceComboBox();
performanceComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
fillReplicationTypes();
}
}
});
replicationComboBox.setRenderer(new ListCellRendererWrapper<ReplicationTypes>() {
@Override
public void customize(JList jList, ReplicationTypes replicationTypes, int i, boolean b, boolean b1) {
if (replicationTypes != null) {
setText(replicationTypes.getDescription());
}
}
});
fillReplicationTypes();
}
Aggregations