public void menuSelected(MenuItem selectedItem) { if (selectedItem.getText().equals("Cadastrar")) { SsamUsuario U = new SsamUsuario(); Window mainWindow3 = new Window("Cadastrar"); // System.out.println("PARENT " + getWindow().getParent()); mainWindow3.setWidth(1500, Window.UNITS_PIXELS); mainWindow3.setHeight(1500, Window.UNITS_PIXELS); mainWindow3.addComponent(U); getWindow().getParent().addWindow(mainWindow3); } else if (selectedItem.getText().equals("Consultar")) { SsamConsulta U; try { U = new SsamConsulta(verificaTpUsuario(Logou)); Window mainWindow3 = new Window("Consultar"); // System.out.println("PARENT " + getWindow().getParent()); mainWindow3.setWidth(1200, Window.UNITS_PIXELS); mainWindow3.setHeight(1000, Window.UNITS_PIXELS); mainWindow3.addComponent(U); getWindow().getParent().addWindow(mainWindow3); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if (selectedItem.getText().equals("Seleção")) { SsamSelecao S; SelecaoDao aprovados = new SelecaoDao(); try { S = new SsamSelecao(aprovados.calcula(), aprovados.getNome()); Window mainWindow3 = new Window("Seleção"); mainWindow3.setWidth(1200, Window.UNITS_PIXELS); mainWindow3.setHeight(1000, Window.UNITS_PIXELS); mainWindow3.addComponent(S); getWindow().getParent().addWindow(mainWindow3); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } ///// //Colocar na tela SSamSelecao } else if (selectedItem.getText().equals("Alterar Senha")) { SsamAlterarSenha U = new SsamAlterarSenha(); Window mainWindow3 = new Window("Alterar Senha"); // System.out.println("PARENT " + getWindow().getParent()); mainWindow3.setWidth(400, Window.UNITS_PIXELS); mainWindow3.setHeight(300, Window.UNITS_PIXELS); mainWindow3.addComponent(U); getWindow().getParent().addWindow(mainWindow3); } }
public void showWindowForm() { itemDetilModel = new PerubahanHargaItemModel(); itemDetilView = new PerubahanHargaItemView(itemDetilModel); itemDetilPresenter = new PerubahanHargaItemPresenter(itemDetilModel, itemDetilView); itemDetilView.setSizeFull(); panelFormDetil.setContent(itemDetilView); windowForm = new Window(); windowForm.setModal(true); windowForm.center(); windowForm.setWidth("650px"); windowForm.setHeight("300px"); windowForm.setClosable(true); windowForm.setResizable(false); VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSizeFull(); content.addComponent(panelFormDetil); windowForm.setContent(content); getUI().addWindow(windowForm); }
public void setComponentValue(final String name, final Object object) { super.setComponentValue(name, object); if (name.equals("title")) { dialog.setCaption((String) object); } if ("icon".equals(name)) { dialog.setIcon(getResource(object)); } if ("h".equals(name)) { dialog.setHeight("" + object + "px"); } if ("w".equals(name)) { dialog.setWidth("" + object + "px"); } if ("x".equals(name)) { dialog.setPositionX((Integer) object); } if ("y".equals(name)) { dialog.setPositionY((Integer) object); } if ("closable".equals(name)) { dialog.setClosable((Boolean) object); } if ("resizable".equals(name)) { dialog.setResizable((Boolean) object); } }
/** 增加 编辑 删除窗体初始化 * */ private void createWindow(Item item) { Window window = new Window(); window.setHeight(250, Unit.PIXELS); window.setWidth(300, Unit.PIXELS); window.setModal(true); window.setContent(createForm(item, window)); window.close(); getUI().addWindow(window); }
@Override protected void setup(VaadinRequest request) { Window def = new Window("default", new Label("Some content")); def.setWidth("300px"); def.setHeight("100%"); addWindow(def); Window light = new Window("WINDOW_LIGHT", new Label("Some content")); light.setStyleName(Reindeer.WINDOW_LIGHT); light.setPositionX(300); light.setWidth("300px"); light.setHeight("100%"); addWindow(light); Window black = new Window("WINDOW_BLACK", new Label("Some content")); black.setStyleName(Reindeer.WINDOW_BLACK); black.setPositionX(600); black.setWidth("300px"); black.setHeight("100%"); addWindow(black); }
@Override protected void setup(VaadinRequest request) { Window w = new Window(); w.setId(WINDOW_ID); w.setWidth("300px"); w.setHeight("300px"); w.center(); VerticalLayout content = new VerticalLayout(); w.setContent(content); content.setHeight("1000px"); ComboBox<String> cb = new ComboBox<>(); cb.setId(COMBOBOX_ID); content.addComponent(cb); content.setComponentAlignment(cb, Alignment.BOTTOM_CENTER); addWindow(w); }
private void cargarWindowRegistroPolicia() { pnlMantenPolicia = new PanelMantenPolicia(new ArrayList<Opcion>(), "400px"); pnlMantenPolicia.setParent(this.getParent()); Window window = new Window() { private static final long serialVersionUID = 1L; protected void close() { getApplication().getMainWindow().removeWindow(getWindow()); } }; window.setCaption("Registrar Policia"); window.addComponent(pnlMantenPolicia); window.setModal(true); window.setResizable(false); window.setWidth("1000px"); window.setHeight("-1px"); getWindow().addWindow(window); }
private void showNonMobileNotification() { try { URL appUrl = Page.getCurrent().getLocation().toURL(); String myIp = Inet4Address.getLocalHost().getHostAddress(); final String qrCodeUrl = appUrl.toString().replaceAll("localhost", myIp); Label info = new Label( "You appear to be running this demo on a non-portable device. " + "Parking is intended for touch devices primarily. " + "Please read the QR code on your touch device to access the demo."); info.setWidth("310px"); Image qrCode = new Image(); qrCode.addStyleName("qrcode-image"); StreamResource resource = new StreamResource( new StreamSource() { @Override public InputStream getStream() { InputStream result = null; try { final Map<EncodeHintType, ErrorCorrectionLevel> hintMap = Maps.newHashMap(); hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); final QRCodeWriter qrCodeWriter = new QRCodeWriter(); final BitMatrix byteMatrix = qrCodeWriter.encode(qrCodeUrl, BarcodeFormat.QR_CODE, 150, 150, hintMap); final int width = byteMatrix.getWidth(); final BufferedImage image = new BufferedImage(width, width, BufferedImage.TYPE_INT_RGB); image.createGraphics(); final Graphics2D graphics = (Graphics2D) image.getGraphics(); graphics.setColor(Color.WHITE); graphics.fillRect(0, 0, width, width); graphics.setColor(Color.BLACK); for (int i = 0; i < width; i++) { for (int j = 0; j < width; j++) { if (byteMatrix.get(i, j)) { graphics.fillRect(i, j, 1, 1); } } } final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ImageIO.write(image, "png", baos); } catch (final IOException e) { e.printStackTrace(); } result = new ByteArrayInputStream(baos.toByteArray()); } catch (WriterException e) { e.printStackTrace(); } return result; } }, "qrcode-" + new Date().getTime() + ".png"); resource.setCacheTime(0); qrCode.setSource(resource); CssLayout qrCodeLayout = new CssLayout(qrCode, info); qrCodeLayout.setSizeFull(); Window window = new Window(null, qrCodeLayout); window.setWidth(500.0f, Unit.PIXELS); window.setHeight(200.0f, Unit.PIXELS); window.addStyleName("qr-code"); window.setModal(true); window.setResizable(false); window.setDraggable(false); addWindow(window); window.center(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); } }
protected void execute(TipiEvent event) throws TipiBreakException, TipiException { Operand value = getEvaluatedParameter("property", event); if (value == null) { throw new TipiException("TipiBrowseBinary: no value supplied"); } if (value.value == null) { throw new TipiException("TipiBrowseBinary: null value supplied"); } if (!(value.value instanceof Property)) { throw new TipiException( "TipiOpenBinary: Type of value is not Property, but: " + value.value.getClass()); } final Property pp = (Property) value.value; if (!pp.getType().equals(Property.BINARY_PROPERTY)) { throw new TipiException("TipiOpenBinary: Property is not type binary , but: " + pp.getType()); } final Window w = new Window("Upload binary"); w.setModal(true); w.setClosable(true); w.setWidth(320, Sizeable.UNITS_PIXELS); w.setHeight(70, Sizeable.UNITS_PIXELS); Upload u = new Upload( "", new Upload.Receiver() { private static final long serialVersionUID = 1L; @Override public OutputStream receiveUpload(String filename, String mimeType) { outputBinary = new Binary(); return outputBinary.getOutputStream(); } }); u.addListener( new Upload.SucceededListener() { private static final long serialVersionUID = 8118852698370774496L; @Override public void uploadSucceeded(SucceededEvent event) { try { pp.setAnyValue(outputBinary); getApplication().getMainWindow().removeWindow(w); continueAction(getEvent()); } catch (TipiBreakException e) { } catch (TipiSuspendException e) { } catch (TipiException e) { e.printStackTrace(); } } }); u.addListener( new Upload.FailedListener() { private static final long serialVersionUID = 4791549173755572186L; @Override public void uploadFailed(FailedEvent event) { System.err.println("Upload failed?"); throw new TipiBreakException(); } }); w.addComponent(u); getApplication().getMainWindow().addWindow(w); suspend(); }
@Override public void execute() { List<ChangeRecord> historyList = view.getUi().getStockService().findChanges(good); Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("650px"); subWindow.setWidth("700px"); subWindow.setClosable(true); view.getUi().addWindow(subWindow); final Button pdfButton = new Button(bundle.getString("pdf.export")); pdfButton.setIcon(new ThemeResource("img/pdf.png")); pdfButton.setWidth("150"); StreamResource pdfStream = getPDFStream(view.getUi().getStockService().findChanges(good)); pdfStream.setMIMEType("application/pdf"); FileDownloader pdfDownloader = new FileDownloader(pdfStream); pdfDownloader.extend(pdfButton); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(pdfButton); for (ChangeRecord record : historyList) { for (ChangeRecord.PropertyChange p : record.getChangeList()) { p.setName(bundle.getString(p.getName())); } Panel panel = new Panel(); BeanItemContainer<ChangeRecord.PropertyChange> container = new BeanItemContainer<>(ChangeRecord.PropertyChange.class, record.getChangeList()); Table table = new Table(); table.setContainerDataSource(container); table.setVisibleColumns("name", "oldValue", "newValue"); table.setColumnHeaders( bundle.getString("history.property"), bundle.getString("history.old"), bundle.getString("history.new")); table.setColumnExpandRatio("name", 0.33f); table.setColumnExpandRatio("oldValue", 0.33f); table.setColumnExpandRatio("newValue", 0.33f); table.setPageLength(0); table.setWidth("100%"); VerticalLayout panelLayout = new VerticalLayout(); panelLayout.addComponent( new Label( "<b>" + new SimpleDateFormat("dd-MM-YYYY HH:mm").format(record.getDate()) + ": " + record.getUser().getName() + " " + record.getUser().getSurname() + "</b><br/>", ContentMode.HTML)); panelLayout.addComponent(table); panel.setContent(panelLayout); layout.addComponent(panel); } subWindow.setContent(layout); }