List of usage examples for com.vaadin.ui Label setSizeUndefined
@Override public void setSizeUndefined()
From source file:ro.zg.netcell.vaadin.action.application.SetEntityStatusHandler.java
License:Apache License
@Override public void handle(final ActionContext actionContext) throws Exception { // HorizontalLayout parentContainer = (HorizontalLayout) actionContext.getTargetContainer(); CssLayout localContainer = (CssLayout) actionContext.getTargetContainer(); // localContainer.setSpacing(true); // parentContainer.addComponent(localContainer); Entity entity = actionContext.getEntity(); if (entity.getContent() != null) { // parentContainer.setComponentAlignment(localContainer, Alignment.MIDDLE_RIGHT); displayCombo(actionContext, localContainer, actionContext); } else {/* w ww . jav a 2 s .c o m*/ displayLabel(actionContext, localContainer); } /* display most used status */ Label slash = new Label("/"); slash.setSizeUndefined(); slash.addStyleName("middle-left right-margin-5"); localContainer.addComponent(slash); String valueString = "-"; if (entity.getGeneralStatus() != null) { valueString = entity.getGeneralStatus(); } Label generalStatus = new Label(valueString); generalStatus.setSizeUndefined(); generalStatus.addStyleName("middle-left"); localContainer.addComponent(generalStatus); }
From source file:ro.zg.netcell.vaadin.action.application.SetEntityStatusHandler.java
License:Apache License
private void displayLabel(ActionContext actionContext, CssLayout container) { Entity entity = actionContext.getEntity(); EntityUserData userData = entity.getUserData(); String valueString = ": -"; if (userData.getStatus() != null) { valueString = ": " + userData.getStatus(); }/*w ww . jav a 2 s . c o m*/ String statusCaption = getMessage("status"); Label statusLabel = new Label(statusCaption + valueString); statusLabel.setSizeUndefined(); statusLabel.addStyleName("middle-left right-margin-5"); // actionContext.getTargetContainer().addComponent(statusLabel); container.addComponent(statusLabel); }
From source file:ro.zg.netcell.vaadin.action.application.SetEntityStatusHandler.java
License:Apache License
private void displayCombo(final ActionContext actionContext, CssLayout targetContainer, final ActionContext ac) { CommandResponse response = executeAction(ActionsManager.GET_STATUSES, new HashMap<String, Object>()); GenericNameValueList list = (GenericNameValueList) response.getValue("result"); final ComboBox select = new ComboBox(); select.setImmediate(true);// w w w . j av a2 s .c om select.setNewItemsAllowed(true); select.setWidth("110px"); for (int i = 0; i < list.size(); i++) { GenericNameValueContext row = (GenericNameValueContext) list.getValueForIndex(i); select.addItem(row.getValue("status")); } final Collection<?> items = new ArrayList<Object>(select.getItemIds()); final Entity entity = actionContext.getEntity(); final EntityUserData userData = entity.getUserData(); final UserAction ua = actionContext.getUserAction(); final OpenGroupsApplication app = actionContext.getApp(); if (userData.getStatus() != null) { select.setValue(userData.getStatus()); } select.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String value = ((String) select.getValue()); if (value != null) { value = value.trim(); if ("".equals(value)) { value = null; } if (value.length() > 0) { value = value.substring(0, 1).toUpperCase() + value.substring(1).toLowerCase(); } } String currentStatus = userData.getStatus(); if (value == null) { if (currentStatus == null) { return; } } else if (value.equals(currentStatus)) { return; } Map<String, Object> params = ua.getActionParams(); params.put("entityId", entity.getId()); params.put("userId", app.getCurrentUserId()); params.put("status", value); params.put("isRecordCreated", userData.isEntityUserRecordCreated()); CommandResponse resp = executeAction(actionContext, params); if (resp != null) { app.refreshEntity(entity, ac); } else { /* remove the selected value if not laready contained in the available statuses */ if (!items.contains(value)) { select.removeItem(value.toLowerCase()); } select.setValue(userData.getStatus()); } } }); // GridLayout layout = new GridLayout(1, 1); // layout.setSizeFull(); // HorizontalLayout container = new HorizontalLayout(); // container.setSpacing(true); Label statusLabel = new Label(getMessage("status") + ":"); statusLabel.setSizeUndefined(); statusLabel.addStyleName("middle-left right-margin-5"); select.addStyleName("middle-left right-margin-5"); targetContainer.addComponent(statusLabel); targetContainer.addComponent(select); // targetContainer.addComponent(container); // targetContainer.setComponentAlignment(container, Alignment.MIDDLE_RIGHT); // ComponentContainer parentContainer = actionContext.getTargetContainer(); // parentContainer.removeAllComponents(); // layout.addStyleName("stats-summary"); // parentContainer.addComponent(layout); }
From source file:ro.zg.opengroups.views.UserNotificationRulesListHeaderView.java
License:Apache License
private CssLayout addHeader(ListColumn lc, NotificationRulesList updateData) { Label header = new Label(lc.getDescription()); header.setSizeUndefined(); CssLayout cell = new CssLayout(); cell.addStyleName(updateData.getHeaderCellStyle()); cell.setMargin(false, false, false, true); cell.addComponent(header);//from w w w . j av a 2 s . com container.addComponent(cell); HorizontalLayout cl = (HorizontalLayout) container; cl.setComponentAlignment(cell, Alignment.MIDDLE_LEFT); cl.setExpandRatio(cell, 1.3f); return cell; }
From source file:ro.zg.open_groups.gui.components.CausalHierarchyContainer.java
License:Apache License
private void init() { /* start depth combo */ CssLayout startDepthContainer = new CssLayout(); startDepthContainer.setWidth("100%"); startDepthContainer.setHeight("22px"); startDepthContainer.addStyleName(OpenGroupsStyles.HIERARCHY_FILTERS_BAR); Label startDepthLabel = new Label(OpenGroupsResources.getMessage("hierarchy.start.depth")); startDepthLabel.setSizeUndefined(); startDepthLabel.addStyleName(OpenGroupsStyles.HORIZONTAL); startDepthSelect = new ComboBox(); startDepthSelect.setInvalidAllowed(false); startDepthSelect.setNullSelectionAllowed(false); startDepthSelect.setNewItemsAllowed(false); startDepthSelect.addStyleName(OpenGroupsStyles.HORIZONTAL); startDepthSelect.setWidth("55px"); startDepthSelect.setImmediate(true); startDepthContainer.addComponent(startDepthLabel); startDepthContainer.addComponent(startDepthSelect); // CssLayout hierarchyTitleBar = new CssLayout(); // hierarchyTitleBar.setWidth("100%"); // hierarchyTitleBar.addStyleName(OpenGroupsStyles.HIERARCHY_TITLE_BAR); // Label title = new Label("Ierarhie cauzal"); // title.addStyleName(OpenGroupsStyles.TITLE_LINK); // hierarchyTitleBar.addComponent(title); // addComponent(hierarchyTitleBar); addComponent(startDepthContainer);//ww w . j a va 2 s . c om /* the tree */ hierarchyTree = new Tree(); hierarchyTree.addStyleName(OpenGroupsStyles.HIERARCHY_TREE); hierarchyTree.setMultiSelect(false); hierarchyTree.setImmediate(true); hierarchyTree.setNullSelectionAllowed(true); hierarchyTree.setSizeUndefined(); hierarchyTree.setContainerDataSource(new HierarchicalContainer()); hierarchyTree.addContainerProperty("depth", Integer.class, null); hierarchyTree.addListener(new CollapseListener() { @Override public void nodeCollapse(CollapseEvent event) { Object itemId = event.getItemId(); /* remove the subhierarchy */ removeSubhierarchy(itemId); } }); CssLayout treeContainer = new CssLayout(); treeContainer.addStyleName("hierarchy-tree-container"); treeContainer.setWidth("100%"); treeContainer.setHeight("93%"); treeContainer.addComponent(hierarchyTree); addComponent(treeContainer); // setExpandRatio(hierarchyTree, 1); }
From source file:rs.pupin.jpo.esta_ld.DSDRepoComponent.java
public DSDRepoComponent(Repository repository, String dataGraph, String repoGraph) { this.repository = repository; this.dataGraph = dataGraph; this.repoGraph = repoGraph; initializeRepoGraph();//w ww . j a v a 2 s . c om dcRepo = new SparqlDCRepository(repository); graph = new SparqlDCGraph(repository, dataGraph); VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setWidth("100%"); rootLayout.setSpacing(true); mainLayout = new VerticalLayout(); mainLayout.setWidth("100%"); mainLayout.setSpacing(true); HorizontalLayout menuLayout = new HorizontalLayout(); menuLayout.setSpacing(true); menuLayout.setWidth("100%"); rootLayout.addComponent(menuLayout); 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); selectDataSet = new ComboBox(null, graph.getDataSets()); 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); rootLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML)); rootLayout.addComponent(mainLayout); setCompositionRoot(rootLayout); }
From source file:rs.pupin.jpo.esta_ld.EndpointWindow.java
@Override public void attach() { super.attach(); // add endpoint field Label lbl = new Label("Endpoint:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 0, 0, 0); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); endpointInput = new TextField(); endpointInput.setValue(state.endpoint); endpointInput.setWidth("100%"); settingsLayout.addComponent(endpointInput, 1, 0, 1, 0); settingsLayout.setComponentAlignment(endpointInput, Alignment.MIDDLE_RIGHT); // add blank row lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 1, 1, 1); // add buttons HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true);/* www .ja v a2s.c o m*/ hl.setSizeUndefined(); btnOK = new Button("OK"); btnCancel = new Button("Cancel"); hl.addComponent(btnOK); hl.addComponent(btnCancel); settingsLayout.addComponent(hl, 1, 2); settingsLayout.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT); createListeners(); center(); }
From source file:rs.pupin.jpo.esta_ld.EstaLdComponent.java
private void createDataSetLayout() { Label lbl = new Label("Graph: "); lbl.setSizeUndefined(); datasetLayout.addComponent(lbl);//from ww w .j a v a 2 s. co m datasetLayout.setExpandRatio(lbl, 0.0f); datasetLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); selectGraph = new ComboBox(null, dcRepo.getDataCubeGraphs()); selectGraph.setImmediate(true); selectGraph.setNewItemsAllowed(false); selectGraph.setSizeUndefined(); selectGraph.setWidth("100%"); datasetLayout.addComponent(selectGraph); datasetLayout.setExpandRatio(selectGraph, 2.0f); datasetLayout.setComponentAlignment(selectGraph, Alignment.MIDDLE_LEFT); lbl = new Label(" Dataset: "); lbl.setSizeUndefined(); datasetLayout.addComponent(lbl); datasetLayout.setExpandRatio(lbl, 0.0f); datasetLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); selectDataSet = new ComboBox(null, dcRepo.getDataSets()); selectDataSet.setImmediate(true); selectDataSet.setNewItemsAllowed(false); selectDataSet.setNullSelectionAllowed(false); selectDataSet.setSizeUndefined(); selectDataSet.setWidth("100%"); datasetLayout.addComponent(selectDataSet); datasetLayout.setExpandRatio(selectDataSet, 2.0f); datasetLayout.setComponentAlignment(selectDataSet, Alignment.MIDDLE_LEFT); btnVisualize = new Button("Visualize"); btnVisualize.addStyleName("btn-switch-view"); btnVisualize.addStyleName("dim-name"); btnVisualize.addStyleName("selected"); // datasetLayout.addComponent(btnVisualize); // datasetLayout.setExpandRatio(btnVisualize, 0.0f); // btnInspect = new Button("Inspect"); // btnInspect.addStyleName("btn-switch-view"); // btnInspect.addStyleName("dim-name"); // datasetLayout.addComponent(btnInspect); // datasetLayout.setExpandRatio(btnInspect, 0.0f); btnVisualize.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { btnVisualize.addStyleName("selected"); btnInspect.removeStyleName("selected"); inspectLayout.setVisible(false); contentLayout.setVisible(true); // refreshJS(); } }); btnInspect.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { // btnInspect.addStyleName("selected"); // btnVisualize.removeStyleName("selected"); // contentLayout.setVisible(false); // inspectLayout.setVisible(true); String extForm = getWindow().getURL().toExternalForm(); int end = extForm.lastIndexOf("/ESTA-LD") + 8; String targetURL = extForm.substring(0, end) + "/inspect"; getWindow().executeJavaScript("window.open('" + targetURL + "','_blank')"); // getWindow().open(new ExternalResource(targetURL, "_blank")); } }); graphListener = new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { Object prop = event.getProperty().getValue(); selectDataSet.removeAllItems(); if (prop == null) { if (dcRepo.getDataSets() == null) return; boolean firstPass = true; for (DataSet ds : dcRepo.getDataSets()) { selectDataSet.addItem(ds); if (firstPass) { selectDataSet.select(ds); firstPass = false; } } } else { DataCubeGraph graph = (DataCubeGraph) prop; if (graph.getDataSets() == null) return; boolean firstPass = true; for (DataSet ds : graph.getDataSets()) { selectDataSet.addItem(ds); if (firstPass) { selectDataSet.select(ds); firstPass = false; } } } } }; selectGraph.addListener(graphListener); datasetListener = new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { DataSet ds = (DataSet) event.getProperty().getValue(); if (ds != null) { final String function = "javaSetGraphAndDataSet('" + ds.getGraph() + "','" + ds.getUri() + "','" + endpoint + "')"; getWindow().executeJavaScript(function); refreshDimensions(); inspectLayout.removeAllComponents(); inspectLayout.addComponent(new InspectComponent(repository, ds.getGraph(), ds.getUri())); } } }; selectDataSet.addListener(datasetListener); }
From source file:rs.pupin.jpo.esta_ld.InspectWrapperComponent.java
private void createDataSetLayout() { Label lbl = new Label("Graph: "); lbl.setSizeUndefined(); datasetLayout.addComponent(lbl);// w ww . j av a 2 s.c o m datasetLayout.setExpandRatio(lbl, 0.0f); datasetLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); selectGraph = new ComboBox(null, dcRepo.getDataCubeGraphs()); selectGraph.setImmediate(true); selectGraph.setNewItemsAllowed(false); selectGraph.setSizeUndefined(); selectGraph.setWidth("100%"); datasetLayout.addComponent(selectGraph); datasetLayout.setExpandRatio(selectGraph, 2.0f); datasetLayout.setComponentAlignment(selectGraph, Alignment.MIDDLE_LEFT); lbl = new Label(" Dataset: "); lbl.setSizeUndefined(); datasetLayout.addComponent(lbl); datasetLayout.setExpandRatio(lbl, 0.0f); datasetLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); selectDataSet = new ComboBox(null, dcRepo.getDataSets()); selectDataSet.setImmediate(true); selectDataSet.setNewItemsAllowed(false); selectDataSet.setNullSelectionAllowed(false); selectDataSet.setSizeUndefined(); selectDataSet.setWidth("100%"); datasetLayout.addComponent(selectDataSet); datasetLayout.setExpandRatio(selectDataSet, 2.0f); datasetLayout.setComponentAlignment(selectDataSet, Alignment.MIDDLE_LEFT); graphListener = new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { Object prop = event.getProperty().getValue(); selectDataSet.removeAllItems(); if (prop == null) { if (dcRepo.getDataSets() == null) return; boolean firstPass = true; for (DataSet ds : dcRepo.getDataSets()) { selectDataSet.addItem(ds); if (firstPass) { selectDataSet.select(ds); firstPass = false; } } } else { DataCubeGraph graph = (DataCubeGraph) prop; if (graph.getDataSets() == null) return; boolean firstPass = true; for (DataSet ds : graph.getDataSets()) { selectDataSet.addItem(ds); if (firstPass) { selectDataSet.select(ds); firstPass = false; } } } } }; selectGraph.addListener(graphListener); datasetListener = new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { DataSet ds = (DataSet) event.getProperty().getValue(); if (ds != null) { contentLayout.removeAllComponents(); InspectComponent c = new InspectComponent(repository, ds.getGraph(), ds.getUri()); c.addStyleName("inspect-component"); contentLayout.addComponent(c); } } }; selectDataSet.addListener(datasetListener); }
From source file:rs.pupin.jpo.validation.gui.ValidationSettingsWindow.java
@Override public void attach() { // add endpoint field Label lbl = new Label("Endpoint:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 0, 0, 0); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); endpointInput = new TextField(); endpointInput.setValue(state.endpoint); endpointInput.setWidth("100%"); settingsLayout.addComponent(endpointInput, 1, 0, 1, 0); // add graph field lbl = new Label("Graph:"); lbl.setSizeUndefined();//from w ww . j a v a 2 s . co m settingsLayout.addComponent(lbl, 0, 1, 0, 1); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); graphInput = new TextField(); graphInput.setValue(state.graph); graphInput.setWidth("100%"); settingsLayout.addComponent(graphInput, 1, 1, 1, 1); lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 2, 1, 2); // add basic authentication check box authCheckBox = new CheckBox("Use basic authentication"); authCheckBox.setSizeUndefined(); settingsLayout.addComponent(authCheckBox, 0, 3, 1, 3); settingsLayout.setComponentAlignment(authCheckBox, Alignment.MIDDLE_LEFT); // add username field lbl = new Label("Username:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 4); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); usernameInput = new TextField(); usernameInput.setWidth("100%"); usernameInput.setEnabled(false); settingsLayout.addComponent(usernameInput, 1, 4); settingsLayout.setComponentAlignment(usernameInput, Alignment.MIDDLE_LEFT); // add password field lbl = new Label("Password:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 5); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); passwordInput = new PasswordField(); passwordInput.setWidth("100%"); passwordInput.setEnabled(false); settingsLayout.addComponent(passwordInput, 1, 5); lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 6, 1, 6); // add OntoWiki check box owCheckBox = new CheckBox("Use OntoWiki instance"); owCheckBox.setSizeUndefined(); if (state.owUrl != null) owCheckBox.setValue(true); else owCheckBox.setValue(false); settingsLayout.addComponent(owCheckBox, 0, 7, 1, 7); settingsLayout.setComponentAlignment(owCheckBox, Alignment.MIDDLE_LEFT); // add OntoWiki field lbl = new Label("OntoWiki URL:"); lbl.setSizeUndefined(); settingsLayout.addComponent(lbl, 0, 8); settingsLayout.setComponentAlignment(lbl, Alignment.MIDDLE_LEFT); owInput = new TextField(); owInput.setWidth("100%"); if (state.owUrl != null) { owInput.setEnabled(true); owInput.setValue(state.owUrl); } else owInput.setEnabled(false); settingsLayout.addComponent(owInput, 1, 8); settingsLayout.setComponentAlignment(owInput, Alignment.MIDDLE_LEFT); lbl = new Label(""); lbl.setHeight("30px"); settingsLayout.addComponent(lbl, 0, 9, 1, 9); // add buttons HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); hl.setSizeUndefined(); btnOK = new Button("OK"); btnCancel = new Button("Cancel"); hl.addComponent(btnOK); hl.addComponent(btnCancel); settingsLayout.addComponent(hl, 1, 10); settingsLayout.setComponentAlignment(hl, Alignment.MIDDLE_RIGHT); createListeners(); center(); }