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);
  }
Exemplo n.º 2
0
 private void tambahUserYayasanbaru(UserOprYayasan i) {
   final Window win = new Window("Tambah User Baru");
   Component c = new TambahUserYayasan(i, win);
   VerticalLayout vl = new VerticalLayout();
   vl.setMargin(true);
   vl.addComponent(c);
   win.setContent(vl);
   win.setModal(true);
   win.setWidth("600px");
   win.center();
   UI.getCurrent().addWindow(win);
 }
 @Override
 public void showThreadMovePopup(
     final long threadId, final Long threadCategoryId, final List<Category> allCategories) {
   final Window window =
       new ThreadMoveComponent(
           threadId,
           threadCategoryId,
           allCategories,
           new ThreadMoveComponentListener() {
             @Override
             public void commit(final long threadId, final Long newCategoryId) {
               threadListing.removeThreadRow(threadId);
               getPresenter().move(threadId, newCategoryId);
             }
           });
   window.center();
   getUI().addWindow(window);
 }
Exemplo n.º 4
0
  @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);
  }
Exemplo n.º 5
0
  public Login() {
    // TODO Auto-generated constructor stub
    VaadinSession.getCurrent().setAttribute("municipaldata", null);
    VaadinSession.getCurrent().setAttribute("barangaydata", null);
    VaadinSession.getCurrent().setAttribute("id", null);
    setSizeFull();
    dialog = new Window("Login");
    dialog.setClosable(false);
    dialog.setResizable(false);
    dialog.center();

    //		new CreateAccount();

    VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(new MarginInfo(false, true, true, true));
    dialog.setContent(content);

    Label title = new Label("Login");
    title.addStyleName(ValoTheme.LABEL_H2);
    title.addStyleName(ValoTheme.LABEL_COLORED);

    HorizontalLayout form = new HorizontalLayout();
    form.setSpacing(true);
    form.addStyleName("wrapping");
    content.addComponent(form);

    username.setIcon(FontAwesome.USER);
    username.focus();
    form.addComponent(username);

    password.setIcon(FontAwesome.LOCK);
    form.addComponent(password);

    Button submit = new Button("Login");
    submit.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT);
    submit.addStyleName(ValoTheme.BUTTON_PRIMARY);
    submit.setIcon(FontAwesome.ARROW_RIGHT);
    submit.setWidth("100%");
    submit.addListener(ClickEvent.class, this, "gotoMain");
    content.addComponent(submit);
  }
Exemplo n.º 6
0
  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();
    }
  }
Exemplo n.º 7
0
  /* Initializes a modal window to edit schedule event. */
  private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton =
        new Button(
            "Apply",
            new ClickListener() {

              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                try {
                  commitCalendarEvent();
                } catch (CommitException | ValidationException e) {
                  e.printStackTrace();
                }
              }
            });
    Button cancel =
        new Button(
            "Cancel",
            new ClickListener() {

              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                discardCalendarEvent();
              }
            });
    deleteEventButton =
        new Button(
            "Delete",
            new ClickListener() {

              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                deleteCalendarEvent();
              }
            });
    scheduleEventPopup.addCloseListener(
        new Window.CloseListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
          }
        });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
  }