Skip to content

Commit 4d1fcf6

Browse files
Merge pull request #33 from boyusun-SAG/SomeImprovements
Some improvements
2 parents 72f4474 + 2ae64ff commit 4d1fcf6

File tree

7 files changed

+241
-76
lines changed

7 files changed

+241
-76
lines changed

README.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ java -jar tinypounderXXX.jar
1616

1717
If you usually run the TinyPounder with the same kit, you can provide its path at start time :
1818
----
19-
java -jar tinypounderXXX.jar --kit.path=/path/to/unzipped/kit/
19+
java -jar tinypounderXXX.jar --kitPath=/path/to/unzipped/kit/ --licensePath=/path/to/license.xml
20+
----
21+
22+
Disable auto-launch browser (when you already have a tinyPounder window)
23+
----
24+
java -jar tinypounderXXX.jar --autoLaunchBrowser=false
2025
----
2126

2227
Then head to http://localhost:8080

src/main/java/org/terracotta/tinypounder/ApplicationReadyListener.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ public class ApplicationReadyListener implements ApplicationListener<Application
2121

2222
@Value("${server.port}")
2323
private int port;
24+
25+
@Value("${autoLaunchBrowser}")
26+
private Boolean autoLaunch;
2427

2528
@SuppressWarnings("unchecked")
2629
@Override
2730
public void onApplicationEvent(ApplicationReadyEvent event) {
31+
if (!autoLaunch) return;
2832
URI uri = URI.create("http://localhost:" + port);
2933
if (Desktop.isDesktopSupported()) {
3034
Desktop desktop = Desktop.getDesktop();

src/main/java/org/terracotta/tinypounder/DatasetConfiguration.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
package org.terracotta.tinypounder;
22

33
public class DatasetConfiguration {
4+
private final String keyType;
45
private final String offheapResourceName;
56
private final String diskResourceName;
67
private final boolean useIndex;
78

8-
public DatasetConfiguration(String offheapResourceName, String diskResourceName, boolean useIndex) {
9+
public DatasetConfiguration(String keyType, String offheapResourceName, String diskResourceName, boolean useIndex) {
10+
this.keyType = keyType;
911
this.offheapResourceName = offheapResourceName;
1012
this.diskResourceName = diskResourceName;
1113
this.useIndex = useIndex;
1214
}
1315

16+
public String getKeyType() { return keyType; }
17+
1418
public String getOffheapResourceName() {
1519
return offheapResourceName;
1620
}

src/main/java/org/terracotta/tinypounder/DatasetManagerBusinessReflectionImpl.java

Lines changed: 146 additions & 63 deletions
Large diffs are not rendered by default.

src/main/java/org/terracotta/tinypounder/TinyPounderMainUI.java

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,9 +1489,18 @@ private void addDatasetControls() {
14891489
datasetNameField.setPlaceholder("dataset name");
14901490
datasetNameField.addStyleName("align-bottom");
14911491

1492+
List<String> keyTypeValues = Arrays.asList("STRING", "INT", "LONG", "DOUBLE", "BOOL", "CHAR");
1493+
ComboBox<String> keyTypeComboBox = new ComboBox<>("Key type", keyTypeValues);
1494+
keyTypeComboBox.setStyleName("datasetAttribute");
1495+
keyTypeComboBox.setEmptySelectionAllowed(false);
1496+
keyTypeComboBox.setTextInputAllowed(false);
1497+
keyTypeComboBox.setValue(keyTypeValues.get(0));
1498+
1499+
HorizontalLayout offHeapOption = new HorizontalLayout();
1500+
offHeapOption.setStyleName("datasetAttribute");
14921501
TextField offHeapPersistenceLocationField = new TextField();
14931502
CheckBox offHeapCheckBox = new CheckBox("offheap", true);
1494-
offHeapCheckBox.addStyleName("shift-bottom-right-offheap");
1503+
offHeapCheckBox.addStyleName("bottom");
14951504
offHeapCheckBox.addValueChangeListener(valueChangeEvent -> {
14961505
if (valueChangeEvent.getValue()) {
14971506
offHeapPersistenceLocationField.setEnabled(true);
@@ -1501,11 +1510,13 @@ private void addDatasetControls() {
15011510
});
15021511
offHeapPersistenceLocationField.setCaption("offheap resource name");
15031512
offHeapPersistenceLocationField.setValue("offheap-1");
1513+
offHeapOption.addComponents(offHeapCheckBox, offHeapPersistenceLocationField);
15041514

1505-
1515+
HorizontalLayout diskOption = new HorizontalLayout();
1516+
diskOption.setStyleName("datasetAttribute");
15061517
TextField diskPersistenceLocationField = new TextField();
15071518
CheckBox diskCheckBox = new CheckBox("disk", true);
1508-
diskCheckBox.addStyleName("shift-bottom-right-disk");
1519+
diskCheckBox.addStyleName("bottom");
15091520
diskCheckBox.addValueChangeListener(valueChangeEvent -> {
15101521
if (valueChangeEvent.getValue()) {
15111522
diskPersistenceLocationField.setEnabled(true);
@@ -1515,18 +1526,20 @@ private void addDatasetControls() {
15151526
});
15161527
diskPersistenceLocationField.setCaption("disk resource name");
15171528
diskPersistenceLocationField.setValue("dataroot-1");
1529+
diskOption.addComponents(diskCheckBox, diskPersistenceLocationField);
15181530

15191531
CheckBox indexCheckBox = new CheckBox("use index", true);
1520-
indexCheckBox.addStyleName("shift-bottom-right-index");
1532+
indexCheckBox.setStyleName("datasetAttribute");
1533+
indexCheckBox.addStyleName("bottom");
15211534

15221535
Button addDatasetButton = new Button("Add dataset");
1523-
addDatasetButton.addStyleName("align-bottom");
1536+
addDatasetButton.setStyleName("datasetAttribute");
15241537

1525-
datasetCreation.addComponentsAndExpand(datasetNameField, offHeapCheckBox, offHeapPersistenceLocationField, diskCheckBox, diskPersistenceLocationField, indexCheckBox, addDatasetButton);
1538+
datasetCreation.addComponents(datasetNameField, keyTypeComboBox, offHeapOption, diskOption, indexCheckBox, addDatasetButton);
15261539
ListDataProvider<String> listDataProvider = new ListDataProvider<>(datasetNames);
15271540
addDatasetButton.addClickListener(clickEvent -> {
15281541
try {
1529-
DatasetConfiguration datasetConfiguration = new DatasetConfiguration(offHeapCheckBox.getValue() ? offHeapPersistenceLocationField.getValue() : null, diskCheckBox.getValue() ? diskPersistenceLocationField.getValue() : null, indexCheckBox.getValue());
1542+
DatasetConfiguration datasetConfiguration = new DatasetConfiguration(keyTypeComboBox.getValue(), offHeapCheckBox.getValue() ? offHeapPersistenceLocationField.getValue() : null, diskCheckBox.getValue() ? diskPersistenceLocationField.getValue() : null, indexCheckBox.getValue());
15301543
datasetManagerBusiness.createDataset(datasetNameField.getValue(), datasetConfiguration);
15311544
datasetNames.add(datasetNameField.getValue());
15321545
refreshDatasetStuff(listDataProvider);
@@ -1574,10 +1587,40 @@ private void addDatasetControls() {
15741587
if (datasetInstanceNames.size() > 0) {
15751588
destroyDatasetButton.setEnabled(false);
15761589
}
1590+
int count = 0;
15771591
for (String instanceName : datasetInstanceNames) {
15781592
HorizontalLayout datasetInstanceInfoLayout = new HorizontalLayout();
1593+
if ((count++) % 2 == 0) {
1594+
datasetInstanceInfoLayout.setStyleName("greyBackground");
1595+
}
15791596
Label datasetInstanceNameLabel = new Label(instanceName);
1597+
datasetInstanceNameLabel.setStyleName("instance");
1598+
1599+
TextField newCellField = new TextField();
1600+
newCellField.setPlaceholder("myCellName:STRING");
1601+
newCellField.setStyleName("instance");
1602+
Button addCellButton = new Button("Add cell");
1603+
addCellButton.setStyleName("instance");
1604+
addCellButton.addClickListener(event -> {
1605+
try {
1606+
datasetManagerBusiness.addCustomCell(newCellField.getValue());
1607+
displayWarningNotification("New cell is added.");
1608+
} catch (Exception e) {
1609+
displayErrorNotification("New cell cannot be added.", e);
1610+
}
1611+
});
1612+
Button removeCellButton = new Button("Remove cell");
1613+
removeCellButton.setStyleName("instance");
1614+
removeCellButton.addClickListener(event -> {
1615+
try {
1616+
datasetManagerBusiness.removeCustomCell(newCellField.getValue());
1617+
displayWarningNotification("New cell is removed.");
1618+
} catch (Exception e) {
1619+
displayErrorNotification("New cell cannot be removed.", e);
1620+
}
1621+
});
15801622
Button closeDatasetButton = new Button("Close dataset instance");
1623+
closeDatasetButton.setStyleName("instance");
15811624
closeDatasetButton.addClickListener(event -> {
15821625
try {
15831626
datasetManagerBusiness.closeDatasetInstance(datasetName, instanceName);
@@ -1605,7 +1648,7 @@ private void addDatasetControls() {
16051648
});
16061649

16071650

1608-
datasetInstanceInfoLayout.addComponentsAndExpand(datasetInstanceNameLabel, poundingSlider, closeDatasetButton);
1651+
datasetInstanceInfoLayout.addComponentsAndExpand(datasetInstanceNameLabel, newCellField, addCellButton, removeCellButton, poundingSlider, closeDatasetButton);
16091652
datasetListLayout.addComponent(datasetInstanceInfoLayout);
16101653
}
16111654

src/main/resources/VAADIN/themes/tinypounder/styles.scss

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,42 @@ $v-layout-margin-bottom: 16px;
5757

5858
.v-slot-shift-bottom-right-offheap {
5959
top: 28px;
60-
left: 8%;
60+
left: 5em;
6161
}
6262

6363
.v-slot-shift-bottom-right-disk {
6464
top: 28px;
65-
left: 10%;
65+
left: 5em;
6666
}
6767

6868
.v-slot-shift-bottom-right-index {
6969
top: 28px;
70-
left: 6%;
70+
left: 2em;
71+
}
72+
73+
.v-slot-datasetAttribute {
74+
margin-left: 3em;
75+
}
76+
77+
.v-checkbox-bottom {
78+
top: 2em;
79+
}
80+
81+
.v-button-datasetAttribute {
82+
top: 1em;
83+
}
84+
85+
.v-label-instance {
86+
margin-top: .5em;
87+
margin-left: 1em;
88+
}
89+
90+
.v-slot-greyBackground {
91+
background-color: #EAEAEA;
92+
}
93+
94+
.v-slot-instance {
95+
top: .7em;
7196
}
7297

7398
.tc-config-xml {

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ reconnectWindow=0
1010
spring.devtools.livereload.enabled=false
1111
spring.devtools.restart.enabled=false
1212
server.port=9490
13+
autoLaunchBrowser=true

0 commit comments

Comments
 (0)