Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visibilityCSSAdapter ClassCastException #45

Open
Kirbylix opened this issue Sep 22, 2017 · 9 comments
Open

visibilityCSSAdapter ClassCastException #45

Kirbylix opened this issue Sep 22, 2017 · 9 comments

Comments

@Kirbylix
Copy link

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

@JarekToro
Copy link
Owner

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

@Kirbylix
Copy link
Author

Kirbylix commented Sep 24, 2017

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

@JarekToro
Copy link
Owner

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

@Kirbylix
Copy link
Author

no, sorry

@JarekToro
Copy link
Owner

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

@JarekToro
Copy link
Owner

What browser are you using?

@Kirbylix
Copy link
Author

Kirbylix commented Sep 26, 2017

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

@JarekToro
Copy link
Owner

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?

@Kirbylix
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants