public FileExample() { setCaption("Interactive SVG"); addComponent(new MLabel( "A simple example from an svg file using Embedded component. Unlike with Image component, the SVGs JS etc are active. The example also demonstrates how to provide a trivial server side integration API for the SVG.")); Embedded svg = new Embedded(); svg.setWidth("400px"); svg.setHeight("400px"); svg.setSource(new ClassResource("/pull.svg")); // Expose a JS hook that pull.svg file calls when clicked JavaScript.getCurrent().addFunction("callMyVaadinFunction", (JsonArray arguments) -> { Notification.show("Message from SVG:" + arguments.getString(0)); }); addComponent(svg); }
public SimplyAsAnImageOrIcon() { setCaption("Image and icon"); addComponent(new MLabel("Following Image component (rendered as IMG element) contains SVG image. Note, that by using SVG in this way, it is treated as a static image. For eample the js changing the color on click is not executed. See the file example to see how to render an interactive SVG.").withFullWidth()); Image image = new Image(null, new ClassResource("/pull.svg")); image.setWidth("300px"); addComponent(image); addComponent(new MLabel("Following Button has SVG logo as an icon.").withFullWidth()); Button button = new Button(); button.setIcon(new ClassResource("/vaadin-logo.svg")); button.addStyleNames(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_HUGE); addComponent(button); }
@Override public void extendMenu(MenuBar menuBar, SharedProject project) { Command commit = createCommitCommand(); Command github = createGitHubCommand(); MenuItem gitItem = menuBar.addItem("Git", null); if (commit != null) { gitItem.addItem("Commit", commit); } if (github != null) { gitHubItem = gitItem.addItem("GitHub", github); gitHubItem.setIcon(new ClassResource("/org/vaadin/addon/oauthpopupbuttons/icons/github16.png")); gitHubItem.setEnabled(repo.hasCommit()); } }
@Override public void sourceGenerationExecuted(final Source source, final TestGenerationType generationType, final long testsCreated) { UI.getCurrent().access(() -> { Item item = resultsTable.getItem(source); if (testsCreated == 0 || item == null) return; String column = (generationType.equals(TestGenerationType.AutoGenerated) ? "Automatic" : "Manual"); Property<Link> statusProperty = item.getItemProperty(column); String fileName; if (generationType.equals(TestGenerationType.AutoGenerated)) { fileName = CacheUtils.getSourceAutoTestFile(RDFUnitDemoSession.getBaseDir() + "tests/", source); statusProperty.setValue(new Link("" + testsCreated, new FileResource(new File(fileName)))); } else { fileName = CacheUtils.getSourceManualTestFile("/org/aksw/rdfunit/tests/", source); statusProperty.setValue(new Link("" + testsCreated, new ClassResource(fileName))); } CommonAccessUtils.pushToClient(); }); }
public AnimationExample() { setCaption("Animation"); addComponent(new MLabel( "A simple example from an svg file. Also demonstrates SVG animations.").withFullWidth()); Embedded svg = new Embedded(); svg.setWidth("800px"); svg.setHeight("400px"); svg.setSource(new ClassResource("/svg2009.svg")); addComponent(svg); }
private LLayerGroup getRotatedMarkers() { LLayerGroup layerGroup = new LLayerGroup(); Point p1 = new GeometryFactory().createPoint(new Coordinate(8.622, 45.819)); Point p2 = new GeometryFactory().createPoint(new Coordinate(8.54724, 45.73686)); Point p3 = new GeometryFactory().createPoint(new Coordinate(8.49243, 45.74453)); LRotatedMarker rotatedMarker1 = new LRotatedMarker(p1); rotatedMarker1.setRotationAngle(35.0); rotatedMarker1.setPopup("35° rotated marker"); LRotatedMarker rotatedMarker2 = new LRotatedMarker(p2); rotatedMarker2.setIcon(new ClassResource("testicon.png")); rotatedMarker2.setIconSize(new org.vaadin.addon.leaflet.shared.Point(24,24)); rotatedMarker2.setRotationAngle(75.5); rotatedMarker2.setRotationOrigin("bottom right"); rotatedMarker2.setPopup("75.5° rotated marker"); LRotatedMarker rotatedMarker3 = new LRotatedMarker(p3); rotatedMarker3.setRotationAngle(225.2); rotatedMarker3.setPopup("225.2° rotated marker"); layerGroup.addComponent(rotatedMarker1); layerGroup.addComponent(rotatedMarker2); layerGroup.addComponent(rotatedMarker3); return layerGroup; }
private void showDetails(Product product) { FreemarkerLayout productLayout = new FreemarkerLayout(); productLayout.setTemplateFileName("templates/product-details.html"); productLayout.setDataModel(product); productLayout.addComponent(new Image(null, new ClassResource(product.getImage())), "image"); Window window = new Window("Details", productLayout); window.setModal(true); window.setResizable(false); UI.getCurrent().addWindow(window); }
private Component createActionButton1() { Button button = new Button(null, this); button.setIcon(new ThemeResource("../runo/icons/64/email.png")); button.setIcon(new ClassResource("mail.png")); return button; }
public TwitterButton(String key, String secret) { super(TwitterApi.class, key, secret); setIcon(new ClassResource("/org/vaadin/addon/oauthpopup/icons/twitter16.png")); setCaption("Twitter"); }
public FacebookButton(String key, String secret) { super(FacebookApi.class, key, secret); setIcon(new ClassResource("/org/vaadin/addon/oauthpopup/icons/facebook16.png")); setCaption("Facebook"); }
public LinkedInButton(String key, String secret) { super(LinkedInApi.class, key, secret); setIcon(new ClassResource("/org/vaadin/addon/oauthpopup/icons/linkedin16.png")); setCaption("LinkedIn"); }
public GitHubButton(String key, String secret) { super(GitHubApi.class, key, secret); setIcon(new ClassResource("/org/vaadin/addon/oauthpopup/icons/github16.png")); setCaption("GitHub"); }