@@ -1489,9 +1489,18 @@ private void addDatasetControls() {
1489
1489
datasetNameField .setPlaceholder ("dataset name" );
1490
1490
datasetNameField .addStyleName ("align-bottom" );
1491
1491
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" );
1492
1501
TextField offHeapPersistenceLocationField = new TextField ();
1493
1502
CheckBox offHeapCheckBox = new CheckBox ("offheap" , true );
1494
- offHeapCheckBox .addStyleName ("shift- bottom-right-offheap " );
1503
+ offHeapCheckBox .addStyleName ("bottom" );
1495
1504
offHeapCheckBox .addValueChangeListener (valueChangeEvent -> {
1496
1505
if (valueChangeEvent .getValue ()) {
1497
1506
offHeapPersistenceLocationField .setEnabled (true );
@@ -1501,11 +1510,13 @@ private void addDatasetControls() {
1501
1510
});
1502
1511
offHeapPersistenceLocationField .setCaption ("offheap resource name" );
1503
1512
offHeapPersistenceLocationField .setValue ("offheap-1" );
1513
+ offHeapOption .addComponents (offHeapCheckBox , offHeapPersistenceLocationField );
1504
1514
1505
-
1515
+ HorizontalLayout diskOption = new HorizontalLayout ();
1516
+ diskOption .setStyleName ("datasetAttribute" );
1506
1517
TextField diskPersistenceLocationField = new TextField ();
1507
1518
CheckBox diskCheckBox = new CheckBox ("disk" , true );
1508
- diskCheckBox .addStyleName ("shift- bottom-right-disk " );
1519
+ diskCheckBox .addStyleName ("bottom" );
1509
1520
diskCheckBox .addValueChangeListener (valueChangeEvent -> {
1510
1521
if (valueChangeEvent .getValue ()) {
1511
1522
diskPersistenceLocationField .setEnabled (true );
@@ -1515,18 +1526,20 @@ private void addDatasetControls() {
1515
1526
});
1516
1527
diskPersistenceLocationField .setCaption ("disk resource name" );
1517
1528
diskPersistenceLocationField .setValue ("dataroot-1" );
1529
+ diskOption .addComponents (diskCheckBox , diskPersistenceLocationField );
1518
1530
1519
1531
CheckBox indexCheckBox = new CheckBox ("use index" , true );
1520
- indexCheckBox .addStyleName ("shift-bottom-right-index" );
1532
+ indexCheckBox .setStyleName ("datasetAttribute" );
1533
+ indexCheckBox .addStyleName ("bottom" );
1521
1534
1522
1535
Button addDatasetButton = new Button ("Add dataset" );
1523
- addDatasetButton .addStyleName ( "align-bottom " );
1536
+ addDatasetButton .setStyleName ( "datasetAttribute " );
1524
1537
1525
- datasetCreation .addComponentsAndExpand (datasetNameField , offHeapCheckBox , offHeapPersistenceLocationField , diskCheckBox , diskPersistenceLocationField , indexCheckBox , addDatasetButton );
1538
+ datasetCreation .addComponents (datasetNameField , keyTypeComboBox , offHeapOption , diskOption , indexCheckBox , addDatasetButton );
1526
1539
ListDataProvider <String > listDataProvider = new ListDataProvider <>(datasetNames );
1527
1540
addDatasetButton .addClickListener (clickEvent -> {
1528
1541
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 ());
1530
1543
datasetManagerBusiness .createDataset (datasetNameField .getValue (), datasetConfiguration );
1531
1544
datasetNames .add (datasetNameField .getValue ());
1532
1545
refreshDatasetStuff (listDataProvider );
@@ -1574,10 +1587,40 @@ private void addDatasetControls() {
1574
1587
if (datasetInstanceNames .size () > 0 ) {
1575
1588
destroyDatasetButton .setEnabled (false );
1576
1589
}
1590
+ int count = 0 ;
1577
1591
for (String instanceName : datasetInstanceNames ) {
1578
1592
HorizontalLayout datasetInstanceInfoLayout = new HorizontalLayout ();
1593
+ if ((count ++) % 2 == 0 ) {
1594
+ datasetInstanceInfoLayout .setStyleName ("greyBackground" );
1595
+ }
1579
1596
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
+ });
1580
1622
Button closeDatasetButton = new Button ("Close dataset instance" );
1623
+ closeDatasetButton .setStyleName ("instance" );
1581
1624
closeDatasetButton .addClickListener (event -> {
1582
1625
try {
1583
1626
datasetManagerBusiness .closeDatasetInstance (datasetName , instanceName );
@@ -1605,7 +1648,7 @@ private void addDatasetControls() {
1605
1648
});
1606
1649
1607
1650
1608
- datasetInstanceInfoLayout .addComponentsAndExpand (datasetInstanceNameLabel , poundingSlider , closeDatasetButton );
1651
+ datasetInstanceInfoLayout .addComponentsAndExpand (datasetInstanceNameLabel , newCellField , addCellButton , removeCellButton , poundingSlider , closeDatasetButton );
1609
1652
datasetListLayout .addComponent (datasetInstanceInfoLayout );
1610
1653
}
1611
1654
0 commit comments