3535import com .microsoft .azure .toolkit .lib .springcloud .SpringCloudApp ;
3636import com .microsoft .azure .toolkit .lib .springcloud .config .SpringCloudAppConfig ;
3737import com .microsoft .azure .toolkit .lib .springcloud .config .SpringCloudDeploymentConfig ;
38+ import org .eclipse .swt .events .DisposeListener ;
39+ import org .eclipse .swt .events .DisposeEvent ;
3840
3941public class SpringCloudAppConfigPanel extends Composite implements AzureFormPanel <SpringCloudAppConfig > {
4042 private Button useJava8 ;
4143 private Button useJava11 ;
44+ private Button useJava17 ;
4245 private AzureTextInput txtJvmOptions ;
4346 private AzureTextInput envTable ;
4447 private Spinner numCpu ;
@@ -50,6 +53,8 @@ public class SpringCloudAppConfigPanel extends Composite implements AzureFormPan
5053 private SpringCloudAppConfig originalConfig ;
5154 private Button toggleEndpoint ;
5255 private Button toggleStorage ;
56+ private Label lblRuntime ;
57+ private Label lblDisk ;
5358
5459 public SpringCloudAppConfigPanel (Composite parent ) {
5560 super (parent , SWT .NONE );
@@ -70,6 +75,7 @@ private void init() {
7075
7176 this .useJava8 .addListener (SWT .Selection , (e ) -> debouncer .debounce ());
7277 this .useJava11 .addListener (SWT .Selection , (e ) -> debouncer .debounce ());
78+ this .useJava17 .addListener (SWT .Selection , (e ) -> debouncer .debounce ());
7379 this .txtJvmOptions .addModifyListener (e -> debouncer .debounce ());
7480 this .envTable .addModifyListener (e -> debouncer .debounce ());
7581 this .numCpu .addModifyListener (e -> debouncer .debounce ());
@@ -95,6 +101,13 @@ private void onDataChanged() {
95101
96102 public synchronized void updateForm (@ Nonnull SpringCloudApp app ) {
97103 final String sku = app .getParent ().getSku ();
104+ final boolean enterprise = sku .toLowerCase ().startsWith ("e" );
105+ this .useJava8 .setVisible (!enterprise );
106+ this .useJava11 .setVisible (!enterprise );
107+ this .useJava17 .setVisible (!enterprise );
108+ this .lblRuntime .setVisible (!enterprise );
109+ this .lblDisk .setVisible (!enterprise );
110+ this .toggleStorage .setVisible (!enterprise );
98111 final boolean basic = sku .toLowerCase ().startsWith ("b" );
99112 final int cpu = this .numCpu .getSelection ();
100113 final int mem = this .numMemory .getSelection ();
@@ -115,11 +128,17 @@ public synchronized void updateForm(@Nonnull SpringCloudApp app) {
115128
116129 public SpringCloudAppConfig getValue (@ Nonnull SpringCloudAppConfig appConfig ) { // get config from form
117130 final SpringCloudDeploymentConfig deploymentConfig = appConfig .getDeployment ();
118- final String javaVersion = this .useJava11 .getSelection () ? RuntimeVersion .JAVA_11 .toString ()
119- : RuntimeVersion .JAVA_8 .toString ();
131+ final boolean isEnterpriseTier = this .useJava17 .isVisible ();
132+ if (isEnterpriseTier ) {
133+ final String javaVersion = this .useJava17 .getSelection () ? RuntimeVersion .JAVA_17 .toString () :
134+ this .useJava11 .getSelection () ? RuntimeVersion .JAVA_11 .toString () : RuntimeVersion .JAVA_8 .toString ();
135+ deploymentConfig .setRuntimeVersion (javaVersion );
136+ deploymentConfig .setEnablePersistentStorage (this .toggleStorage .getSelection ());
137+ } else {
138+ deploymentConfig .setRuntimeVersion (null );
139+ deploymentConfig .setEnablePersistentStorage (false );
140+ }
120141 appConfig .setIsPublic (this .toggleEndpoint .getSelection ());
121- deploymentConfig .setRuntimeVersion (javaVersion );
122- deploymentConfig .setEnablePersistentStorage (this .toggleStorage .getSelection ());
123142 deploymentConfig .setCpu (numCpu .getSelection () * 1.0 );
124143 deploymentConfig .setMemoryInGB (numMemory .getSelection () * 1.0 );
125144 deploymentConfig .setInstanceCount (numInstance .getValue ());
@@ -140,10 +159,9 @@ public synchronized void setValue(SpringCloudAppConfig config) {
140159 final SpringCloudDeploymentConfig deployment = config .getDeployment ();
141160 this .toggle (this .toggleEndpoint , config .getIsPublic ());
142161 this .toggle (this .toggleStorage , deployment .getEnablePersistentStorage ());
143- final boolean java11 = StringUtils .equalsIgnoreCase (deployment .getRuntimeVersion (),
144- RuntimeVersion .JAVA_11 .toString ());
145- this .useJava11 .setSelection (java11 );
146- this .useJava8 .setSelection (!java11 );
162+ this .useJava17 .setSelection (StringUtils .equalsIgnoreCase (deployment .getRuntimeVersion (), RuntimeVersion .JAVA_17 .toString ()));
163+ this .useJava11 .setSelection (StringUtils .equalsIgnoreCase (deployment .getRuntimeVersion (), RuntimeVersion .JAVA_11 .toString ()));
164+ this .useJava8 .setSelection (StringUtils .equalsIgnoreCase (deployment .getRuntimeVersion (), RuntimeVersion .JAVA_8 .toString ()));
147165
148166 this .txtJvmOptions .setText (deployment .getJvmOptions ());
149167 final Map <String , String > env = deployment .getEnvironment ();
@@ -168,6 +186,7 @@ public SpringCloudAppConfig getValue() {
168186 public void setEnabled (boolean enable ) {
169187 this .useJava8 .setEnabled (enable );
170188 this .useJava11 .setEnabled (enable );
189+ this .useJava17 .setEnabled (enable );
171190 this .toggleEndpoint .setEnabled (enable );
172191 this .toggleStorage .setEnabled (enable );
173192 numCpu .setEnabled (enable );
@@ -188,27 +207,29 @@ private void setupUI() {
188207 Group grpConfiguration = new Group (this , SWT .NONE );
189208 grpConfiguration .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false , 1 , 1 ));
190209 grpConfiguration .setText ("Configuration" );
191- grpConfiguration .setLayout (new GridLayout (3 , false ));
210+ grpConfiguration .setLayout (new GridLayout (4 , false ));
192211
193212 Label lblNewLabel = new Label (grpConfiguration , SWT .NONE );
194213 lblNewLabel .setText ("Public endpoint:" );
195214
196215 this .toggleEndpoint = new Button (grpConfiguration , SWT .CHECK );
197216 toggleEndpoint .setText ("Disabled" );
198217 new Label (grpConfiguration , SWT .NONE );
218+ new Label (grpConfiguration , SWT .NONE );
199219
200- Label lblPersistentStorage = new Label (grpConfiguration , SWT .NONE );
201- GridData gd_lblPersistentStorage = new GridData (SWT .LEFT , SWT .CENTER , false , false , 1 , 1 );
202- gd_lblPersistentStorage .widthHint = 100 ;
203- lblPersistentStorage . setLayoutData (gd_lblPersistentStorage );
204- lblPersistentStorage . setText ("Persistent storage :" );
220+ this . lblDisk = new Label (grpConfiguration , SWT .NONE );
221+ GridData gd_lblDisk = new GridData (SWT .LEFT , SWT .CENTER , false , false , 1 , 1 );
222+ gd_lblDisk .widthHint = 100 ;
223+ this . lblDisk . setLayoutData (gd_lblDisk );
224+ this . lblDisk . setText ("Storage :" );
205225
206226 this .toggleStorage = new Button (grpConfiguration , SWT .CHECK );
207227 this .toggleStorage .setText ("Disabled" );
208228 new Label (grpConfiguration , SWT .NONE );
229+ new Label (grpConfiguration , SWT .NONE );
209230
210- Label lblRuntime = new Label (grpConfiguration , SWT .NONE );
211- lblRuntime .setText ("Runtime:" );
231+ this . lblRuntime = new Label (grpConfiguration , SWT .NONE );
232+ this . lblRuntime .setText ("Runtime:" );
212233
213234 this .useJava8 = new Button (grpConfiguration , SWT .RADIO );
214235 this .useJava8 .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false , 1 , 1 ));
@@ -218,20 +239,24 @@ private void setupUI() {
218239 this .useJava11 = new Button (grpConfiguration , SWT .RADIO );
219240 this .useJava11 .setLayoutData (new GridData (SWT .LEFT , SWT .CENTER , true , false , 1 , 1 ));
220241 this .useJava11 .setText ("Java 11" );
221-
222- Label lblJvmOptions = new Label (grpConfiguration , SWT .NONE );
223- lblJvmOptions .setText ("JVM options:" );
224-
225- this .txtJvmOptions = new AzureTextInput (grpConfiguration , SWT .BORDER );
226- this .txtJvmOptions .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false , 2 , 1 ));
227- this .txtJvmOptions .setLabeledBy (lblJvmOptions );
228-
229- Label lblEnvVariable = new Label (grpConfiguration , SWT .NONE );
230- lblEnvVariable .setText ("Env variables:" );
231-
232- this .envTable = new AzureTextInput (grpConfiguration , SWT .BORDER );
233- this .envTable .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false , 2 , 1 ));
234- this .envTable .setLabeledBy (lblEnvVariable );
242+
243+ this .useJava17 = new Button (grpConfiguration , SWT .RADIO );
244+ this .useJava17 .setLayoutData (new GridData (SWT .LEFT , SWT .CENTER , true , false , 1 , 1 ));
245+ this .useJava17 .setText ("Java 17" );
246+
247+ Label lblJvmOptions = new Label (grpConfiguration , SWT .NONE );
248+ lblJvmOptions .setText ("JVM options:" );
249+ this .txtJvmOptions .setLabeledBy (lblJvmOptions );
250+
251+ this .txtJvmOptions = new AzureTextInput (grpConfiguration , SWT .BORDER );
252+ this .txtJvmOptions .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false , 3 , 1 ));
253+
254+ Label lblEnvVariable = new Label (grpConfiguration , SWT .NONE );
255+ lblEnvVariable .setText ("Env variables:" );
256+ this .envTable .setLabeledBy (lblEnvVariable );
257+
258+ this .envTable = new AzureTextInput (grpConfiguration , SWT .BORDER );
259+ this .envTable .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , false , false , 3 , 1 ));
235260
236261 Group grpScalingUpout = new Group (this , SWT .NONE );
237262 grpScalingUpout .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false , 1 , 1 ));
0 commit comments