public Caracteristicas() { buildMainLayout(); setCompositionRoot(mainLayout); // TODO add user code here // Variables datos = new Datos(); listaAvance = new LinkedList<LinkedList<Object>>(); // Textfields txtNoAvance.setEnabled(false); // Comboboxes cmbEtapa.setNullSelectionAllowed(false); llenarLista(datos.getEtapaFenologica(), cmbEtapa); // Timefields tmfAvance.set24HourClock(false); tmfRecesion.set24HourClock(false); // Tables tblAvance.addContainerProperty("Núm.", Object.class, null); tblAvance.addContainerProperty("Distancia (m)", Object.class, null); tblAvance.addContainerProperty("Avance (tiempo)", Object.class, null); tblAvance.addContainerProperty("Recesión (tiempo)", Object.class, null); tblAvance.setSelectable(true); tblAvance.setSortEnabled(true); tblAvance.addItemClickListener(cargarAvanceListener); // Buttons btnAdd.addClickListener(addAvanceListener); btnCancel.addClickListener(cancelarListener); limpiarAvance(); setValidaciones(); }
/** * Build content 'evaluation process' of tab 3. * * @return content of third tab */ private Layout buildTab3Content() { VerticalLayout tab3Content = new VerticalLayout(); tab3Content.setSpacing(true); tab3Content.setMargin(true); tab3Content.setSizeFull(); Label instructions = new Label( "<b>Instructions:</b> <i>Please select and click a sentence below in order to process the evaluation.</i>", Label.CONTENT_XHTML); tab3Content.addComponent(instructions); this.tableEvaluation = new Table("Evaluation process:"); tableEvaluation.setHeight("150px"); tableEvaluation.setWidth("100%"); tableEvaluation.setImmediate(true); tableEvaluation.setSelectable(true); tableEvaluation.setMultiSelect(false); tableEvaluation.setSortDisabled(false); tableEvaluation.addContainerProperty("ID", Integer.class, null); tableEvaluation.addContainerProperty("Sentence", String.class, null); tableEvaluation.addContainerProperty("Precision", Double.class, null); tableEvaluation.addContainerProperty("Recall", Double.class, null); tableEvaluation.addContainerProperty("F-Score", Double.class, null); tab3Content.addComponent(tableEvaluation); this.buttonNext2 = new Button("Next"); buttonNext2.setImmediate(true); buttonNext2.setDescription("Get the next sentence in table"); tab3Content.addComponent(buttonNext2); this.textAreaEvalSentence = new TextArea("Sentence:"); textAreaEvalSentence.setImmediate(false); textAreaEvalSentence.setReadOnly(true); textAreaEvalSentence.setRows(3); textAreaEvalSentence.setWidth("100%"); tab3Content.addComponent(textAreaEvalSentence); HorizontalLayout hlay1 = new HorizontalLayout(); this.listSelectGoldstandard = new ListSelect("Goldstandard:"); listSelectGoldstandard.setImmediate(true); listSelectGoldstandard.setHeight("120px"); listSelectGoldstandard.setWidth("100%"); listSelectGoldstandard.setNullSelectionAllowed(false); this.listSelectFramework = new ListSelect("Framework:"); listSelectFramework.setImmediate(true); listSelectFramework.setHeight("120px"); listSelectFramework.setWidth("100%"); listSelectFramework.setNullSelectionAllowed(false); hlay1.setSpacing(true); hlay1.setMargin(false); hlay1.setWidth("100%"); hlay1.addComponent(listSelectGoldstandard); hlay1.addComponent(listSelectFramework); tab3Content.addComponent(hlay1); return tab3Content; }
protected void addVariables() { Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_VARIABLES)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_NO_LINE); panelLayout.addComponent(header); panelLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); // variable sorting is done in-memory (which is ok, since normally there aren't that many vars) Map<String, Object> variables = new TreeMap<String, Object>(runtimeService.getVariables(processInstance.getId())); if (variables.size() > 0) { Table variablesTable = new Table(); variablesTable.setWidth(60, UNITS_PERCENTAGE); variablesTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST); variablesTable.addContainerProperty( "name", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_VARIABLE_NAME), null, Table.ALIGN_LEFT); variablesTable.addContainerProperty( "value", String.class, null, i18nManager.getMessage(Messages.PROCESS_INSTANCE_VARIABLE_VALUE), null, Table.ALIGN_LEFT); for (String variable : variables.keySet()) { Item variableItem = variablesTable.addItem(variable); variableItem.getItemProperty("name").setValue(variable); // Get string value to show String theValue = variableRendererManager.getStringRepresentation(variables.get(variable)); variableItem.getItemProperty("value").setValue(theValue); } variablesTable.setPageLength(variables.size()); panelLayout.addComponent(variablesTable); } else { Label noVariablesLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_VARIABLES)); panelLayout.addComponent(noVariablesLabel); } }
@SuppressWarnings("deprecation") private Table getFractionTable(Map<Integer, ProteinBean> proteinFractionAvgList) { Table table = new Table(); table.setStyleName(Reindeer.TABLE_STRONG + " " + Reindeer.TABLE_BORDERLESS); table.setHeight("150px"); table.setWidth("100%"); table.setSelectable(true); table.setColumnReorderingAllowed(true); table.setColumnCollapsingAllowed(true); table.setImmediate(true); // react at once when something is selected table.addContainerProperty( "Fraction Index", Integer.class, null, "Fraction Index", null, com.vaadin.ui.Table.ALIGN_CENTER); table.addContainerProperty( "# Peptides ", Integer.class, null, "# Peptides ", null, com.vaadin.ui.Table.ALIGN_CENTER); table.addContainerProperty( "# Spectra ", Integer.class, null, "# Spectra", null, com.vaadin.ui.Table.ALIGN_CENTER); table.addContainerProperty( "Average Precursor Intensity", Double.class, null, "Average Precursor Intensity", null, com.vaadin.ui.Table.ALIGN_CENTER); /* Add a few items in the table. */ int x = 0; for (int index : proteinFractionAvgList.keySet()) { ProteinBean pb = proteinFractionAvgList.get(index); table.addItem( new Object[] { new Integer(index), pb.getNumberOfPeptidePerFraction(), pb.getNumberOfSpectraPerFraction(), pb.getAveragePrecursorIntensityPerFraction() }, new Integer(x + 1)); x++; } for (Object propertyId : table.getSortableContainerPropertyIds()) { table.setColumnExpandRatio(propertyId.toString(), 1.0f); } return table; }
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSizeFull(); setContent(layout); HorizontalSplitPanel hPanel = new HorizontalSplitPanel(); VerticalSplitPanel vPanel = new VerticalSplitPanel(); Panel playerPanel = new Panel("Player"); Panel roundsPanel = new Panel("Rounds"); Panel matchesPanel = new Panel("Matches"); Table playersTable = new Table("PlayersTable"); playersTable.addContainerProperty("Id", Integer.class, null); playersTable.addContainerProperty("Name", String.class, null); playersTable.addContainerProperty("Score", Integer.class, null); playersTable.addContainerProperty("Handicap", Integer.class, null); Table roundsTable = new Table("RoundsTable"); Table matchesTable = new Table("MatchesTable"); playerPanel.setContent(playersTable); HorizontalLayout newPlayerLayout = new HorizontalLayout(); TextField newPlayer = new TextField(null, "newPlayer"); Button addPlayerButton = new Button("addPlayer"); newPlayerLayout.addComponent(newPlayer); newPlayerLayout.addComponent(addPlayerButton); hPanel.addComponent(newPlayerLayout); roundsPanel.setContent(roundsTable); matchesPanel.setContent(matchesTable); VerticalLayout playerLayout = new VerticalLayout(); playerLayout.addComponent(playerPanel); playerLayout.addComponent(newPlayerLayout); VerticalLayout roundsLayout = new VerticalLayout(); roundsLayout.addComponent(roundsPanel); Button addRoundButton = new Button("addRound"); roundsLayout.addComponent(roundsPanel); roundsLayout.addComponent(addRoundButton); layout.addComponent(hPanel); hPanel.setFirstComponent(playerLayout); hPanel.setSecondComponent(vPanel); vPanel.setFirstComponent(roundsLayout); vPanel.setSecondComponent(matchesPanel); }
private Table getHouseholdFactBaseCubeTable() throws SQLException { Table householdFactBaseCubeTable = new Table(); householdFactBaseCubeTable.setSizeFull(); householdFactBaseCubeTable.setImmediate(true); householdFactBaseCubeTable.setColumnCollapsingAllowed(true); householdFactBaseCubeTable.addContainerProperty("ACCOUNT CITY", String.class, null); householdFactBaseCubeTable.addContainerProperty("BRANCH CITY", String.class, null); householdFactBaseCubeTable.addContainerProperty("FISCAL QUARTER", String.class, null); householdFactBaseCubeTable.addContainerProperty("STATUS REASON", String.class, null); householdFactBaseCubeTable.addContainerProperty("PRIMARY BALANCE", String.class, null); householdFactBaseCubeTable.addContainerProperty("TRANSACTION COUNT", String.class, null); householdFactBaseCubeTable.addContainerProperty("ACCOUNT COUNT", String.class, null); DecimalFormat formatDecimal = new DecimalFormat("#.##"); ResultSet resultSet = bankService.viewHouseholdBaseCube(); int i = 1; while (resultSet.next()) { householdFactBaseCubeTable.addItem( new Object[] { resultSet.getObject(1).toString(), resultSet.getObject(2).toString(), resultSet.getObject(3).toString(), resultSet.getObject(4).toString(), formatDecimal.format((Double) resultSet.getObject(5)).toString(), resultSet.getObject(6).toString().replace(".0", ""), resultSet.getObject(7).toString().replace(".0", "") }, new Integer(i)); i++; } return householdFactBaseCubeTable; }
private Table getTestTable() { Table t = new Table(); t.setSizeUndefined(); t.setPageLength(5); t.addContainerProperty("test", String.class, null); t.addItem(new Object[] {"qwertyuiop asdfghjköäxccvbnm,m,."}, 1); t.addItem(new Object[] {"YGVYTCTCTRXRXRXRX"}, 2); return t; }
private Table createTable(String caption) { Table table = new Table(caption); table.setImmediate(true); table.addContainerProperty("column1", String.class, "test"); table.setSizeFull(); table.setHeight("500px"); table.setSelectable(true); return table; }
@SuppressWarnings("unchecked") @Override public void setup(VaadinRequest request) { final Table items = new Table("Items - double-click to edit"); items.setSelectable(true); items.addContainerProperty("name", String.class, ""); items.addContainerProperty("birthday", Date.class, ""); final TableFieldFactory fieldFactory = new ItemFieldFactory(); items.setTableFieldFactory(fieldFactory); Calendar cal = Calendar.getInstance(); cal.set(2010, 7, 12, 12, 7, 54); for (String name : names) { items.addItem(name); items.getItem(name).getItemProperty("name").setValue(name); items .getItem(name) .getItemProperty("birthday") .setValue(new FormattedDate(cal.getTime().getTime())); } items.addItemClickListener( new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (event.isDoubleClick()) { selectionEvent = event; items.setEditable(true); } else if (items.isEditable()) { items.setEditable(false); } } }); addComponent(items); }
@Override protected void setup() { Table table = new Table(); table.setHeight("500px"); table.setSelectable(true); table.addContainerProperty("Column 1", String.class, ""); table.addContainerProperty("Column 2", Component.class, ""); table.addContainerProperty("Column 3", Component.class, ""); table.addContainerProperty("Column 4", Component.class, ""); Item item = table.addItem("Item 1 (row 1)"); item.getItemProperty("Column 1").setValue("String A"); item.getItemProperty("Column 2").setValue(new Label("Label A")); item.getItemProperty("Column 3").setValue(new Label("<b>Label A</b>", ContentMode.HTML)); item.getItemProperty("Column 4") .setValue(new Embedded("An embedded image", new ThemeResource("../runo/icons/32/ok.png"))); item = table.addItem("Item 2 (row 2)"); item.getItemProperty("Column 1").setValue("String B"); item.getItemProperty("Column 2").setValue(new Label("Label B")); item.getItemProperty("Column 3") .setValue( new Label( "<a style=\"color: blue\" href=\"javascript:false\">Label A</a>", ContentMode.HTML)); item.getItemProperty("Column 4") .setValue(new Embedded("", new ThemeResource("../runo/icons/32/cancel.png"))); table.addListener( new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { System.out.println( "Clickevent on item " + event.getItemId() + ", column: " + event.getPropertyId()); } }); addComponent(table); }
public ObjectTypeSelectionPopup( String title, final Map<String, Class<?>> typeList, final ObjectTypeSelectionCallback callback) { super(title); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); // generate table with type list final Table table = new Table(); table.setSizeFull(); table.setSelectable(true); table.setColumnReorderingAllowed(true); table.addContainerProperty(UIConstants.PROP_NAME, String.class, null); table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN); table.setPageLength(10); table.setMultiSelect(false); final Map<Object, Class<?>> idTypeMap = new HashMap<Object, Class<?>>(); for (Entry<String, Class<?>> item : typeList.entrySet()) { Object id = table.addItem(new Object[] {item.getKey()}, null); idTypeMap.put(id, item.getValue()); } layout.addComponent(table); // add OK button Button okButton = new Button("OK"); okButton.addClickListener( new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Object selectedItemId = table.getValue(); if (selectedItemId != null) { Class<?> clazz = idTypeMap.get(selectedItemId); if (clazz != null) callback.onSelected(clazz); } close(); } }); layout.addComponent(okButton); layout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER); setContent(layout); center(); }
protected Table createList() { groupTable = new Table(); groupTable.setEditable(false); groupTable.setImmediate(true); groupTable.setSelectable(true); groupTable.setNullSelectionAllowed(false); groupTable.setSortDisabled(true); groupTable.setSizeFull(); groupListQuery = new GroupListQuery(); groupListContainer = new LazyLoadingContainer(groupListQuery, 20); groupTable.setContainerDataSource(groupListContainer); // Column headers groupTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.GROUP_22)); groupTable.setColumnWidth("icon", 22); groupTable.addContainerProperty("name", String.class, null); groupTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); // Listener to change right panel when clicked on a user groupTable.addListener( new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; public void valueChange(ValueChangeEvent event) { Item item = groupTable.getItem( event .getProperty() .getValue()); // the value of the property is the itemId of the table entry if (item != null) { String groupId = (String) item.getItemProperty("id").getValue(); setDetailComponent(new GroupDetailPanel(GroupPage.this, groupId)); // Update URL ExplorerApp.get() .setCurrentUriFragment(new UriFragment(GroupNavigator.GROUP_URI_PART, groupId)); } else { // Nothing is selected setDetailComponent(null); ExplorerApp.get() .setCurrentUriFragment(new UriFragment(GroupNavigator.GROUP_URI_PART, groupId)); } } }); return groupTable; }
private Table fillTable(String[] headerTable, List reportData) { Table table = new Table(); // header for (int i = 0; i < headerTable.length; i++) { table.addContainerProperty(headerTable[i], String.class, null); } // body ListIterator iterator = reportData.listIterator(); for (int i = 0; iterator.hasNext(); i++) { table.addItem((Object[]) iterator.next(), i); } table.setPageLength(table.size()); table.setSelectable(false); table.setNullSelectionAllowed(false); table.setImmediate(true); return table; }
public Table buildTable(TimingsTableDataHolder holder) { Table table = new Table(); table.setWidth("100%"); table.setPageLength(0); table.addStyleName("pq"); table.setSortEnabled(false); table.setFooterVisible(true); table.setColumnCollapsingAllowed(true); table.setColumnCollapsible(columnNames[0], false); table.setColumnCollapsible(columnNames[1], false); table.setColumnCollapsible(columnNames[3], false); table.setColumnAlignment(columnNames[0], Table.Align.LEFT); for (String name : columnNames) { table.addContainerProperty(name, String.class, null); table.setColumnExpandRatio(name, 2); } fillTable(table, holder.getTotal(), holder.getRows()); return table; }
/** * The constructor should first build the main layout, set the composition root and then do any * custom initialization. * * <p>The constructor will not be automatically regenerated by the visual editor. */ public PanelListaMateriasParaEditar(final BloqueBO bloqueBO) { buildMainLayout(); setCompositionRoot(mainLayout); // TODO add user code here this.bloqueBO = bloqueBO; btn_editar.setEnabled(false); tableMaterias.addContainerProperty("Materias", MateriaBO.class, null); tableMaterias.setSelectable(true); tableMaterias.setImmediate(true); tableMaterias.addValueChangeListener( new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { btn_editar.setEnabled(tableMaterias.getValue() != null); } }); btn_editar.addClickListener( new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { int i = Integer.parseInt(tableMaterias.getValue().toString()); ControladorAdministrador.getInstance().getAcademUI().cerrarVentanaEmergente(); ControladorAdministrador.getInstance() .mostrarPanelEditarMateria(listMaterias.get(i), bloqueBO); } catch (Exception e) { } } }); }
private void showSpreadsheet(File file) { // ApplicationResource resource = (ApplicationResource) // file.getResource(); String string = new String(file.bas.toByteArray()); String[] rows = string.split("\n"); String[] cols = rows[0].split(","); Table table = new Table(); for (String string2 : cols) { // String col = string2.replaceAll("\"", ""); // remove surrounding "" table.addContainerProperty(string2, String.class, ""); } for (int i = 1; i < rows.length; i++) { String[] split = rows[i].split(","); table.addItem(split, "" + i); } VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); Window w = new Window(file.getName(), layout); layout.setSizeUndefined(); table.setEditable(true); layout.addComponent(table); getMainWindow().addWindow(w); }
private Table getHouseholdFactBaseCubeTable() throws SQLException { Table householdFactBaseCubeTable = new Table(); householdFactBaseCubeTable.setSizeFull(); householdFactBaseCubeTable.setImmediate(true); householdFactBaseCubeTable.setColumnCollapsingAllowed(true); householdFactBaseCubeTable.addContainerProperty("ACCOUNT CITY", String.class, null); householdFactBaseCubeTable.addContainerProperty("HOUSEHOLD STATE", String.class, null); householdFactBaseCubeTable.addContainerProperty("PRODUCT TYPE", String.class, null); householdFactBaseCubeTable.addContainerProperty("BRANCH CITY", String.class, null); householdFactBaseCubeTable.addContainerProperty("PRIMARY BALANCE", String.class, null); householdFactBaseCubeTable.addContainerProperty("TRANSACTION COUNT", String.class, null); householdFactBaseCubeTable.addContainerProperty("ACCOUNT COUNT", String.class, null); DecimalFormat formatDecimal = new DecimalFormat("#.##"); ResultSet resultSet = bankService.viewHouseholdBaseCubeFourDims( "a.account_city", "h.household_state", "p.type", "b.branch_city"); int i = 1; while (resultSet.next()) { householdFactBaseCubeTable.addItem( new Object[] { resultSet.getObject(1).toString(), resultSet.getObject(2).toString(), resultSet.getObject(3).toString(), resultSet.getObject(4).toString(), formatDecimal.format((Double) resultSet.getObject(5)).toString(), resultSet.getObject(6).toString().replace(".0", ""), resultSet.getObject(7).toString().replace(".0", "") }, new Integer(i)); i++; } return householdFactBaseCubeTable; }
private Panel designMainPanel() { // positioning indices final int leftStart = 450, topStart = 10, space = 100; // create the panel that will hold all components Panel pnlURIsProperties = new Panel("URI Display"); pnlURIsProperties.setWidth("100%"); pnlURIsProperties.setHeight("100%"); // Create absolute layout specifying its properties final AbsoluteLayout layout = new AbsoluteLayout(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setSizeFull(); // Create components Objects and specify their properties Button btnCorrect = new Button("Correct"); Button btnIncorrect = new Button("Incorrect"); Button btnUnsure = new Button("Unsure"); Button btnGetProperties = new Button("Get properties"); final NativeSelect cmbSourceEndpoint = new NativeSelect("Source Endpoint"); final NativeSelect cmbDestinationEndpoint = new NativeSelect("Destination Endpoint"); final ListSelect lstSuggestedProperties = new ListSelect("Lookup Properties"); // to load properties of loaded resources automatically final CheckBox chkAutomaticPropertiesLoad = new CheckBox("Automatic Properties loading (next time)"); chkAutomaticPropertiesLoad.setValue(false); cmbSourceEndpoint.setNullSelectionAllowed(false); cmbDestinationEndpoint.setNullSelectionAllowed(false); lstSuggestedProperties.setRows(4); lstSuggestedProperties.setNullSelectionAllowed(false); source = new Label("Source URI"); destination = new Label("Destination URI"); final Table tblSourcePropertiesMapping = new Table("Source Properties"); final Table tblDestinationPropertiesMapping = new Table("Destination Properties"); tblSourcePropertiesParam = tblSourcePropertiesMapping; tblDestinationPropertiesParam = tblDestinationPropertiesMapping; tblSourcePropertiesMapping.setWidth("50%"); tblDestinationPropertiesMapping.setWidth("100%"); tblSourcePropertiesMapping.setSelectable(true); tblDestinationPropertiesMapping.setSelectable(true); /* Define the names and data types of columns. * The "default value" parameter is meaningless here. */ tblSourcePropertiesMapping.addContainerProperty("Property", String.class, null); tblSourcePropertiesMapping.addContainerProperty("Value", String.class, null); tblDestinationPropertiesMapping.addContainerProperty("Property", String.class, null); tblDestinationPropertiesMapping.addContainerProperty("Value", String.class, null); tblDestinationPropertiesMapping.setMultiSelect(true); /// get data for comboboxes SQLContainer cmbContainer = connectToDB("root", "mofo", "Endpoints"); // fill endpoints cmbSourceEndpoint.setContainerDataSource(cmbContainer); cmbDestinationEndpoint.setContainerDataSource(cmbContainer); cmbSourceEndpoint.setValue(cmbSourceEndpoint.getItemIds().iterator().next()); cmbDestinationEndpoint.setValue(cmbDestinationEndpoint.getItemIds().iterator().next()); SQLContainer lstContainer = getSuggestedProperties("root", "mofo"); int lstSize = lstContainer.size(); int i = 0; for (Object cityItemId : lstContainer.getItemIds()) { lstSuggestedProperties.addItem(i); String g = lstContainer.getItem(cityItemId).getItemProperty("property").getValue().toString(); lstSuggestedProperties.setItemCaption(i, g); i++; } lstSuggestedProperties.setValue(lstSuggestedProperties.getItemIds().iterator().next()); btnCorrect.addClickListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { try { Object rowId = tblSourceDestinationparam.getValue(); Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue()); lEndTime = System.currentTimeMillis(); long lEllapsedTime = lEndTime - lStartTime; tblSourceDestinationparam.setEditable(true); tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Correct"); tblSourceDestinationparam .getContainerProperty(rowId, "time") .setValue(String.valueOf(lEllapsedTime)); tblSourceDestinationparam.setEditable(false); SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource(); try { c.commit(); } catch (UnsupportedOperationException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } int maxindex = tblSourceDestination.size(); SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource(); // Item x=s.getItem(tblSourceDestination.getValue()); if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) { int index = s.indexOfId(tblSourceDestination.getValue()); index++; tblSourceDestination.setValue(s.getIdByIndex(index)); try { Object rowId2 = tblSourceDestination.getValue(); Property sourceProperty = tblSourceDestination.getContainerProperty(rowId2, "sourceURI"); Property destinationProperty = tblSourceDestination.getContainerProperty(rowId2, "destinationURI"); source.setValue(sourceProperty.toString()); destination.setValue(destinationProperty.toString()); tblSourcePropertiesParam.removeAllItems(); tblDestinationPropertiesParam.removeAllItems(); Notification loadURI = new Notification(""); loadURI.show("Links' URIs are successfully loaded "); if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked { // load the properties automatically String sourceEndpoint = "", destinationEndpoint = ""; sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue()); destinationEndpoint = cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue()); try { String sparqlQuery = source.getValue(); getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping); sparqlQuery = destination.getValue(); getURIProperties( sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping); } catch (Exception e) { Notification.show("ERROR"); } lStartTime = System.currentTimeMillis(); // start time for next one } } catch (Exception e) { Notification error = new Notification("Error"); error.show("You did not select an item in the links table"); } } } catch (Exception e) { Notification.show(e.getMessage()); } /////////////////////////////////// } }); btnIncorrect.addClickListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { try { Object rowId = tblSourceDestinationparam.getValue(); Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue()); lEndTime = System.currentTimeMillis(); long lEllapsedTime = lEndTime - lStartTime; tblSourceDestinationparam.setEditable(true); tblSourceDestinationparam .getContainerProperty(rowId, "decision") .setValue("Incorrect"); tblSourceDestinationparam .getContainerProperty(rowId, "time") .setValue(String.valueOf(lEllapsedTime)); tblSourceDestinationparam.setEditable(false); SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource(); try { c.commit(); } catch (UnsupportedOperationException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } int maxindex = tblSourceDestination.size(); SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource(); // Item x=s.getItem(tblSourceDestination.getValue()); if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) { int index = s.indexOfId(tblSourceDestination.getValue()); index++; tblSourceDestination.setValue(s.getIdByIndex(index)); try { Object rowId2 = tblSourceDestination.getValue(); Property sourceProperty = tblSourceDestination.getContainerProperty(rowId2, "sourceURI"); Property destinationProperty = tblSourceDestination.getContainerProperty(rowId2, "destinationURI"); source.setValue(sourceProperty.toString()); destination.setValue(destinationProperty.toString()); tblSourcePropertiesParam.removeAllItems(); tblDestinationPropertiesParam.removeAllItems(); Notification loadURI = new Notification(""); loadURI.show("Links' URIs are successfully loaded "); if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked { // load the properties automatically String sourceEndpoint = "", destinationEndpoint = ""; sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue()); destinationEndpoint = cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue()); try { String sparqlQuery = source.getValue(); getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping); sparqlQuery = destination.getValue(); getURIProperties( sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping); } catch (Exception e) { Notification.show("ERROR Not Properties queried"); } lStartTime = System.currentTimeMillis(); // start time for next one } } catch (Exception e) { Notification error = new Notification("Error"); error.show("You did not select an item in the links table"); } } } catch (Exception e) { Notification.show(e.getMessage()); } /////////////////////////////////// } }); btnUnsure.addClickListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { try { Object rowId = tblSourceDestinationparam.getValue(); Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue()); lEndTime = System.currentTimeMillis(); float lEllapsedTime = lEndTime - lStartTime; String elapsedTime = String.valueOf(lEllapsedTime); tblSourceDestinationparam.setEditable(true); tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Unsure"); tblSourceDestinationparam.getContainerProperty(rowId, "time").setValue(elapsedTime); tblSourceDestinationparam.setEditable(false); SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource(); try { c.commit(); } catch (UnsupportedOperationException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // int selectedId=Integer.parseInt(tblSourceDestination.getValue().toString()); int maxindex = tblSourceDestination.size(); SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource(); // Item x=s.getItem(tblSourceDestination.getValue()); if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) { int index = s.indexOfId(tblSourceDestination.getValue()); index++; tblSourceDestination.setValue(s.getIdByIndex(index)); try { Object rowId2 = tblSourceDestination.getValue(); Property sourceProperty = tblSourceDestination.getContainerProperty(rowId2, "sourceURI"); Property destinationProperty = tblSourceDestination.getContainerProperty(rowId2, "destinationURI"); source.setValue(sourceProperty.toString()); destination.setValue(destinationProperty.toString()); tblSourcePropertiesParam.removeAllItems(); tblDestinationPropertiesParam.removeAllItems(); Notification loadURI = new Notification(""); loadURI.show("Links' URIs are successfully loaded "); if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked { // load the properties automatically String sourceEndpoint = "", destinationEndpoint = ""; sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue()); destinationEndpoint = cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue()); try { String sparqlQuery = source.getValue(); getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping); sparqlQuery = destination.getValue(); getURIProperties( sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping); } catch (Exception e) { Notification.show("ERROR Not Properties queried"); } lStartTime = System.currentTimeMillis(); // start time for next one } } catch (Exception e) { Notification error = new Notification("Error"); error.show("You did not select an item in the links table"); } } } catch (Exception e) { Notification.show(e.getMessage()); } } }); btnGetProperties.addClickListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String sourceEndpoint = "", destinationEndpoint = ""; sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue()); destinationEndpoint = cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue()); lStartTime = System.currentTimeMillis(); try { String sparqlQuery = source.getValue(); getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping); sparqlQuery = destination.getValue(); getURIProperties(sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping); } catch (Exception e) { Notification.show( "ERROR while sparqling the endpoint for resources' properties (Are they selected/loaded ?)"); } // cachingForTriples(tblSourceDestination, sourceEndpoint); } }); lstSuggestedProperties.addValueChangeListener( new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { final String valueString = String.valueOf(event.getProperty().getValue()); // Notification.show(valueString); List<Object> Ids = new ArrayList<Object>(); Object first = null; for (Iterator i = tblSourcePropertiesMapping.getItemIds().iterator(); i.hasNext(); ) { // Get the current item identifier, which is an integer. first = i.next(); int iid = (Integer) first; String other = tblSourcePropertiesMapping.getItem(iid).getItemProperty("Property").toString(); // Notification.show(other); if (other.equals(valueString)) // if(other.equals(property)) { Ids.add(iid); break; } } tblSourcePropertiesMapping.setImmediate(true); tblSourcePropertiesMapping.setValue(Ids); tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first); } }); tblSourcePropertiesMapping.addItemClickListener( new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { String property = tblSourcePropertiesMapping .getContainerProperty(event.getItemId(), event.getPropertyId()) .toString(); List<String> res = getRelatedProperties(property); if (res == null) { Notification.show("No related Properties"); return; } boolean Found = false; List<Object> Ids = new ArrayList<Object>(); Object first = null; int x = 0; for (String relatedProperty : res) { for (Iterator i = tblDestinationPropertiesMapping.getItemIds().iterator(); i.hasNext(); ) { // Get the current item identifier, which is an integer. Object theId = i.next(); int iid = (Integer) theId; String other = tblDestinationPropertiesMapping .getItem(iid) .getItemProperty(event.getPropertyId()) .toString(); if (other.equals(relatedProperty)) // if(other.equals(property)) { Ids.add(iid); if (x == 0) { first = theId; x = 1; } Found = true; } } } if (!Found) Notification.show( "Related property is not Found in destination table try manual search"); else { Notification.show("Found in destination table"); tblDestinationPropertiesMapping.setValue(Ids); tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first); } } }); // add component to the layout specifying its position on the layout layout.addComponent(btnCorrect, "left: " + leftStart + "px; top: " + (topStart + 450) + "px;"); layout.addComponent( btnIncorrect, "left: " + (leftStart + space) + "px; top: " + (topStart + 450) + "px;"); layout.addComponent( btnUnsure, "left: " + (leftStart + 2 * space) + "px; top: " + (topStart + 450) + "px;"); layout.addComponent( btnGetProperties, "left: " + (leftStart + 3 * space + 50) + "px; top: " + (topStart + 450) + "px;"); layout.addComponent( chkAutomaticPropertiesLoad, "left: " + (leftStart + 3 * space + 250) + "px; top: " + (topStart + 450) + "px;"); /*layout.addComponent(sourceURI,"left: "+(leftStart-space/2)+"px; top: "+(topStart+space/2)+"px;"); layout.addComponent(destinationURI,"left: "+(leftStart+2*space)+"px; top: "+(topStart+space/2)+"px;");*/ layout.addComponent(source, "left: 30px; top: " + (topStart + space / 2) + "px;"); layout.addComponent( destination, "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space / 2) + "px;"); layout.addComponent(cmbSourceEndpoint, "left: 50px; top: " + (topStart + 20) + "px;"); layout.addComponent( cmbDestinationEndpoint, "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + 20) + "px;"); layout.addComponent( lstSuggestedProperties, "left: " + (leftStart + 100) + "px; top: " + (topStart + 20) + "px;"); layout.addComponent( tblSourcePropertiesMapping, "left: 10px; top: " + (topStart + space) + "px;"); layout.addComponent( tblDestinationPropertiesMapping, "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space) + "px;"); pnlURIsProperties.setContent(layout); return pnlURIsProperties; }
private void setupTableColumns() { table.addContainerProperty(LabelKey.Small, String.class, "numpty"); table.addContainerProperty(LabelKey.Cancel, String.class, "numpty"); table.addContainerProperty("not i18N", String.class, "numpty"); }
@Override public void attach() { super.attach(); init( getBundleString("streamingConfigPanel.caption"), getComponentFactory().createGridLayout(1, 5, true, true)); myVlcEnabled = getComponentFactory().createCheckBox("streamingConfigPanel.vlcEnabled"); myVlcBinary = getComponentFactory() .createTextField( "streamingConfigPanel.vlcBinary", new VlcExecutableFileValidator( getBundleString("streamingConfigPanel.vlcBinary.invalidBinary"))); myVlcBinary.setImmediate(false); myVlcBinarySelect = getComponentFactory().createButton("streamingConfigPanel.vlcBinary.select", this); myVlcHomepageButton = getComponentFactory().createButton("streamingConfigPanel.vlcHomepage", this); myVlcForm = getComponentFactory().createForm(null, true); myVlcForm.addField(myVlcEnabled, myVlcEnabled); myVlcForm.addField(myVlcBinary, myVlcBinary); myVlcForm.addField(myVlcBinarySelect, myVlcBinarySelect); myVlcForm.addField(myVlcHomepageButton, myVlcHomepageButton); Panel vlcPanel = getComponentFactory() .surroundWithPanel( myVlcForm, FORM_PANEL_MARGIN_INFO, getBundleString("streamingConfigPanel.caption.vlc")); addComponent(vlcPanel); Panel transcoderPanel = new Panel(getBundleString("streamingConfigPanel.caption.transcoder")); transcoderPanel.setContent(getComponentFactory().createVerticalLayout(true, true)); Panel addTranscoderButtons = new Panel(); addTranscoderButtons.addStyleName("light"); addTranscoderButtons.setContent( getApplication().getComponentFactory().createHorizontalLayout(false, true)); myAddTranscoder = getComponentFactory().createButton("streamingConfigPanel.transcoder.add", this); addTranscoderButtons.addComponent(myAddTranscoder); myTranscoderTable = new Table(); myTranscoderTable.setCacheRate(50); myTranscoderTable.addContainerProperty( "name", String.class, null, getBundleString("streamingConfigPanel.transcoder.name"), null, null); myTranscoderTable.addContainerProperty("edit", Button.class, null, "", null, null); myTranscoderTable.addContainerProperty("delete", Button.class, null, "", null, null); myTranscoderTable.setSortContainerPropertyId("name"); transcoderPanel.addComponent(myTranscoderTable); transcoderPanel.addComponent(addTranscoderButtons); addComponent(transcoderPanel); myCacheForm = getComponentFactory().createForm(null, true); myTranscodingCacheMaxGiB = getComponentFactory() .createTextField( "streamingConfigPanel.cache.transcodingCacheMaxGiB", getApplication().getValidatorFactory().createMinMaxValidator(1, 1024)); myCacheForm.addField("limitTranscoding", myTranscodingCacheMaxGiB); myHttpLiveStreamCacheMaxGiB = getComponentFactory() .createTextField( "streamingConfigPanel.cache.httpLiveStreamCacheMaxGiB", getApplication().getValidatorFactory().createMinMaxValidator(1, 1024)); myCacheForm.addField("limitHttpLiveStream", myHttpLiveStreamCacheMaxGiB); myClearAllCachesButton = getComponentFactory().createButton("streamingConfigPanel.clearAllCaches", this); myCacheForm.addField(myClearAllCachesButton, myClearAllCachesButton); addComponent( getComponentFactory() .surroundWithPanel( myCacheForm, FORM_PANEL_MARGIN_INFO, getBundleString("streamingConfigPanel.caption.cache"))); addDefaultComponents(0, 4, 0, 4, false); initFromConfig(); }
public AttachedDocumentsSubWindow( Window subWindow, BeanItem<AttachedDocumentObject> beanItem, boolean readonly, boolean isNewAttach, WebApplicationContext context) { this.context = context; this.subWindow = subWindow; this.beanItem = beanItem; this.readonly = readonly; setCaption(FactoryI18nManager.getI18nManager().getMessage(Messages.COMMON_ABM_TAB_DOCUMENTS)); setModal(true); setHeight("68%"); setWidth("40%"); center(); setStyleName("pagingButtonBar"); documentsForm = new AttachedDocumentsForm(); documentsForm.setFormFieldFactory(new AttachedDocumentsFormFieldFactory()); fileTable = new Table(); fileTable.setWidth("500"); fileTable.setHeight("180"); fileTable.setSelectable(true); fileTable.setImmediate(true); fileTable.addContainerProperty( FactoryI18nManager.getI18nManager() .getMessage(Messages.ATTACHED_DOCUMENT_OBJECT_FILE_TABLE_HEADER_NAME), String.class, null); fileTable.addContainerProperty( FactoryI18nManager.getI18nManager() .getMessage(Messages.ATTACHED_DOCUMENT_OBJECT_FILE_TABLE_HEADER_SIZE), String.class, null); fileTable.addListener((ValueChangeListener) this); footerTable = new HorizontalLayout(); footerTable.setVisible(true); setIconsAndDescriptionButton(); footerTable.addComponent(buttonNew); footerTable.addComponent(buttonDelete); footerTable.addComponent(buttonModify); footerTable.addComponent(buttonDownload); footerTable.addComponent(buttonLookUp); verticalLayout.setMargin(true); verticalLayout.addComponent(documentsForm); verticalLayout.addComponent(new Label("Archivos:")); verticalLayout.addComponent(fileTable); verticalLayout.addComponent(footerTable); horizontalLayout.addComponent(buttonAdd); horizontalLayout.setComponentAlignment(buttonAdd, Alignment.BOTTOM_CENTER); horizontalLayout.addComponent(buttonCancel); horizontalLayout.setComponentAlignment(buttonCancel, Alignment.BOTTOM_CENTER); verticalLayout.addComponent(horizontalLayout); verticalLayout.setComponentAlignment(horizontalLayout, Alignment.BOTTOM_CENTER); setContent(verticalLayout); initializeForm(); initializeTable(); setComponentsState(isNewAttach); setClosable(readonly); }
protected void addTasks() { Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_TASKS)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_NO_LINE); panelLayout.addComponent(header); panelLayout.addComponent(new Label(" ", Label.CONTENT_XHTML)); Table taskTable = new Table(); taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST); taskTable.setWidth(100, UNITS_PERCENTAGE); // Fetch all tasks List<HistoricTaskInstance> tasks = historyService .createHistoricTaskInstanceQuery() .processInstanceId(processInstance.getId()) .orderByHistoricTaskInstanceEndTime() .desc() .orderByHistoricTaskInstanceStartTime() .desc() .list(); if (tasks.size() > 0) { // Finished icon taskTable.addContainerProperty( "finished", Component.class, null, "", null, Table.ALIGN_CENTER); taskTable.setColumnWidth("finished", 22); taskTable.addContainerProperty( "name", String.class, null, i18nManager.getMessage(Messages.TASK_NAME), null, Table.ALIGN_LEFT); taskTable.addContainerProperty( "priority", Integer.class, null, i18nManager.getMessage(Messages.TASK_PRIORITY), null, Table.ALIGN_LEFT); taskTable.addContainerProperty( "assignee", Component.class, null, i18nManager.getMessage(Messages.TASK_ASSIGNEE), null, Table.ALIGN_LEFT); taskTable.addContainerProperty( "dueDate", Component.class, null, i18nManager.getMessage(Messages.TASK_DUEDATE), null, Table.ALIGN_LEFT); taskTable.addContainerProperty( "startDate", Component.class, null, i18nManager.getMessage(Messages.TASK_CREATE_TIME), null, Table.ALIGN_LEFT); taskTable.addContainerProperty( "endDate", Component.class, null, i18nManager.getMessage(Messages.TASK_COMPLETE_TIME), null, Table.ALIGN_LEFT); panelLayout.addComponent(taskTable); panelLayout.setExpandRatio(taskTable, 1.0f); for (HistoricTaskInstance task : tasks) { addTaskItem(task, taskTable); } taskTable.setPageLength(taskTable.size()); } else { // No tasks Label noTaskLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_TASKS)); panelLayout.addComponent(noTaskLabel); } }
public void initUI() { try { setModal(true); VerticalLayout layout = (VerticalLayout) this.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName(Reindeer.LAYOUT_WHITE); processesComboBox = new ComboBox( ProcessbaseApplication.getCurrent().getPbMessages().getString("processToCategory")); processesComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); // processesComboBox.setItemCaptionPropertyId("name"); processesComboBox.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_EXPLICIT); processesComboBox.setWidth("100%"); bar.setWidth("100%"); bar.addComponent(processesComboBox); bar.setExpandRatio(processesComboBox, 1); addBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this); bar.addComponent(addBtn); bar.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT); layout.addComponent(bar); layout.addComponent(table); deleteBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDelete"), this); deleteBtn.setDescription( ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteCategory")); cancelBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("btnCancel"), this); saveBtn = new Button( ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSave"), this); buttons.addButton(deleteBtn); buttons.setComponentAlignment(deleteBtn, Alignment.MIDDLE_RIGHT); buttons.addButton(saveBtn); buttons.setComponentAlignment(saveBtn, Alignment.MIDDLE_RIGHT); buttons.setExpandRatio(saveBtn, 1); buttons.addButton(cancelBtn); buttons.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT); buttons.setMargin(false); buttons.setHeight("30px"); buttons.setWidth("100%"); addComponent(buttons); setWidth("70%"); // setHeight("70%"); setResizable(false); table.addContainerProperty( "name", String.class, null, ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionProcessName"), null, null); table.setColumnExpandRatio("name", 1); table.addContainerProperty( "version", String.class, null, ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionVersion"), null, null); table.setColumnWidth("version", 50); table.addContainerProperty( "deployedBy", String.class, null, ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionDeployedBy"), null, null); table.addContainerProperty( "actions", TableLinkButton.class, null, ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionActions"), null, null); table.setColumnWidth("actions", 50); table.setSelectable(false); table.setImmediate(true); table.setWidth("100%"); table.setPageLength(10); refreshTable(); } catch (Exception ex) { ex.printStackTrace(); showError(ex.getMessage()); } }
private void doLayout(TestExerExerciseData oldData) { this.setMargin(true); this.setSpacing(true); this.setWidth("100%"); String oldQuestion; if (oldData != null) { oldQuestion = oldData.getQuestion(); } else { oldQuestion = ""; } String oldStartYear; if (oldData != null) { oldStartYear = Integer.toString(oldData.getStartYear()); } else { oldStartYear = "1900"; } String oldEndYear; if (oldData != null) { oldEndYear = Integer.toString(oldData.getEndYear()); } else { oldEndYear = "2000"; } String oldResolution; if (oldData != null) { oldResolution = Integer.toString(oldData.getResolution()); } else { oldResolution = "1"; } VerticalLayout controlsLayout = new VerticalLayout(); controlsLayout.setWidth("400px"); controlsLayout.addComponent(editorHelper.getInfoEditorView()); controlsLayout.addComponent( editorHelper.getControlbar( new EditedExerciseGiver<TestExerExerciseData>() { @Override public TestExerExerciseData getCurrExerData(boolean forSaving) { return getCurrentExercise(); } })); this.addComponent(controlsLayout); VerticalLayout editlayout = new VerticalLayout(); Label questionTextCapt = new Label(localizer.getUIText(TestExerUiConstants.QUESTION)); questionTextCapt.addStyleName(TestExerThemeConsts.TITLE_STYLE); editlayout.addComponent(questionTextCapt); questionText = new TextField(null, oldQuestion); editlayout.addComponent(questionText); eventStartYear = new TextField("Tapahtumien alkuvuosi", oldStartYear); editlayout.addComponent(eventStartYear); eventEndYear = new TextField("Tapahtumien loppuvuosi", oldEndYear); editlayout.addComponent(eventEndYear); eventResolution = new TextField("Tapahtumien tarkkuus", oldResolution); editlayout.addComponent(eventResolution); this.addComponent(editlayout); eventTable.setEditable(true); eventTable.addContainerProperty("Tapahtuma", String.class, null); eventTable.addContainerProperty("Vuosi", String.class, null); if (oldData != null) { ArrayList<String> eList = oldData.getEventList(); ArrayList<Integer> aList = oldData.getAnswerList(); for (int i = 0; i < eList.size(); i++) { String eName = eList.get(i); Integer aName = aList.get(i); if (eName == null) eName = ""; if (aName == null) aName = 0; eventTable.addItem(new Object[] {eName, Integer.toString(aName)}, new Integer(i)); } for (int i = eList.size(); i < maxEvents; i++) { eventTable.addItem(new Object[] {"", ""}, new Integer(i)); } } else { for (int i = 0; i < maxEvents; i++) { eventTable.addItem(new Object[] {"", ""}, new Integer(i)); } } this.addComponent(eventTable); }
@Override protected void setup() { HorizontalLayout h = new HorizontalLayout(); addComponent(h); Table table = new Table(); table.addContainerProperty("Column 1", String.class, "Row"); table.setDragMode(TableDragMode.ROW); table.addItem("Row 1"); table.addItem("Row 2"); table.addItem("Row 3"); table.addItem("Row 4"); table.addItem("Row 5"); table.addItem("Row 6"); table.addItem("Row 7"); h.addComponent(table); final Tree tree = new Tree(); tree.setDropHandler( new DropHandler() { public AcceptCriterion getAcceptCriterion() { return TargetItemAllowsChildren.get(); } public void drop(DragAndDropEvent dropEvent) { // criteria verify that this is safe DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable(); Container sourceContainer = t.getSourceContainer(); Object sourceItemId = t.getItemId(); System.out.println(sourceItemId); AbstractSelectTargetDetails dropData = ((AbstractSelectTargetDetails) dropEvent.getTargetDetails()); Object targetItemId = dropData.getItemIdOver(); // move item from table to category' tree.addItem(sourceItemId); tree.setParent(sourceItemId, targetItemId); tree.setChildrenAllowed(sourceItemId, false); sourceContainer.removeItem(sourceItemId); } }); tree.addItem("Item 1"); tree.addItem("Item 11"); tree.setChildrenAllowed("Item 11", false); tree.setParent("Item 11", "Item 1"); tree.addItem("Item 12"); tree.setChildrenAllowed("Item 12", false); tree.setParent("Item 12", "Item 1"); tree.addItem("Item 13"); tree.setChildrenAllowed("Item 13", false); tree.setParent("Item 13", "Item 1"); tree.addItem("Item 2"); tree.addItem("Item 21"); tree.setChildrenAllowed("Item 21", false); tree.setParent("Item 21", "Item 2"); tree.addItem("Item 22"); tree.setChildrenAllowed("Item 22", false); tree.setParent("Item 22", "Item 2"); tree.addItem("Item 23"); tree.setChildrenAllowed("Item 23", false); tree.setParent("Item 23", "Item 2"); tree.addItem("Item 3"); tree.addItem("Item 31"); tree.setChildrenAllowed("Item 31", false); tree.setParent("Item 31", "Item 3"); tree.addItem("Item 32"); tree.setChildrenAllowed("Item 32", false); tree.setParent("Item 32", "Item 3"); tree.addItem("Item 33"); tree.setChildrenAllowed("Item 33", false); tree.setParent("Item 33", "Item 3"); tree.expandItemsRecursively("Item 1"); tree.expandItemsRecursively("Item 2"); tree.expandItemsRecursively("Item 3"); h.addComponent(tree); }