Search in sources :

Example 6 with ExternalResource

use of com.vaadin.server.ExternalResource in project vaadin-samples by xpoft.

the class MainView method PostConstruct.

@PostConstruct
public void PostConstruct() {
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    HorizontalLayout usernameLayout = new HorizontalLayout();
    usernameLayout.setSpacing(true);
    usernameLayout.addComponent(new Label("Username:"));
    usernameLayout.addComponent(usernameLabel);
    HorizontalLayout userRolesLayout = new HorizontalLayout();
    userRolesLayout.setSpacing(true);
    userRolesLayout.addComponent(new Label("Roles:"));
    userRolesLayout.addComponent(rolesLabel);
    layout.addComponent(usernameLayout);
    layout.addComponent(userRolesLayout);
    Link userView = new Link("ROLE_USER View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleUserView.NAME));
    Link roleView = new Link("ROLE_ADMIN View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME));
    userView.setEnabled(SpringSecurityHelper.hasRole("ROLE_USER"));
    roleView.setEnabled(SpringSecurityHelper.hasRole("ROLE_ADMIN"));
    layout.addComponent(userView);
    layout.addComponent(roleView);
    layout.addComponent(new Link("ROLE_ADMIN View (throw exception, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME)));
    layout.addComponent(new Link("Logout", new ExternalResource("/j_spring_security_logout")));
    setContent(layout);
}
Also used : ExternalResource(com.vaadin.server.ExternalResource) PostConstruct(javax.annotation.PostConstruct)

Example 7 with ExternalResource

use of com.vaadin.server.ExternalResource in project vaadin-samples by xpoft.

the class RoleAdminView method PostConstruct.

@PostConstruct
public void PostConstruct() {
    LoggerFactory.getLogger(this.getClass()).debug("POST");
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(new Label("ROLE_ADMIN"));
    layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME)));
    setContent(layout);
}
Also used : Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) PostConstruct(javax.annotation.PostConstruct)

Example 8 with ExternalResource

use of com.vaadin.server.ExternalResource in project opennms by OpenNMS.

the class PluginManagerAdminApplication method init.

/* (non-Javadoc)
	 * @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest)
	 */
@Override
public void init(VaadinRequest request) {
    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);
    // dynamically inject style for non write borders - avoids changing themes css
    // Get the stylesheet of the page
    Styles styles = Page.getCurrent().getStyles();
    // inject the new font size as a style. We need .v-app to override Vaadin's default styles here
    styles.add(".v-app .v-textfield-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");
    styles.add(".v-app .v-textarea-readonly {border: 1px solid #b6b6b6!important;" + " border-top-color: #9d9d9d!important;" + "border-bottom-color: #d6d6d6!important;" + "border-right-color: #d6d6d6!important;" + " opacity: 1.0!important;" + "filter: none;  }");
    addHeader(request);
    //add diagnostic page links
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);
        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            // adds space between links
            Label label = new Label("   ", ContentMode.HTML);
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }
    PluginManagerUIMainPanel pluginManagerUIMainPanel = new PluginManagerUIMainPanel(sessionPluginManager);
    m_rootLayout.addComponent(pluginManagerUIMainPanel);
    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(pluginManagerUIMainPanel, 1.0f);
}
Also used : Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) PluginManagerUIMainPanel(org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) Styles(com.vaadin.server.Page.Styles) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 9 with ExternalResource

use of com.vaadin.server.ExternalResource in project opennms by OpenNMS.

the class SimpleIframeInVaadinApplication method init.

/* (non-Javadoc)
	 * @see com.vaadin.ui.UI#init(com.vaadin.server.VaadinRequest)
	 */
@Override
public void init(VaadinRequest request) {
    if (iframePageUrl == null)
        throw new RuntimeException("iframePageUrl must not be null");
    m_rootLayout = new VerticalLayout();
    m_rootLayout.setSizeFull();
    m_rootLayout.addStyleName("root-layout");
    setContent(m_rootLayout);
    addHeader(request);
    //add diagnostic page links
    if (headerLinks != null) {
        // defining 2 horizontal layouts to force links to stay together
        HorizontalLayout horizontalLayout1 = new HorizontalLayout();
        horizontalLayout1.setWidth("100%");
        horizontalLayout1.setDefaultComponentAlignment(Alignment.TOP_RIGHT);
        HorizontalLayout horizontalLayout2 = new HorizontalLayout();
        horizontalLayout1.addComponent(horizontalLayout2);
        for (String name : headerLinks.keySet()) {
            String urlStr = headerLinks.get(name);
            ExternalResource urlResource = new ExternalResource(urlStr);
            Link link = new Link(name, urlResource);
            // adds space between links
            Label label = new Label("   ", ContentMode.HTML);
            horizontalLayout2.addComponent(link);
            horizontalLayout2.addComponent(label);
        }
        m_rootLayout.addComponent(horizontalLayout1);
    }
    ExternalResource iframPageResource = new ExternalResource(iframePageUrl);
    BrowserFrame browser = new BrowserFrame("", iframPageResource);
    browser.setWidth("100%");
    browser.setHeight("100%");
    m_rootLayout.addComponent(browser);
    // this forces the UI panel to use up all the available space below the header
    m_rootLayout.setExpandRatio(browser, 1.0f);
}
Also used : BrowserFrame(com.vaadin.ui.BrowserFrame) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 10 with ExternalResource

use of com.vaadin.server.ExternalResource in project vaadin-samples by xpoft.

the class GuestView method PostConstruct.

@PostConstruct
public void PostConstruct() {
    setSizeFull();
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(new Label("@RequiresGuest"));
    layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME)));
    setContent(layout);
}
Also used : Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) PostConstruct(javax.annotation.PostConstruct)

Aggregations

ExternalResource (com.vaadin.server.ExternalResource)13 PostConstruct (javax.annotation.PostConstruct)11 Label (com.vaadin.ui.Label)9 Link (com.vaadin.ui.Link)9 VerticalLayout (com.vaadin.ui.VerticalLayout)9 HorizontalLayout (com.vaadin.ui.HorizontalLayout)3 Styles (com.vaadin.server.Page.Styles)1 BrowserFrame (com.vaadin.ui.BrowserFrame)1 Button (com.vaadin.ui.Button)1 Locale (java.util.Locale)1 PluginManagerUIMainPanel (org.opennms.features.pluginmgr.vaadin.pluginmanager.PluginManagerUIMainPanel)1