List of usage examples for com.vaadin.ui Panel Panel
public Panel(String caption)
From source file:eu.lod2.AuthoringTab.java
License:Apache License
public AuthoringTab(LOD2DemoState st) { // The internal state and state = st;// w w w .j av a 2 s. com VerticalLayout authoringTab = new VerticalLayout(); // Activate a graph in Virtuoso be editable in OntoWiki. // Remark: the accessrightsnull in Virtuoso have be set correct [check this] Form activateform = new Form(); activateform.setDebugId(this.getClass().getSimpleName() + "_activateform"); activateform.setCaption("Activate graph in OntoWiki"); // the localhost ip-address activategraph = new TextField("graphname:", state.getCurrentGraph()); activategraph.setColumns(50); activateform.getLayout().addComponent(activategraph); Button activateButton = new Button("Activate graph", new ClickListener() { public void buttonClick(ClickEvent event) { activateGraph(event); } }); activateButton.setDebugId(this.getClass().getSimpleName() + "_activateButton"); activateButton.setDescription("Activate the graph in Virtuoso to become editable in OntoWiki."); activateform.getFooter().addComponent(activateButton); authoringTab.addComponent(activateform); // add a form widget to edit with OntoWiki (or other editor) a specific resource Form t2f = new Form(); t2f.setCaption("Edit resource content"); TextField resToEdit = new TextField("Resource:"); resToEdit.setDebugId(this.getClass().getSimpleName() + "_resToEdit"); resToEdit.setImmediate(false); resToEdit.addListener(this); resToEdit.setColumns(50); t2f.getLayout().addComponent(resToEdit); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); ontowikil = new Link("Edit with Ontowiki", new ExternalResource(state.getHostName() + "/ontowiki/view/?r=&m=http://mytest.com")); ontowikil.setTargetName("_blank"); ontowikil.setTargetBorder(Link.TARGET_BORDER_NONE); ThemeResource ontoWikiIconl = new ThemeResource("app_images/OntoWiki.logo.png"); ontowikil.setIcon(ontoWikiIconl); ontowikil.setEnabled(false); t2f.getFooter().addComponent(ontowikil); t2ffooterlayout.setComponentAlignment(ontowikil, Alignment.TOP_RIGHT); authoringTab.addComponent(t2f); final Panel panel = new Panel("LOD2 components interfaces"); VerticalLayout panelContent = new VerticalLayout(); Link l = new Link("Ontowiki", new ExternalResource(state.getHostName() + "/ontowiki/view/?r=&m=http://mytest.com")); l.setTargetName("_blank"); l.setTargetBorder(Link.TARGET_BORDER_NONE); ThemeResource ontoWikiIcon = new ThemeResource("app_images/OntoWiki.logo.png"); l.setIcon(ontoWikiIcon); panelContent.addComponent(l); panel.setContent(panelContent); authoringTab.addComponent(panel); // The composition root MUST be set setCompositionRoot(authoringTab); }
From source file:eu.lod2.EnrichmentTab.java
License:Apache License
public EnrichmentTab(LOD2DemoState st) { // The internal state and state = st;/*from ww w. j a v a2s .co m*/ VerticalLayout enrichmentTab = new VerticalLayout(); final Panel panel = new Panel("LOD2 components interfaces"); VerticalLayout panelContent = new VerticalLayout(); Link l1 = new Link("SILK", new ExternalResource(state.getHostName() + "/silk")); l1.setTargetName("_blank"); l1.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l1); Link l = new Link("ORE", new ExternalResource("http://web.ore-tool.net")); l.setTargetName("_blank"); l.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l); panel.setContent(panelContent); enrichmentTab.addComponent(panel); // The composition root MUST be set setCompositionRoot(enrichmentTab); }
From source file:eu.lod2.OnlineToolsTab.java
License:Apache License
public OnlineToolsTab(String g, LOD2DemoState st) { // The internal state and state = st;/*w w w . java2 s . co m*/ storeInGraph = g; //************************************************************************ // OnlineToolsTab VerticalLayout onlineToolsTab = new VerticalLayout(); TextField sid = new TextField("search sameAs id's for:"); sid.setDebugId(this.getClass().getSimpleName() + "_sid"); final Label sidenc = new Label(""); // configure & add to layout sid.setImmediate(true); sid.setColumns(30); sid.addListener(new TextChangeListener() { public void textChange(TextChangeEvent event) { sameasid = event.getText(); } }); Button sidbutton = new Button("convert", new ClickListener() { public void buttonClick(ClickEvent event) { try { URI encoded = new URI(sameasid); sidenc.setValue("http://sameAs.org/rdf?uri=" + encoded.toASCIIString()); } catch (Exception e) { e.printStackTrace(); } ; try { // java.net.URL sameAsData = new java.net.URL("http://sameAs.org/rdf?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FGermany"); URI sidencoded = new URI(sameasid); java.net.URL sameAsData = new java.net.URL( "http://sameAs.org/rdf?uri=" + sidencoded.toASCIIString()); String baseURI = "http://sameAs.org#"; RepositoryConnection con = state.getRdfStore().getConnection(); Resource contextURI = con.getValueFactory().createURI(storeInGraph); Resource[] contexts = new Resource[] { contextURI }; con.add(sameAsData, baseURI, RDFFormat.RDFXML, contexts); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (RDFParseException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } ; }; }); onlineToolsTab.addComponent(sid); onlineToolsTab.addComponent(sidenc); onlineToolsTab.addComponent(sidbutton); /* Sigma EE is temporarily deprecated try { URL url2 = new URL(state.getHostName() + "/lod2.sigma.html"); Embedded browser2 = new Embedded("", new ExternalResource(url2)); browser2.setType(Embedded.TYPE_BROWSER); browser2.setWidth("100%"); browser2.setHeight(500); onlineToolsTab.addComponent(browser2); } catch (MalformedURLException e) { e.printStackTrace(); }; */ /* The online resources link page */ final Panel panel = new Panel("LOD2 online components"); VerticalLayout panelContent = new VerticalLayout(); Link l = new Link("SameAs Inference", new ExternalResource("http://sameAs.org/")); l.setTargetName("_blank"); l.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l); Link l2 = new Link("Sig.ma", new ExternalResource("http://sig.ma/")); l2.setTargetName("_blank"); l2.setTargetBorder(Link.TARGET_BORDER_NONE); //panelContent.addComponent(l2); Link l3 = new Link("LOD cloud", new ExternalResource("http://lod.openlinksw.com/")); l3.setTargetName("_blank"); l3.setTargetBorder(Link.TARGET_BORDER_NONE); panelContent.addComponent(l3); panel.setContent(panelContent); onlineToolsTab.addComponent(panel); // The composition root MUST be set setCompositionRoot(onlineToolsTab); }
From source file:eu.lod2.QueryingTab.java
License:Apache License
public QueryingTab(LOD2DemoState st) { // The internal state and state = st;/*from w w w .ja v a 2 s. co m*/ VerticalLayout queryingTab = new VerticalLayout(); Form t2f = new Form(); t2f.setDebugId(this.getClass().getSimpleName() + "_t2f"); t2f.setCaption("Information Source Querying"); graphname = new TextField("repository graph name:"); graphname.setDebugId(this.getClass().getSimpleName() + "_graphname"); /* if (state == null | state.getCurrentGraph() == null | state.getCurrentGraph().equals("")) { graphname.setValue(""); } else { graphname.setValue(state.getCurrentGraph()); }; */ // configure & add to layout graphname.setImmediate(true); graphname.addListener(this); graphname.setColumns(30); graphname.setRequired(true); graphname.setRequiredError("Name of the graph is missing. No query will be issued."); t2f.getLayout().addComponent(graphname); // initialize the footer area of the form HorizontalLayout t2ffooterlayout = new HorizontalLayout(); t2f.setFooter(t2ffooterlayout); Button okbutton = new Button("List graph content", new ClickListener() { public void buttonClick(ClickEvent event) { extractionQuery(event); } }); okbutton.setDebugId(this.getClass().getSimpleName() + "_okbutton"); okbutton.setDescription( "View the result from the SPARQL query: 'select * from <graphname> where {?s ?p ?o.} LIMIT 100'"); // okbutton.addListener(this); // react to tclicks ExternalResource ontowikiquery = new ExternalResource( state.getHostName() + "/ontowiki/queries/editor/?query=&m=http://mytest.com"); ontowikiquerylink = new Link("Query via Ontowiki", ontowikiquery); ontowikiquerylink.setTargetName("_blank"); ontowikiquerylink.setTargetBorder(Link.TARGET_BORDER_NONE); ontowikiquerylink.setEnabled(false); ThemeResource ontoWikiIcon = new ThemeResource("app_images/OntoWiki.logo.png"); ontowikiquerylink.setIcon(ontoWikiIcon); t2f.getFooter().addComponent(okbutton); t2ffooterlayout.setComponentAlignment(okbutton, Alignment.TOP_RIGHT); t2f.getFooter().addComponent(ontowikiquerylink); t2ffooterlayout.setComponentAlignment(ontowikiquerylink, Alignment.TOP_RIGHT); queryingTab.addComponent(t2f); queryingTab.addComponent(sparqlResult); final Panel t2components = new Panel("LOD2 components interfaces"); VerticalLayout t2ComponentsContent = new VerticalLayout(); // dummy request ExternalResource ontowikiquery2 = new ExternalResource( state.getHostName() + "/ontowiki/queries/editor/?query=&m="); Link ontowikiquerylink2 = new Link("Ontowiki", ontowikiquery2); ontowikiquerylink2.setTargetName("_blank"); ontowikiquerylink2.setTargetBorder(Link.TARGET_BORDER_NONE); ThemeResource ontoWikiIcon2 = new ThemeResource("app_images/OntoWiki.logo.png"); ontowikiquerylink2.setIcon(ontoWikiIcon2); t2ComponentsContent.addComponent(ontowikiquerylink2); t2components.setContent(t2ComponentsContent); queryingTab.addComponent(t2components); // The composition root MUST be set setCompositionRoot(queryingTab); }
From source file:eu.lod2.stat.dsdrepo.DSDRepoComponent.java
public DSDRepoComponent(Repository repository, String dataGraph, String repoGraph) { this.repository = repository; this.dataGraph = dataGraph; this.repoGraph = repoGraph; initializeRepoGraph();/* w ww. j a va2s . c om*/ dcRepo = new SparqlDCRepository(repository); graph = new SparqlDCGraph(repository, dataGraph); setSizeFull(); VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull(); rootLayout.setSpacing(true); setDebugId("dsd-repo"); mainLayout = new VerticalLayout(); mainLayout.setSizeUndefined(); mainLayout.setWidth("100%"); // mainLayout.setHeight("800px"); mainLayout.setSpacing(true); HorizontalLayout menuLayout = new HorizontalLayout(); menuLayout.setSpacing(true); menuLayout.setWidth("100%"); rootLayout.addComponent(menuLayout); rootLayout.setExpandRatio(menuLayout, 0.0f); final MenuBar menu = new MenuBar(); menu.addStyleName("dsd"); cmdFindDSD = new MenuBar.Command() { public void menuSelected(MenuBar.MenuItem selectedItem) { for (MenuBar.MenuItem item : menu.getItems()) { if (item == selectedItem) { if (!item.getStyleName().contains("selected")) { if (ds != null) item.setStyleName("selected"); findDSDs(); } } else item.setStyleName("bleja"); } } }; menu.addItem("Find Suitable DSDs", cmdFindDSD).setStyleName("bleja"); cmdCreateDSD = new MenuBar.Command() { public void menuSelected(MenuBar.MenuItem selectedItem) { for (MenuBar.MenuItem item : menu.getItems()) { if (item == selectedItem) { if (!item.getStyleName().contains("selected")) { if (ds != null) item.setStyleName("selected"); createDSD(); } } else item.setStyleName("bleja"); } } }; menu.addItem("Create DSD", cmdCreateDSD).setStyleName("bleja"); cmdStoreDSD = new MenuBar.Command() { public void menuSelected(MenuBar.MenuItem selectedItem) { for (MenuBar.MenuItem item : menu.getItems()) { if (item == selectedItem) { if (!item.getStyleName().contains("selected")) { if (ds != null) item.setStyleName("selected"); storeDSD(); } } else item.setStyleName("bleja"); } } }; menu.addItem("Store DSD", cmdStoreDSD).setStyleName("bleja"); menuLayout.addComponent(menu); Label spaceLbl = new Label(""); menuLayout.addComponent(spaceLbl); menuLayout.setExpandRatio(spaceLbl, 2.0f); Label lbl = new Label("Choose dataset: "); lbl.setSizeUndefined(); menuLayout.addComponent(lbl); Collection<DataSet> colDataSets = graph.getDataSets(); if (colDataSets == null) colDataSets = new LinkedList<DataSet>(); selectDataSet = new ComboBox(null, colDataSets); selectDataSet.setImmediate(true); selectDataSet.setNewItemsAllowed(false); selectDataSet.setNullSelectionAllowed(false); selectDataSet.setWidth("300px"); selectDataSet.addListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { ds = (DataSet) event.getProperty().getValue(); } }); menuLayout.addComponent(selectDataSet); Panel mainPanel = new Panel(mainLayout); mainPanel.setSizeFull(); mainPanel.setScrollable(true); mainPanel.setStyleName(Reindeer.PANEL_LIGHT); Label hrLabel = new Label("<hr/>", Label.CONTENT_XHTML); rootLayout.addComponent(hrLabel); rootLayout.setExpandRatio(hrLabel, 0.0f); rootLayout.addComponent(mainPanel); rootLayout.setExpandRatio(mainPanel, 2.0f); rootLayout.setMargin(true, false, true, false); setCompositionRoot(rootLayout); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
private void createTab_Sites() { VerticalLayout tab_site = new VerticalLayout(); tab_site.setCaption("Sites"); tabsheet.addTab(tab_site);/*ww w . ja v a 2s.c om*/ Panel p_project = new Panel("Create a sites"); p_project.setWidth("400"); HorizontalLayout hor_sites = new HorizontalLayout(); hor_sites.addComponent(sites_tree); final VerticalLayout project_browser4Sites = new VerticalLayout(); hor_sites.addComponent(project_browser4Sites); tab_site.addComponent(hor_sites); htmlView_Project(project_browser4Sites, "Structural"); sites_tree.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 7237016481874141615L; public void valueChange(ValueChangeEvent event) { if (!sites_tree.hasChildren(sites_tree.getValue())) { if (sites_tree.getValue() != null) htmlView_Project(project_browser4Sites, sites_tree.getValue().toString()); } } }); sites_tree.setImmediate(true); Button newRealEstate_button = new Button("Create", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String realEstate_name = site_textField.getValue(); if (realEstate_name != null && realEstate_name.length() > 0) { marmotta_sparql.create_RealEstate(realEstate_name); listSites(); } } }); HorizontalLayout newproject_layout = new HorizontalLayout(); newproject_layout.setSizeUndefined(); site_textField.setImmediate(true); newproject_layout.addComponent(site_textField); newproject_layout.addComponent(newRealEstate_button); newproject_layout.setSpacing(true); p_project.setContent(newproject_layout); tab_site.addComponent(p_project); Button removeRealEstate_button = new Button("Remove the selected site", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { TreeNode realEstate = (TreeNode) sites_tree.getValue(); if (realEstate != null) { //Only real estates Object parent = sites_tree.getParent(realEstate); if (parent == null) { marmotta_sparql.remove_RealEstate(realEstate.getInternal_name()); listSites(); } } } }); tab_site.addComponent(removeRealEstate_button); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
@SuppressWarnings("deprecation") private void createTab_Datasets() { VerticalLayout tab_datasets = new VerticalLayout(); tab_datasets.setCaption("Data sets"); tabsheet.addTab(tab_datasets);//from w w w .j a v a 2s . c o m tab_datasets.addComponent(datasets_tree); Link void_link = new Link("Void description of the data sets", new ExternalResource("http://drumbeat.cs.hut.fi/void.ttl")); tab_datasets.addComponent(void_link); Panel p_model = new Panel("Upload and convert an IFC file"); p_model.setWidth("900"); tab_datasets.addComponent(p_model); HorizontalLayout hor1 = new HorizontalLayout(); hor1.setSizeFull(); // Use all available space hor1.setMargin(true); p_model.setContent(hor1); VerticalLayout upload_selections = new VerticalLayout(); hor1.addComponent(upload_selections); upload_selections.addComponent(sites_tree_4upload); VerticalLayout upload_panels = new VerticalLayout(); hor1.addComponent(upload_panels); Panel p_model_file = new Panel("Upload a file"); p_model_file.setWidth("400"); upload_panels.addComponent(p_model_file); Panel p_model_url = new Panel("Upload from a URL"); p_model_url.setWidth("400"); upload_panels.addComponent(p_model_url); // Create the upload with a caption and set receiver later Upload upload = new Upload("Select a file and press Upload", drumbeat_fileReceiver); upload.addSucceededListener(drumbeat_fileReceiver); upload.addFailedListener(drumbeat_fileReceiver); p_model_file.setContent(upload); url_textField.setImmediate(true); Button button = new Button("Upload from the URL", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { drumbeat_fileReceiver.receiveFileFromURL(url_textField.getValue()); } }); HorizontalLayout url_upload = new HorizontalLayout(); url_upload.setSizeUndefined(); url_upload.addComponent(url_textField); url_upload.addComponent(button); url_upload.setSpacing(true); p_model_url.setContent(url_upload); bim_projects_selection.setInvalidAllowed(false); bim_projects_selection.setNullSelectionAllowed(false); bim_projects_selection.setNewItemsAllowed(false); bim_projects_selection.setWidth("400"); final VerticalLayout project_browser = new VerticalLayout(); bim_projects_selection.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; public void valueChange(ValueChangeEvent event) { if (bim_projects_selection.getValue() != null) { htmlView_BIMProject(project_browser, bim_projects.get(bim_projects_selection.getValue())); } } }); tab_datasets.addComponent(bim_projects_selection); tab_datasets.addComponent(project_browser); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
@SuppressWarnings("deprecation") private void createTab_Queries() { VerticalLayout tab_queries = new VerticalLayout(); tab_queries.setCaption("Queries"); tabsheet.addTab(tab_queries);/*from ww w .j a v a2s . c o m*/ Panel p_sparql = new Panel("Sparql query"); p_sparql.setWidth("900"); VerticalLayout sparql_layout = new VerticalLayout(); final ComboBox queries = new ComboBox("Select a query"); queries.setInvalidAllowed(false); queries.setNullSelectionAllowed(false); queries.setNewItemsAllowed(false); queries.addItem("Sites"); queries.setValue("Sites"); queries.addItem("Structural model links"); queries.addItem("Project name"); queries.addItem("List implements links"); queries.setWidth("400"); queries.addListener(new Property.ValueChangeListener() { private static final long serialVersionUID = -5188369735622627751L; public void valueChange(ValueChangeEvent event) { if (queries.getValue() != null) { if (queries.getValue().equals("Sites")) sparql_query_area.setValue(DrumbeatConstants.query_sites); if (queries.getValue().equals("Structural model links")) sparql_query_area.setValue(DrumbeatConstants.query_structural_links); if (queries.getValue().equals("Project name")) sparql_query_area.setValue(DrumbeatConstants.query_structural_project); if (queries.getValue().equals("List implements links")) sparql_query_area.setValue(DrumbeatConstants.query_implemens); } } }); sparql_layout.addComponent(queries); sparql_layout.addComponent(sparql_query_area); sparql_query_area.setValue(DrumbeatConstants.query_sites); Button sparql_button = new Button("Query", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { sparql_result_rtarea.setValue(marmotta.httpGetQuery2html(sparql_query_area.getValue())); } }); Button sparql_button_json = new Button("Query and download JSON"); OnDemandFileDownloader jsonDownloader = new OnDemandFileDownloader(createOnDemandJSON_Resource(), "JSON", this); jsonDownloader.extend(sparql_button_json); Button sparql_button_xml = new Button("Query and download XML"); OnDemandFileDownloader xmlDownloader = new OnDemandFileDownloader(createOnDemandXMLResource(), "XML", this); xmlDownloader.extend(sparql_button_xml); HorizontalLayout hor_sparql_buttons = new HorizontalLayout(); hor_sparql_buttons.addComponent(sparql_button); hor_sparql_buttons.addComponent(sparql_button_json); hor_sparql_buttons.addComponent(sparql_button_xml); sparql_layout.addComponent(hor_sparql_buttons); sparql_layout.addComponent(sparql_result_rtarea); sparql_query_area.setWidth("800"); sparql_query_area.setHeight("400"); sparql_result_rtarea.setWidth("800"); p_sparql.setContent(sparql_layout); tab_queries.addComponent(p_sparql); }
From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java
License:Open Source License
private void createTab_Links() { VerticalLayout tab_links = new VerticalLayout(); tab_links.setCaption("Links"); tabsheet.addTab(tab_links);//from ww w .j ava2 s . co m Panel p_links = new Panel("Implements query"); p_links.setWidth("900"); VerticalLayout links_layout = new VerticalLayout(); contexts_selection.setInvalidAllowed(false); contexts_selection.setNullSelectionAllowed(false); contexts_selection.setNewItemsAllowed(false); contexts_selection.setWidth("800"); links_layout.addComponent(contexts_selection); Button links_button = new Button("List links", new Button.ClickListener() { @SuppressWarnings("unchecked") @Override public void buttonClick(Button.ClickEvent event) { if (contexts_selection.getValue() != null && contexts_selection.getValue().toString().length() > 0) { String query = ToolkitString.strReplaceLike(DrumbeatConstants.querytemplate_links, "<context>", "<" + contexts_selection.getValue() + ">"); List<Pair> links = marmotta.httpGetLinks(query); links_table.removeAllItems(); generated_links.clear(); for (Pair p : links) { Object newItemId = links_table.addItem(); Item row = links_table.getItem(newItemId); String short_from = ToolkitString.strReplaceLike(p.getS1(), DrumbeatConstants.resource_baseurl, "resourse:"); String short_to = ToolkitString.strReplaceLike(p.getS2(), DrumbeatConstants.resource_baseurl, "resourse:"); row.getItemProperty("From").setValue(short_from); row.getItemProperty("property").setValue("ifc:implements"); row.getItemProperty("To").setValue(short_to); generated_links.add(p); } } } }); links_layout.addComponent(links_button); links_table.addContainerProperty("From", String.class, null); links_table.addContainerProperty("property", String.class, null); links_table.addContainerProperty("To", String.class, null); links_table.setSelectable(false); links_layout.addComponent(links_table); links_table.setWidth("800"); Button insert_links_button = new Button("Insert links to the RDF Store", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { marmotta_sparql.add_linkset2Model(generated_links); } }); Button remove_links_button = new Button("Remove links from the RDF Store", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { marmotta_sparql.remove_linksetFromModel(generated_links); } }); HorizontalLayout hor_links_buttons = new HorizontalLayout(); hor_links_buttons.addComponent(insert_links_button); hor_links_buttons.addComponent(remove_links_button); links_layout.addComponent(hor_links_buttons); p_links.setContent(links_layout); tab_links.addComponent(p_links); }
From source file:fi.jasoft.dragdroplayouts.demo.DemoUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { VerticalLayout content = new VerticalLayout(); content.setSizeFull();// www . j av a 2s .co m setContent(content); Label header = new Label("DragDropLayouts for Vaadin 8"); header.setStyleName(ValoTheme.LABEL_H1); content.addComponent(header); HorizontalLayout hl = new HorizontalLayout(); hl.setSizeFull(); content.addComponent(hl); content.setExpandRatio(hl, 1); VerticalSplitPanel split = new VerticalSplitPanel(); hl.addComponent(split); hl.setExpandRatio(split, 1); CssLayout placeHolder = new CssLayout(new Label("No view selected.")); placeHolder.setSizeFull(); split.setFirstComponent(placeHolder); Panel codePanel = new Panel(codeLabel); codePanel.setSizeFull(); split.setSecondComponent(codePanel); navigator = new Navigator(this, placeHolder); navigator.addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeEvent event) { DemoView view = (DemoView) event.getNewView(); selection.getSelectionModel().select(view); codeLabel.setValue(getFormattedSourceCode(view.getSource())); return true; } @Override public void afterViewChange(ViewChangeEvent event) { // TODO Auto-generated method stub } }); try { addView(new DragdropAbsoluteLayoutDemo(navigator)); addView(new DragdropVerticalLayoutDemo(navigator)); addView(new DragdropHorizontalLayoutDemo(navigator)); addView(new DragdropGridLayoutDemo(navigator)); addView(new DragdropCssLayoutDemo(navigator)); addView(new DragdropFormLayoutDemo(navigator)); addView(new DragdropPanelDemo(navigator)); addView(new DragdropLayoutDraggingDemo(navigator)); addView(new DragdropHorizontalSplitPanelDemo(navigator)); addView(new DragdropVerticalSplitPanelDemo(navigator)); addView(new DragdropTabsheetDemo(navigator)); addView(new DragdropAccordionDemo(navigator)); addView(new DragdropDragFilterDemo(navigator)); addView(new DragdropCaptionModeDemo(navigator)); addView(new DragdropV7VerticalLayoutDemo(navigator)); addView(new DragdropV7HorizontalLayoutDemo(navigator)); // addView(new DragdropIframeDragging(navigator)); } catch (Exception e) { e.printStackTrace(); return; } hl.addComponent(selection = createViewSelection(), 0); String fragment = Page.getCurrent().getUriFragment(); if (fragment == null || fragment.equals("")) { navigator.navigateTo(DragdropAbsoluteLayoutDemo.NAME); } }