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
pull/2/head
jensp 2017-08-10 11:59:57 +00:00
parent 1f1560bfa8
commit 040d6c56dd
6 changed files with 133 additions and 52 deletions

View File

@ -25,6 +25,7 @@ import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener; import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.ClassResource; import com.vaadin.server.ClassResource;
import com.vaadin.server.VaadinServlet; import com.vaadin.server.VaadinServlet;
import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.Alignment; import com.vaadin.ui.Alignment;
import com.vaadin.ui.CssLayout; import com.vaadin.ui.CssLayout;
import com.vaadin.ui.CustomComponent; import com.vaadin.ui.CustomComponent;
@ -33,6 +34,7 @@ import com.vaadin.ui.Image;
import com.vaadin.ui.Label; import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet; import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.GroupManager; import org.libreccm.security.GroupManager;
@ -61,7 +63,6 @@ public class AdminView extends CustomComponent implements View {
public static final String VIEWNAME = "admin"; public static final String VIEWNAME = "admin";
@Inject @Inject
private JpqlConsoleController jpqlConsoleController; private JpqlConsoleController jpqlConsoleController;
@ -128,52 +129,51 @@ public class AdminView extends CustomComponent implements View {
jpqlConsole = null; jpqlConsole = null;
} }
final GridLayout header = new GridLayout(5, 1); // final GridLayout header = new GridLayout(5, 1);
header.setWidth("100%"); // header.setWidth("100%");
header.addStyleName("libreccm-header"); // header.addStyleName("libreccm-header");
//
final Label headerInfoLine = new Label("LibreCCM"); // final Label headerInfoLine = new Label("LibreCCM");
headerInfoLine.setId("libreccm-headerinfoline"); // headerInfoLine.setId("libreccm-headerinfoline");
header.addComponent(headerInfoLine, 3, 0, 4, 0); // header.addComponent(headerInfoLine, 3, 0, 4, 0);
header.setComponentAlignment(headerInfoLine, Alignment.TOP_RIGHT); // header.setComponentAlignment(headerInfoLine, Alignment.TOP_RIGHT);
//
final String logoPath; // final String logoPath;
switch (servletContext.getInitParameter("ccm.distribution") // switch (servletContext.getInitParameter("ccm.distribution")
.toLowerCase()) { // .toLowerCase()) {
case "libreccm": // case "libreccm":
logoPath = "/themes/libreccm-default/images/libreccm.png"; // logoPath = "/themes/libreccm-default/images/libreccm.png";
break; // break;
case "librecms": // case "librecms":
logoPath = "/themes/libreccm-default/images/librecms.png"; // logoPath = "/themes/libreccm-default/images/librecms.png";
break; // break;
case "aplaws": // case "aplaws":
logoPath = "/themes/libreccm-default/images/aplaws.png"; // logoPath = "/themes/libreccm-default/images/aplaws.png";
break; // break;
case "scientificcms": // case "scientificcms":
logoPath = "/themes/libreccm-default/images/scientificcms.png"; // logoPath = "/themes/libreccm-default/images/scientificcms.png";
break; // break;
default: // default:
logoPath = "/themes/libreccm-default/images/libreccm.png"; // logoPath = "/themes/libreccm-default/images/libreccm.png";
break; // break;
} // }
//
final Image logo = new Image(null, new ClassResource(logoPath)); // final Image logo = new Image(null, new ClassResource(logoPath));
logo.setId("libreccm-logo"); // logo.setId("libreccm-logo");
logo.addStyleName("libreccm-logo"); // logo.addStyleName("libreccm-logo");
header.addComponent(logo, 0, 0); // header.addComponent(logo, 0, 0);
header.setComponentAlignment(logo, Alignment.MIDDLE_LEFT); // header.setComponentAlignment(logo, Alignment.MIDDLE_LEFT);
final CssLayout footer = new CssLayout(); final CssLayout footer = new CssLayout();
// footer.setWidth("100%"); // footer.setWidth("100%");
footer.setHeight("5em"); footer.setHeight("5em");
final VerticalLayout viewLayout = new VerticalLayout(); final VerticalLayout viewLayout = new VerticalLayout(new Header(),
tabSheet,
footer);
viewLayout.addComponent(header); viewLayout.addStyleName("libreccm-main-margin-top");
viewLayout.addComponent(tabSheet);
viewLayout.addComponent(footer);
setCompositionRoot(viewLayout); super.setCompositionRoot(viewLayout);
} }
@PostConstruct @PostConstruct

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
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);
}
}

View File

@ -135,10 +135,10 @@ public class LoginView extends CustomComponent implements View {
}); });
loginPanel = new Panel("Login", formLayout); loginPanel = new Panel("Login", formLayout);
loginPanel.setWidth("27em");
loginPanel.setWidth("24em"); final VerticalLayout viewLayout = new VerticalLayout(new Header(),
loginPanel);
final VerticalLayout viewLayout = new VerticalLayout(loginPanel);
viewLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); viewLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER);

View File

@ -28,4 +28,9 @@
.scientificcms { .scientificcms {
background-color: #ad5353; background-color: #ad5353;
} }
.libreccm-main-margin-top {
padding-top: 18px !important;
}
} }

View File

@ -1081,7 +1081,7 @@
*/ */
.v-vaadin-version:after { .v-vaadin-version:after {
content: "8.1.0"; content: "8.1.1";
} }
.v-widget { .v-widget {
@ -14782,3 +14782,7 @@ button {
.scientificcms { .scientificcms {
background-color: #ad5353; background-color: #ad5353;
} }
.libreccm-main-margin-top {
padding-top: 18px !important;
}

View File

@ -255,7 +255,7 @@
<plugin> <plugin>
<groupId>com.vaadin</groupId> <groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId> <artifactId>vaadin-maven-plugin</artifactId>
<version>8.1.0</version> <version>8.1.1</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
@ -409,12 +409,12 @@
<dependency> <dependency>
<groupId>com.vaadin</groupId> <groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId> <artifactId>vaadin-client-compiled</artifactId>
<version>8.1.0</version> <version>8.1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.vaadin</groupId> <groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId> <artifactId>vaadin-themes</artifactId>
<version>8.1.0</version> <version>8.1.1</version>
</dependency> </dependency>
<!-- <!--