From b89b3c864c861f9b2b1530b5435d046bd6dfa7f9 Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 10 Aug 2017 11:59:57 +0000 Subject: [PATCH] CCM NG/ccm-core: Some small enhancements for the Vaadin prototype git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4903 8810af33-2d31-482b-a856-94f89814c4df --- .../java/org/libreccm/admin/ui/AdminView.java | 90 +++++++++---------- .../java/org/libreccm/admin/ui/Header.java | 72 +++++++++++++++ .../java/org/libreccm/admin/ui/LoginView.java | 6 +- .../VAADIN/themes/ccm-core/ccm-core.scss | 5 ++ .../VAADIN/themes/ccm-core/styles.css | 6 +- pom.xml | 6 +- 6 files changed, 133 insertions(+), 52 deletions(-) create mode 100644 ccm-core/src/main/java/org/libreccm/admin/ui/Header.java diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/AdminView.java b/ccm-core/src/main/java/org/libreccm/admin/ui/AdminView.java index 4362acd89..edf427e14 100644 --- a/ccm-core/src/main/java/org/libreccm/admin/ui/AdminView.java +++ b/ccm-core/src/main/java/org/libreccm/admin/ui/AdminView.java @@ -25,6 +25,7 @@ import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener; import com.vaadin.server.ClassResource; import com.vaadin.server.VaadinServlet; +import com.vaadin.shared.ui.MarginInfo; import com.vaadin.ui.Alignment; import com.vaadin.ui.CssLayout; import com.vaadin.ui.CustomComponent; @@ -33,6 +34,7 @@ import com.vaadin.ui.Image; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.ValoTheme; import org.apache.shiro.subject.Subject; import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.security.GroupManager; @@ -61,7 +63,6 @@ public class AdminView extends CustomComponent implements View { public static final String VIEWNAME = "admin"; - @Inject private JpqlConsoleController jpqlConsoleController; @@ -88,10 +89,10 @@ public class AdminView extends CustomComponent implements View { @Inject private RoleRepository roleRepo; - + @Inject private RoleManager roleManager; - + @Inject private UsersTableDataProvider usersTableDataProvider; @@ -128,52 +129,51 @@ public class AdminView extends CustomComponent implements View { jpqlConsole = null; } - final GridLayout header = new GridLayout(5, 1); - header.setWidth("100%"); - header.addStyleName("libreccm-header"); - - final Label headerInfoLine = new Label("LibreCCM"); - headerInfoLine.setId("libreccm-headerinfoline"); - header.addComponent(headerInfoLine, 3, 0, 4, 0); - header.setComponentAlignment(headerInfoLine, Alignment.TOP_RIGHT); - - final String logoPath; - switch (servletContext.getInitParameter("ccm.distribution") - .toLowerCase()) { - case "libreccm": - logoPath = "/themes/libreccm-default/images/libreccm.png"; - break; - case "librecms": - logoPath = "/themes/libreccm-default/images/librecms.png"; - break; - case "aplaws": - logoPath = "/themes/libreccm-default/images/aplaws.png"; - break; - case "scientificcms": - logoPath = "/themes/libreccm-default/images/scientificcms.png"; - break; - default: - logoPath = "/themes/libreccm-default/images/libreccm.png"; - break; - } - - final Image logo = new Image(null, new ClassResource(logoPath)); - logo.setId("libreccm-logo"); - logo.addStyleName("libreccm-logo"); - header.addComponent(logo, 0, 0); - header.setComponentAlignment(logo, Alignment.MIDDLE_LEFT); - +// final GridLayout header = new GridLayout(5, 1); +// header.setWidth("100%"); +// header.addStyleName("libreccm-header"); +// +// final Label headerInfoLine = new Label("LibreCCM"); +// headerInfoLine.setId("libreccm-headerinfoline"); +// header.addComponent(headerInfoLine, 3, 0, 4, 0); +// header.setComponentAlignment(headerInfoLine, Alignment.TOP_RIGHT); +// +// final String logoPath; +// switch (servletContext.getInitParameter("ccm.distribution") +// .toLowerCase()) { +// case "libreccm": +// logoPath = "/themes/libreccm-default/images/libreccm.png"; +// break; +// case "librecms": +// logoPath = "/themes/libreccm-default/images/librecms.png"; +// break; +// case "aplaws": +// logoPath = "/themes/libreccm-default/images/aplaws.png"; +// break; +// case "scientificcms": +// logoPath = "/themes/libreccm-default/images/scientificcms.png"; +// break; +// default: +// logoPath = "/themes/libreccm-default/images/libreccm.png"; +// break; +// } +// +// final Image logo = new Image(null, new ClassResource(logoPath)); +// logo.setId("libreccm-logo"); +// logo.addStyleName("libreccm-logo"); +// header.addComponent(logo, 0, 0); +// header.setComponentAlignment(logo, Alignment.MIDDLE_LEFT); final CssLayout footer = new CssLayout(); // footer.setWidth("100%"); footer.setHeight("5em"); - final VerticalLayout viewLayout = new VerticalLayout(); + final VerticalLayout viewLayout = new VerticalLayout(new Header(), + tabSheet, + footer); - viewLayout.addComponent(header); - viewLayout.addComponent(tabSheet); - viewLayout.addComponent(footer); + viewLayout.addStyleName("libreccm-main-margin-top"); - setCompositionRoot(viewLayout); + super.setCompositionRoot(viewLayout); } @PostConstruct @@ -221,9 +221,9 @@ public class AdminView extends CustomComponent implements View { public RoleRepository getRoleRepository() { return roleRepo; } - + public RoleManager getRoleManager() { return roleManager; } - + } diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/Header.java b/ccm-core/src/main/java/org/libreccm/admin/ui/Header.java new file mode 100644 index 000000000..b8ce300cb --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/admin/ui/Header.java @@ -0,0 +1,72 @@ +/* + * To change this license layout, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.libreccm.admin.ui; + +import com.vaadin.server.ClassResource; +import com.vaadin.server.VaadinServlet; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Image; +import com.vaadin.ui.Label; + +import javax.servlet.ServletContext; + + +/** + * + * @author Jens Pelzetter + */ +public class Header extends CustomComponent { + + private static final long serialVersionUID = -8503268025688988953L; + + public Header() { + super(); + + final ServletContext servletContext = VaadinServlet + .getCurrent() + .getServletContext(); + + final GridLayout layout = new GridLayout(5, 1); + layout.setWidth("100%"); + layout.addStyleName("libreccm-header"); + + final Label headerInfoLine = new Label("LibreCCM"); + headerInfoLine.setId("libreccm-headerinfoline"); + layout.addComponent(headerInfoLine, 3, 0, 4, 0); + layout.setComponentAlignment(headerInfoLine, Alignment.TOP_RIGHT); + + final String logoPath; + switch (servletContext.getInitParameter("ccm.distribution") + .toLowerCase()) { + case "libreccm": + logoPath = "/themes/libreccm-default/images/libreccm.png"; + break; + case "librecms": + logoPath = "/themes/libreccm-default/images/librecms.png"; + break; + case "aplaws": + logoPath = "/themes/libreccm-default/images/aplaws.png"; + break; + case "scientificcms": + logoPath = "/themes/libreccm-default/images/scientificcms.png"; + break; + default: + logoPath = "/themes/libreccm-default/images/libreccm.png"; + break; + } + + final Image logo = new Image(null, new ClassResource(logoPath)); + logo.setId("libreccm-logo"); + logo.addStyleName("libreccm-logo"); + layout.addComponent(logo, 0, 0); + layout.setComponentAlignment(logo, Alignment.MIDDLE_LEFT); + + super.setCompositionRoot(layout); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/LoginView.java b/ccm-core/src/main/java/org/libreccm/admin/ui/LoginView.java index 743627af2..df36daeb2 100644 --- a/ccm-core/src/main/java/org/libreccm/admin/ui/LoginView.java +++ b/ccm-core/src/main/java/org/libreccm/admin/ui/LoginView.java @@ -135,10 +135,10 @@ public class LoginView extends CustomComponent implements View { }); loginPanel = new Panel("Login", formLayout); + loginPanel.setWidth("27em"); - loginPanel.setWidth("24em"); - - final VerticalLayout viewLayout = new VerticalLayout(loginPanel); + final VerticalLayout viewLayout = new VerticalLayout(new Header(), + loginPanel); viewLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); diff --git a/ccm-core/src/main/resources/VAADIN/themes/ccm-core/ccm-core.scss b/ccm-core/src/main/resources/VAADIN/themes/ccm-core/ccm-core.scss index 4bdea0730..f8e756f75 100644 --- a/ccm-core/src/main/resources/VAADIN/themes/ccm-core/ccm-core.scss +++ b/ccm-core/src/main/resources/VAADIN/themes/ccm-core/ccm-core.scss @@ -28,4 +28,9 @@ .scientificcms { background-color: #ad5353; } + + .libreccm-main-margin-top { + padding-top: 18px !important; + } + } diff --git a/ccm-core/src/main/resources/VAADIN/themes/ccm-core/styles.css b/ccm-core/src/main/resources/VAADIN/themes/ccm-core/styles.css index bb18120a2..9d1af3515 100644 --- a/ccm-core/src/main/resources/VAADIN/themes/ccm-core/styles.css +++ b/ccm-core/src/main/resources/VAADIN/themes/ccm-core/styles.css @@ -1081,7 +1081,7 @@ */ .v-vaadin-version:after { - content: "8.1.0"; + content: "8.1.1"; } .v-widget { @@ -14781,4 +14781,8 @@ button { .scientificcms { background-color: #ad5353; +} + +.libreccm-main-margin-top { + padding-top: 18px !important; } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1aeffeaf5..a5ecf2959 100644 --- a/pom.xml +++ b/pom.xml @@ -255,7 +255,7 @@ com.vaadin vaadin-maven-plugin - 8.1.0 + 8.1.1 @@ -409,12 +409,12 @@ com.vaadin vaadin-client-compiled - 8.1.0 + 8.1.1 com.vaadin vaadin-themes - 8.1.0 + 8.1.1