List of usage examples for com.vaadin.ui Upload addListener
@Override
public Registration addListener(Component.Listener listener)
From source file:ru.codeinside.adm.ui.employee.EmployeeWidget.java
License:Mozilla Public License
public EmployeeWidget(boolean lockedFilterValue, TreeTable table) { this.table = table; Upload upload = new Upload(); upload.setImmediate(false);//from ww w . j a v a 2 s. co m upload.setButtonCaption(" "); upload.setReceiver(this); upload.addListener(this); /* Panel panel1 = new Panel(); Button button = new Button("??? ", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { URL url = new URL(getApplication().getURL(), "/registry/structures"); loadEmployeeData(url.openStream()); } catch (MalformedURLException e) { getWindow().showNotification(" " + e.getMessage()); } catch (IOException e) { getWindow().showNotification(" " + e.getMessage()); } } }); panel1.addComponent(button);*/ tableEmployee = new TableAllEmployee(lockedFilterValue); tableEmployee.setSizeFull(); HorizontalLayout hr = new HorizontalLayout(); hr.setSizeFull(); hr.setHeight("70px"); hr.setSpacing(true); hr.setMargin(true); hr.addComponent(upload); addComponent(hr); addComponent(tableEmployee); tableEmployee.addButtonToLayout(hr); setExpandRatio(hr, 0.01f); setExpandRatio(tableEmployee, 0.99f); setSizeFull(); }
From source file:ru.codeinside.gses.webui.manager.DirectoryPanel.java
License:Mozilla Public License
static Component createDirectoryPanel() { HorizontalSplitPanel horSplit = new HorizontalSplitPanel(); horSplit.setSizeFull();//from www. java 2 s . c o m horSplit.setMargin(true); Panel panel00 = new Panel(); Panel panel01 = new Panel(); Panel panel10 = new Panel(); horSplit.setFirstComponent(panel00); VerticalLayout vl = new VerticalLayout(); horSplit.setSecondComponent(vl); vl.addComponent(panel01); vl.addComponent(panel10); vl.setSpacing(true); horSplit.setWidth("100%"); vl.setHeight("100%"); panel00.setHeight("100%"); panel00.setWidth("100%"); panel01.setWidth("100%"); panel01.setHeight("100%"); panel10.setHeight("100%"); horSplit.setSplitPosition(35); vl.setExpandRatio(panel01, 0.25f); vl.setExpandRatio(panel10, 0.75f); final Table dirMapTable = ManagerWorkplace.createDirectoryMapTable(); final FilterTable directoryTable = ManagerWorkplace.createDirectoryTable(); dirMapTable.setVisible(false); final Form createFieldForm = new Form(); createFieldForm.setCaption(" ? ?"); final TextField keyField = new TextField(""); keyField.setRequired(true); keyField.setMaxLength(254); createFieldForm.addField("key", keyField); final TextField valField = new TextField(""); valField.setRequired(true); valField.setMaxLength(1022); createFieldForm.addField("val", valField); createFieldForm.setVisible(false); Button addButton = new Button("", new AddTupleButtonListener(createFieldForm, directoryTable, keyField, valField, dirMapTable)); createFieldForm.addField("submit", addButton); directoryTable.addListener(new DirectoryTableChangeListener(createFieldForm, directoryTable, dirMapTable)); ManagerWorkplace.buildContainer(directoryTable, createFieldForm, dirMapTable); directoryTable.setColumnHeaders(new String[] { "?", "", "" }); final Form createDirectory = new Form(); createDirectory.setCaption(" ?"); final TextField field = new TextField("?"); field.setRequired(true); field.setMaxLength(255); field.setRequiredError(" ?"); createDirectory.addField("name", field); Button createButton = new Button("", new CreateDirectoryButtonListener(field, createDirectory, directoryTable)); createDirectory.addField("submit", createButton); Panel loadPanel = new Panel(); loadPanel.setCaption(" ?"); UploadDirectory events = new UploadDirectory(directoryTable, dirMapTable); Upload c = new Upload("", events); c.addListener(events); c.setButtonCaption(""); loadPanel.addComponent(c); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeFull(); verticalLayout.setSpacing(true); verticalLayout.addComponent(loadPanel); verticalLayout.addComponent(createDirectory); verticalLayout.addComponent(directoryTable); panel00.addComponent(verticalLayout); panel01.addComponent(createFieldForm); dirMapTable.setSizeFull(); dirMapTable.setPageLength(13); panel10.addComponent(dirMapTable); return horSplit; }
From source file:ru.codeinside.gses.webui.manager.ServiceWidget.java
License:Mozilla Public License
public ServiceWidget(ApServiceTable c) { this.c = c;// w ww . ja va2s . co m Panel panel = new Panel(); Upload upload = new Upload(); upload.setImmediate(false); upload.setButtonCaption(""); upload.setReceiver(this); upload.addListener(this); panel.addComponent(upload); Panel panel1 = new Panel(); Button button = new Button("??? ", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { URL url; try { url = new URL( "http://" + getApplication().getURL().getHost() + "/registry-1.0-SNAPSHOT/services"); loadServiceData(url.openStream()); } catch (MalformedURLException e) { System.out.println(e); } catch (IOException e) { System.out.println(e); } } }); panel1.addComponent(button); this.setSpacing(true); this.addComponent(panel); }