Java tutorial
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.klwork.ui.main.views; import com.klwork.ui.VaadinView; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener; import com.vaadin.server.ExternalResource; import com.vaadin.ui.*; import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; /** * The Class RoleUserView. */ @Component @Scope("prototype") @VaadinView(RoleUserView.NAME) @RequiresRoles("user") public class RoleUserView extends Panel implements View { public static final String NAME = "role_user"; @PostConstruct public void PostConstruct() { setSizeFull(); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresRoles(\"user\")")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); } @Override public void enter(ViewChangeListener.ViewChangeEvent event) { } }