responsive-layout icon indicating copy to clipboard operation
responsive-layout copied to clipboard

visibilityCSSAdapter ClassCastException

Open Kirbylix opened this issue 8 years ago • 9 comments

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

Kirbylix avatar Sep 22 '17 16:09 Kirbylix

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

JarekToro avatar Sep 23 '17 23:09 JarekToro

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);

Kirbylix avatar Sep 24 '17 06:09 Kirbylix

Thank you @Kirbylix does the exception mentioned give a line number of the error?

JarekToro avatar Sep 25 '17 15:09 JarekToro

no, sorry

Kirbylix avatar Sep 25 '17 15:09 Kirbylix

Ok I’ll test your code see if I can reproduce the error

JarekToro avatar Sep 25 '17 15:09 JarekToro

What browser are you using?

JarekToro avatar Sep 25 '17 15:09 JarekToro

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

Kirbylix avatar Sep 26 '17 08:09 Kirbylix

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?

JarekToro avatar Sep 26 '17 15:09 JarekToro

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);
}`

Kirbylix avatar Sep 26 '17 15:09 Kirbylix