@@ -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
0 commit comments