visibilityCSSAdapter ClassCastException
Vaadin Version: 8.1.3
I'm currently getting the following exception:
java.lang.ClassCastException: cannot assign instance of java.lang.String to field com.jarektoro.responsivelayout.Styleable.StyleableComponent.visibilityCSSAdapter of type com.jarektoro.responsivelayout.Styleable.VisibilityCSSAdapter in instance of com.jarektoro.responsivelayout.ResponsiveColumn
Is it possible to get more of the exception? What is the offending Line in the layout code? What are you trying to do with the Columns
at the beginning all components were in a row, now I have max. 4 components in 3 row
here is my Code:
ResponsiveLayout responsiveLayout = new ResponsiveLayout();
ResponsiveRow rootRow = responsiveLayout.addRow();
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.XS);
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.SM);
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.MD);
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.LG);
rootRow.setSpacing(ResponsiveRow.SpacingSize.SMALL, true);
rootRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.mklogo);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbLevel);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbCompartment);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbZone);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbDivision);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnRefreshMap);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnInsert);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnUpdate);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnEdit);
this.addComponent(responsiveLayout);
Thank you @Kirbylix does the exception mentioned give a line number of the error?
no, sorry
Ok I’ll test your code see if I can reproduce the error
What browser are you using?
my current problem is, as I said before, that I had all components in a row (at maximized windows) at the beginning. Now I have 3 rows with max. 4 components. I didn't change the code for the layout during that time.
I used the Chrome Browser and the application runs on a Glassfish 4.1.1
With the current information, it is hard to diagnose the issue. None of your code shown uses the Visibility features of a ResponsiveColumn. Do you call isVisibleForDisplaySize(ResponsiveLayout.DisplaySize displaySize) or setVisibility(ResponsiveLayout.DisplaySize displaySize, boolean isVisible) anywhere in your code?
this is my complete code for the layout:
`private void setLayout(){
this.setMargin(false);
this.setSpacing(false);
this.setSizeFull();
ResponsiveLayout responsiveLayout = new ResponsiveLayout();
ResponsiveRow rootRow = responsiveLayout.addRow();
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.XS);
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.SM);
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.MD);
rootRow.setMargin(ResponsiveRow.MarginSize.SMALL, ResponsiveLayout.DisplaySize.LG);
rootRow.setSpacing(ResponsiveRow.SpacingSize.SMALL, true);
rootRow.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.mklogo);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbLevel);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbCompartment);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbZone);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.cbDivision);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnRefreshMap);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnInsert);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnUpdate);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnEdit);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnSave);
rootRow.addColumn().withDisplayRules(12,6,4,3).withComponent(this.btnFullScreen);
final HorizontalSplitPanel hlSplitPanel = new HorizontalSplitPanel();
hlSplitPanel.setSplitPosition(655, Unit.PIXELS);
hlSplitPanel.setFirstComponent(this.lCockpit);
hlSplitPanel.setSecondComponent(this.lMap);
final Panel splitContent = new Panel();
splitContent.setSizeFull();
splitContent.setContent(hlSplitPanel);
this.addComponent(responsiveLayout);
this.addComponent(splitContent);
this.setExpandRatio(splitContent, 1);
}`