List of usage examples for com.vaadin.ui Link Link
public Link(String caption, Resource resource)
From source file:com.klwork.explorer.ui.main.views.RoleAdminView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();//from ww w .j a v a 2s . c o m VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresRoles(\"admin\")")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.RoleUserView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();/*from w w w. j ava 2s .c o m*/ 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); }
From source file:com.klwork.explorer.ui.main.views.SampleMainView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();// w w w . j a va 2 s.c om 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); //addComponent(userRolesLayout); Link roleUserView = new Link("Role \"user\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleUserView.NAME)); Link roleAdminView = new Link("Role \"admin\" View (disabled, if user doesn't have access)", new ExternalResource("#!" + RoleAdminView.NAME)); Link authenticatedView = new Link("@RequiresAuthentication View (disabled, if user doesn't have access)", new ExternalResource("#!" + AuthenticatedView.NAME)); Link guestView = new Link("@RequiresGuest View (disabled, if user doesn't have access)", new ExternalResource("#!" + GuestView.NAME)); Link userView = new Link("@RequiresUser View (disabled, if user doesn't have access)", new ExternalResource("#!" + UserView.NAME)); roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class)); roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class)); authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class)); guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class)); userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class)); layout.addComponent(roleUserView); layout.addComponent(roleAdminView); layout.addComponent(authenticatedView); layout.addComponent(guestView); layout.addComponent(userView); 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("/logout/"))); setContent(layout); }
From source file:com.klwork.explorer.ui.main.views.UserView.java
License:Apache License
@PostConstruct public void PostConstruct() { setSizeFull();/*from w w w. j a v a 2 s .c o m*/ VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(new Label("@RequiresUser")); layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME))); setContent(layout); }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void initContactSection() { Label header = createProfileHeader(i18nManager.getMessage(Messages.PROFILE_CONTACT)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); GridLayout contactLayout = createInfoSectionLayout(2, 4); // Email/*from w w w . j a v a2 s. co m*/ if (!editable && isDefined(user.getEmail())) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), user.getEmail()); } else if (editable) { emailField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), emailField, user.getEmail()); } // Phone if (!editable && isDefined(phone)) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phone); } else if (editable) { phoneField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phoneField, phone); } // Twitter if (!editable && isDefined(twitterName)) { Link twitterLink = new Link(twitterName, new ExternalResource("http://www.twitter.com/" + twitterName)); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterLink); } else if (editable) { twitterField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterField, twitterName); } // Skype if (!editable && isDefined(skypeId)) { // The skype entry shows the name + skype icon, laid out in a small grid GridLayout skypeLayout = new GridLayout(2, 1); skypeLayout.setSpacing(true); skypeLayout.setSizeUndefined(); Label skypeIdLabel = new Label(skypeId); skypeIdLabel.setSizeUndefined(); skypeLayout.addComponent(skypeIdLabel); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeLayout); } else if (editable) { skypeField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeField, skypeId); } }
From source file:com.klwork.explorer.web.MyNavigationUI.java
License:Apache License
/** * Exception on action/*from www .j a va 2 s . c o m*/ */ @Override public void error(com.vaadin.server.ErrorEvent event) { // connector event if (event.getThrowable().getCause() instanceof IllegalArgumentException) { IllegalArgumentException exception = (IllegalArgumentException) event.getThrowable().getCause(); Notification.show(exception.getMessage(), Notification.Type.ERROR_MESSAGE); // Cleanup view. Now Vaadin ignores errors and always shows the view. :-( // since beta10 setContent(null); return; } // Error on page load. Now it doesn't work. User sees standard error page. if (event.getThrowable() instanceof IllegalArgumentException) { IllegalArgumentException exception = (IllegalArgumentException) event.getThrowable(); Label label = new Label(exception.getMessage()); label.setWidth(-1, Unit.PERCENTAGE); Link goToMain = new Link("Go to main", new ExternalResource("/")); VerticalLayout layout = new VerticalLayout(); layout.addComponent(label); layout.addComponent(goToMain); layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(goToMain, Alignment.MIDDLE_CENTER); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.addComponent(layout); mainLayout.setComponentAlignment(layout, Alignment.MIDDLE_CENTER); setContent(mainLayout); Notification.show(exception.getMessage(), Notification.Type.ERROR_MESSAGE); return; } DefaultErrorHandler.doDefault(event); }
From source file:com.liferay.mail.vaadin.PreferencesView.java
License:Open Source License
public PreferencesView(final Controller controller) { this.controller = controller; setSpacing(true);//from w w w .j a va 2s .c o m accountPanel = new Panel(Lang.get("your-email-accounts")); updateAccountList(); addComponent(accountPanel); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); addComponent(buttons); Button createAccountButton = new Button(Lang.get("create-account")); createAccountButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { editAccount(null); } }); buttons.addComponent(createAccountButton); Button createGmailButton = new Button("Create GMail account"); createGmailButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { editGmailAccount(null); } }); buttons.addComponent(createGmailButton); Link poweredByVaadin = new Link("", new ExternalResource("http://vaadin.com")); poweredByVaadin.setIcon(new PortletResource("images/vaadin/powered-by-vaadin.png")); poweredByVaadin.setDescription("Mail portlet interface created using Vaadin - RIA's with pure Java."); addComponent(poweredByVaadin); }
From source file:com.lizardtech.expresszip.vaadin.JobsStatusViewComponent.java
License:Apache License
public JobsStatusViewComponent(URL appUrl) { VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSpacing(true);/*from ww w . j a va 2s. co m*/ mainLayout.setMargin(true); mainLayout.setWidth("100%"); // Refresher will update UI as progress is made final Refresher refresher = new Refresher(); refresher.setRefreshInterval(UPDATE_STATUS_INTERVAL); refresher.addListener(this); mainLayout.addComponent(refresher); mainLayout.addComponent(buildTableControls()); form = new Form(); form.setCaption("Selected Job"); form.setWidth("420px"); form.setFormFieldFactory(new ExpressZipFieldFactory()); form.setVisible(true); form.setImmediate(true); table = new Table(null); table.addStyleName("expresszip"); table.setWidth("100%"); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setPageLength(0); table.setHeight("250px"); container = new BeanItemContainer<Job>(Job.class, Job.getJobQueue()); container.addNestedContainerProperty("exportProps.jobName"); container.addNestedContainerProperty("exportProps.userNotation"); table.setContainerDataSource(container); table.setVisibleColumns(new String[] { "exportProps.jobName", "exportProps.userNotation", "status" }); table.setColumnHeaders(new String[] { "Job Name", "User Name", "Status" }); table.sort(new Object[] { "exportProps.jobName", "exportProps.userNotation" }, new boolean[] { true, true }); table.setColumnExpandRatio("status", 0.8f); // use green bar to highlight selected row ExpressZipTreeTable.enableFirstColumnHighlighter(table); updateTableData(); mainLayout.addComponent(table); mainLayout.setExpandRatio(table, 1.0f); mainLayout.addComponent(form); Link browseExports = new Link("Browse Archived Jobs", new ExternalResource(appUrl.getProtocol() + "://" + appUrl.getAuthority() + "/exportdir/")); // Open the URL in a new window/tab browseExports.setTargetName("_blank"); mainLayout.addComponent(browseExports); // setContent(mainLayout); setCompositionRoot(mainLayout); }
From source file:com.lizardtech.expresszip.vaadin.LinkField.java
License:Apache License
public LinkField(Item item, Object propertyId) { String url = (String) item.getItemProperty(propertyId).getValue(); link = new Link(url, new ExternalResource(url)); link.setTargetName("_blank"); setCompositionRoot(link);/* ww w.ja va 2 s.c om*/ }
From source file:com.morevaadin.vaadin7.html.basic.BasicHtmlIntegrationView.java
License:Apache License
public BasicHtmlIntegrationView() { FormLayout layout = new FormLayout(); addComponent(layout);/*from w w w .j a v a 2 s. co m*/ Link blog = new Link("A Java Geek", new ExternalResource("http://blog.frankel.ch/")); Link morevaadin = new Link("More Vaadin", new ExternalResource("http://morevaadin.com/")); new BasicTooltipExtension().extend(blog); new BasicTooltipExtension().extend(morevaadin); layout.addComponent(blog); layout.addComponent(morevaadin); }