Skip to content

Commit eea88a0

Browse files
Merge pull request #5218 from microsoft/track2/asc/4-properties
migrate to track2 based azure-toolkit-springcloud-lib for spring cloud properties
2 parents 2e50c88 + d804252 commit eea88a0

File tree

10 files changed

+940
-1213
lines changed

10 files changed

+940
-1213
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.microsoft.azure.toolkit.intellij.springcloud.properties.AzureSlider">
3+
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
4+
<margin top="0" left="0" bottom="0" right="0"/>
5+
<constraints>
6+
<xy x="20" y="20" width="500" height="51"/>
7+
</constraints>
8+
<properties/>
9+
<border type="none"/>
10+
<children>
11+
<component id="1d144" class="javax.swing.JSlider" binding="numSlider">
12+
<constraints>
13+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
14+
</constraints>
15+
<properties>
16+
<majorTickSpacing value="50"/>
17+
<maximum value="500"/>
18+
<minimum value="0"/>
19+
<minorTickSpacing value="10"/>
20+
<paintLabels value="true"/>
21+
<paintTicks value="true"/>
22+
<paintTrack value="true"/>
23+
<snapToTicks value="false"/>
24+
<value value="50"/>
25+
<valueIsAdjusting value="true"/>
26+
</properties>
27+
</component>
28+
<component id="f2f94" class="com.intellij.ui.JBIntSpinner" binding="numValue" custom-create="true">
29+
<constraints>
30+
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
31+
</constraints>
32+
<properties/>
33+
</component>
34+
</children>
35+
</grid>
36+
</form>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*/
5+
6+
package com.microsoft.azure.toolkit.intellij.springcloud.properties;
7+
8+
import com.intellij.ui.JBIntSpinner;
9+
import lombok.Getter;
10+
import lombok.Setter;
11+
12+
import javax.swing.*;
13+
import javax.swing.event.ChangeListener;
14+
15+
public class AzureSlider {
16+
@Getter
17+
private JPanel contentPanel;
18+
19+
private JSlider numSlider;
20+
private JBIntSpinner numValue;
21+
@Setter
22+
private int realMin = Integer.MIN_VALUE;
23+
24+
public AzureSlider() {
25+
this.init();
26+
}
27+
28+
private void init() {
29+
this.numSlider.addChangeListener(e -> this.setValue(this.numSlider.getValue()));
30+
this.numValue.addChangeListener(e -> this.setValue((Integer) this.numValue.getValue()));
31+
}
32+
33+
public void addChangeListener(ChangeListener l) {
34+
this.numSlider.addChangeListener(l);
35+
}
36+
37+
public void setMaximum(int max) {
38+
this.numSlider.setMaximum(max);
39+
this.numValue.setMax(max);
40+
}
41+
42+
public void setMinimum(int min) {
43+
this.numSlider.setMinimum(min);
44+
this.numValue.setMin(min);
45+
}
46+
47+
public void setMajorTickSpacing(int tick) {
48+
this.numSlider.setMajorTickSpacing(tick);
49+
}
50+
51+
public void setMinorTickSpacing(int tick) {
52+
this.numSlider.setMinorTickSpacing(tick);
53+
}
54+
55+
public void setValue(int value) {
56+
value = Math.max(this.realMin, value);
57+
this.numSlider.setValue(value);
58+
this.numValue.setValue(value);
59+
}
60+
61+
public int getValue() {
62+
return (int) this.numValue.getValue();
63+
}
64+
65+
private void createUIComponents() {
66+
this.numValue = new JBIntSpinner(1, 0, 10);
67+
}
68+
69+
public void setEnabled(boolean isEnabled) {
70+
this.numSlider.setEnabled(isEnabled);
71+
this.numValue.setEnabled(isEnabled);
72+
}
73+
}

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/springcloud/properties/SpringCloudAppInstanceViewModel.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)