GwtMaterialDesign / gwt-material

A Google Material Design wrapper for GWT
https://gwtmaterialdesign.github.io/gmd-core-demo/
Apache License 2.0
410 stars 124 forks source link

Style of tables not loaded when starting app in dark mode and change to light #1002

Open GuidoReith opened 3 years ago

GuidoReith commented 3 years ago

In Windows 10 preferences setting color to dark. Starting an app the dark mode is true. Changing the dark mode in the app the style of tables is broken. When setting color to light in windows preferences and than start the app everything work like expected. Example: Start with windows color dark: grafik

Klick on MaterialDarkModeToggle: grafik

Example: Start with windows color light: grafik

Klick on MaterialDarkModeToggle: grafik

It seems that the style.css of the gwt-material-table.jar is not loaded, for example the style .tool-panel { float: right; }

Testenvironment: gwt 2.9.0 gwt-material 2.4.2

Demo-Code (add class to root panel)

public class DataTableTestView extends Composite {

private final MaterialPanel fPnl = new MaterialPanel();

public DataTableTestView() {
    DarkThemeManager.get().register(new CoreDarkThemeLoader()).register(new TableDarkThemeLoader()).load();

    initWidget(fPnl);

    fPnl.add(new MaterialDarkModeToggle());

    MaterialDataTable<TestData> table = initDataTable();
    fPnl.add(table);
}

private static MaterialDataTable<TestData> initDataTable() {
    MaterialDataTable<TestData> table = new MaterialDataTable<>();
    table.addColumn("Id", new WidgetColumn<DataTableTestView.TestData, MaterialLabel>() {
        @Override
        public MaterialLabel getValue(final TestData object) {
            return new MaterialLabel(object.getId());
        }
    });

    table.addColumn("Name", new WidgetColumn<DataTableTestView.TestData, MaterialLabel>() {
        @Override
        public MaterialLabel getValue(final TestData object) {
            return new MaterialLabel(object.getName());
        }
    });

    table.addColumn("Actions", new WidgetColumn<DataTableTestView.TestData, MaterialPanel>() {
        @Override
        public MaterialPanel getValue(final TestData object) {
            MaterialPanel pnl = new MaterialPanel();
            MaterialIcon icon = new MaterialIcon(IconType.MENU);
            icon.setLayoutPosition(Position.RELATIVE);
            MaterialDropDown<MaterialLink> dropdown = new MaterialDropDown<>(icon);
            dropdown.add(new MaterialLink("Action 1"));
            dropdown.add(new MaterialLink("Action 2"));
            pnl.add(icon);
            pnl.add(dropdown);
            return pnl;
        }
    });

    return table;
}

public static class TestData {
    private String fId;

    private String fName;

    public TestData() {
        //
    }

    public TestData(final String id, final String name) {
        super();
        fId = id;
        fName = name;
    }

    public String getId() {
        return fId;
    }

    public void setId(final String id) {
        fId = id;
    }

    public String getName() {
        return fName;
    }

    public void setName(final String name) {
        fName = name;
    }

}
kevzlou7979 commented 3 years ago

Ok I Will take a look on this.

kevzlou7979 commented 3 years ago

Did you try to load the dark mode resources like this:

        // Dark Theme Mode
        DarkThemeManager.get()
            .register(new CoreDarkThemeLoader())
            .register(new TableDarkThemeLoader())
            .register(new AddinsDarkThemeLoader())
            .load();
GuidoReith commented 3 years ago

Yes i did, you see it in the code DarkThemeManager.get().register(new CoreDarkThemeLoader()).register(new TableDarkThemeLoader()).load();

GuidoReith commented 3 years ago

Do i make something wrong or is it a bug?

kevzlou7979 commented 3 years ago

Ill try to reproduce tge issue

On Tue, Mar 23, 2021, 12:06 AM GuidoReith, @.***> wrote:

Do i make something wrong or is it a bug?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GwtMaterialDesign/gwt-material/issues/1002#issuecomment-804190063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX6EF4VYLMH2JGQKZNN2CTTE5TH3ANCNFSM4ZIKAS7A .