Ejemplo n.º 1
0
  public void buttonClick(ClickEvent event) {
    try {
      if (event.getButton().equals(saveBtn)) {
        save();
        close();
      } else if (event.getButton().equals(addBtn)) {
        LightProcessDefinition lpd = (LightProcessDefinition) processesComboBox.getValue();
        addTableRow(lpd);
        processesComboBox.removeItem(lpd);
      } else if (event.getButton().equals(deleteBtn)) {
        delete();
        close();
      } else if (event.getButton() instanceof TableLinkButton) {
        LightProcessDefinition lpd =
            (LightProcessDefinition) ((TableLinkButton) event.getButton()).getTableValue();
        table.removeItem(lpd);
        processesComboBox.addItem(lpd);
        processesComboBox.setItemCaption(
            lpd, lpd.getLabel() + " (version " + lpd.getVersion() + ")");
      } else {
        close();
      }

    } catch (Exception ex) {
      ex.printStackTrace();
      showError(ex.getMessage());
    }
  }
Ejemplo n.º 2
0
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getButton() == bf) {
     getCurWindow().bringToFront();
   } else if (event.getButton() == toggleModality) {
     getCurWindow().setModal(!getCurWindow().isModal());
   }
 }
Ejemplo n.º 3
0
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getButton().getData().equals(BUTTON_UP)) {
     setSelectedItem(nextOptionAbove.getInputPrompt());
   } else if (event.getButton().getData().equals(BUTTON_DOWN)) {
     setSelectedItem(nextOptionBelow.getInputPrompt());
   }
 }
Ejemplo n.º 4
0
 private void addPinClickListener(final ClickEvent event) {
   eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
   checkifAlreadyPinned(event.getButton());
   if (isDistPinned) {
     pinDitribution(event.getButton());
   } else {
     unPinDistribution(event.getButton());
   }
 }
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getButton() == buttonCancel) {
     listener.cancelClick(ReportType.EXPIRED_GOODS);
   }
   if (event.getButton() == buttonShow) {
     listener.showClick(ReportType.EXPIRED_GOODS, getReportData());
   }
 }
Ejemplo n.º 6
0
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getButton().equals(getUi().getBtnNew())) {
     handleNewButtonClicked();
   } else if (event.getButton().equals(getUi().getBtnDelete())) {
     handleDeleteButtonClicked();
   } else if (event.getButton().equals(getUi().getBtnSave())) {
     handleSaveButtonClicked();
   }
 }
Ejemplo n.º 7
0
  @Override
  public void buttonClick(ClickEvent event) {
    if (event.getButton() == this.btn_eliminar) {

      ConfirmDialog.show(getUI(), "", Messages.CONFIRM_DELETE_MESSAGE, "SI", "NO", this);
    }
    if (event.getButton() == this.btn_limpiar) {
      this.frm_organismo.update();
    }
  }
Ejemplo n.º 8
0
  @Override
  public void buttonClick(ClickEvent event) {
    if (event.getButton().equals(btnCrearUsuario)) {
      Usuario object = new Usuario();
      object.setUsuario(txtUsuario.getValue().toString());
      object.setNombres(txtNombres.getValue().toString());
      object.setApePat(txtApellidoPaterno.getValue().toString());
      object.setApeMat(txtApellidoMaterno.getValue().toString());

      object.setRol((Rol) cmbRol.getValue());
      object.setCargo(
          txtCargo.getValue() != null ? txtCargo.getValue().toString() : StringUtils.EMPTY);
      object.setDescCargo(
          txtCargoDescripcion.getValue() != null
              ? txtCargoDescripcion.getValue().toString()
              : StringUtils.EMPTY);
      object.setOficina((Dependencia) cmbOficina.getValue());
      object.setPolicia((Policia) cmbPolicia.getValue());

      if (flagNuevoUsuario) {
        String randomPassword = RandomUtil.createWord(8);
        object.setClave(randomPassword);
        usuarioService.crear(object);
      } else {
        object.setClave(clave);
        Item item = tblUsuarios.getItem(tblUsuarios.getValue());
        object.setId((Long) item.getItemProperty("id").getValue());
        usuarioService.actualizar(object);
      }
      refrescar();
    } else if (event.getButton().equals(btnEliminarUsuario)) {
      ConfirmDialog.show(
          getApplication().getMainWindow(),
          "¿Seguro de Eliminar el Registro?",
          new ConfirmDialog.Listener() {
            private static final long serialVersionUID = 1L;

            public void onClose(ConfirmDialog dialog) {
              if (dialog.isConfirmed()) {
                Item item = tblUsuarios.getItem(tblUsuarios.getValue());
                usuarioService.eliminarXId((Long) item.getItemProperty("id").getValue());
                refrescar();
              }
            }
          });
    } else if (event.getButton().equals(btnAgregarPolicia)) {
      cargarWindowRegistroPolicia();
    }
  }
 public void buttonClick(ClickEvent event) {
   Button source = event.getButton();
   if (source.equals(reloadButton)) {
     Enrollment enrollmentSelected =
         editSanctionActsSubWindow.getLoadSanctionActList().getEnrollmentSelected();
   }
 }
Ejemplo n.º 10
0
  private void onDelete(final ClickEvent event) {
    /* Display the confirmation */
    final ConfirmationDialog confirmDialog =
        new ConfirmationDialog(
            i18n.get("caption.filter.delete.confirmbox"),
            i18n.get("message.delete.filter.confirm"),
            i18n.get("button.ok"),
            i18n.get("button.cancel"),
            ok -> {
              if (ok) {
                final Long rowId = (Long) ((Button) event.getComponent()).getData();
                final String deletedFilterName =
                    targetFilterQueryManagement.findTargetFilterQueryById(rowId).getName();
                targetFilterQueryManagement.deleteTargetFilterQuery(rowId);

                /*
                 * Refresh the custom filter table to show latest change
                 * of the deleted custom filter.
                 */

                notification.displaySuccess(
                    i18n.get("message.delete.filter.success", new Object[] {deletedFilterName}));
                refreshContainer();
              }
            });
    UI.getCurrent().addWindow(confirmDialog.getWindow());
    confirmDialog.getWindow().bringToFront();
  }
Ejemplo n.º 11
0
      @Override
      public void step1() {
        txt = content.getValue().toString();
        txt = txt.trim();
        if (txt.length() < 5) {
          Notification.show(
              "Card not played.",
              "Your message is too short to be useful.",
              Notification.Type.ERROR_MESSAGE);
          doNotAdvanceSteps(); // come into step1 again next time
          return;
        }
        if (txt.length() > 140) {
          Notification.show(
              "Card not played.", "Only 140 characters please.", Notification.Type.ERROR_MESSAGE);
          doNotAdvanceSteps(); // come into step1 again next time
          return;
        }

        // Admins get to add cards under other names
        author = Mmowgli2UI.getGlobals().getUserTL();
        if (author.isAdministrator()) adminSwitchAuthorsTL(event.getButton(), this);
        else run(); // does not need to suspend, so "continues" and executes step2
        // in the same clicklistener thread
      }
  @Override
  public void buttonClick(ClickEvent event) {
    if (event.getButton().equals(btnGuardar)) {
      Notificacion notificacion = new Notificacion();
      notificacion.setInforme(informe);
      notificacion.setUnidad((Dependencia) cmbUnidadProcuraduria.getValue());
      notificacion.setTipoNotificacion(cmbTipoNotificacion.getValor());
      notificacion.setFechaRecepcion((Date) dtFechaRecepcion.getValue());
      notificacion.setFechaVencimiento((Date) dtFechaVencimiento.getValue());
      notificacion.setFechaPlazo((Date) dtFechaPlazo.getValue());
      notificacion.setEstado(cmbEstadoNotificacion.getValor());

      AlertDialog alertDialog = null;
      if (notificacion.esNuevo()) {
        notificacionService.crear(notificacion);
        alertDialog =
            new AlertDialog(
                "Registro de Notificación",
                "Se ha registrado la notificación correctamente",
                "Aceptar",
                "400");
      } else {
        notificacionService.actualizar(notificacion);
        alertDialog =
            new AlertDialog(
                "Registro de Notificación",
                "Se ha actualizado la notificación correctamente",
                "Aceptar",
                "400");
      }
      getApplication().getMainWindow().addWindow(alertDialog);
      limpiar();
      cargarDatos();
    }
  }
 @Override
 public void buttonClick(ClickEvent event) {
   Button b = event.getButton();
   if (b == saveButton) {
     if (isValid()) {
       if (!(newEmail.getValue().equals(""))) {
         if (!GeneralController.checkUserEmail(userName, String.valueOf(newEmail))) {
           GeneralController.setNewEmail(userName, String.valueOf(newEmail));
           getWindow()
               .showNotification(
                   "Изменение электронной почты юзера завершено успешно! ",
                   Window.Notification.TYPE_TRAY_NOTIFICATION);
           refrachTextField();
           refreshLable();
         } else {
           getWindow()
               .showNotification(
                   "У Вас уже такой email - "
                       + newEmail.toString().trim()
                       + ". "
                       + "Введите пожалуйста другой.",
                   Window.Notification.TYPE_TRAY_NOTIFICATION);
         }
       } else {
         getWindow()
             .showNotification(
                 "Введите имейл для изменения", Window.Notification.TYPE_TRAY_NOTIFICATION);
       }
     }
   } else if (b == resetUserPasswordButton) {
     resetUserPasswordWindow = new ResetUserPasswordWindow(this, userName);
     getWindow().addWindow(resetUserPasswordWindow);
   }
 }
 @Override
 public void buttonClick(ClickEvent event) {
   Button b = event.getButton();
   if (b == addButton) {
     select(getNullSelectionItemId());
     addNewRow();
   }
 }
Ejemplo n.º 15
0
 private void resizeWindow(final ClickEvent event) {
   if (FontAwesome.EXPAND.equals(event.getButton().getIcon())) {
     event.getButton().setIcon(FontAwesome.COMPRESS);
     setWindowMode(WindowMode.MAXIMIZED);
     resetColumnWidth();
     grid.getColumn(STATUS).setExpandRatio(0);
     grid.getColumn(PROGRESS).setExpandRatio(1);
     grid.getColumn(FILE_NAME).setExpandRatio(2);
     grid.getColumn(REASON).setExpandRatio(3);
     grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setExpandRatio(4);
     mainLayout.setSizeFull();
   } else {
     event.getButton().setIcon(FontAwesome.EXPAND);
     setWindowMode(WindowMode.NORMAL);
     setColumnWidth();
     setPopupSizeInMinMode();
   }
 }
Ejemplo n.º 16
0
 private void onClickOfDetailButton(final ClickEvent event) {
   final String targetFilterName = (String) ((Button) event.getComponent()).getData();
   final TargetFilterQuery targetFilterQuery =
       targetFilterQueryManagement.findTargetFilterQueryByName(targetFilterName);
   filterManagementUIState.setFilterQueryValue(targetFilterQuery.getQuery());
   filterManagementUIState.setTfQuery(targetFilterQuery);
   filterManagementUIState.setEditViewDisplayed(true);
   eventBus.publish(this, CustomFilterUIEvent.TARGET_FILTER_DETAIL_VIEW);
 }
Ejemplo n.º 17
0
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getButton() == this.btn_agregar) {
     if (this.frm_unidad.validate()) {
       this.unidad_impl.add(this.frm_unidad.getData());
       grid_unidad.update();
       this.frm_unidad.update();
       this.frm_unidad.updateId();
       Notification.show(Messages.SUCCESS_MESSAGE);
     } else {
       Notification.show(Messages.NOT_SUCCESS_MESSAGE, Type.ERROR_MESSAGE);
     }
     buildMessages(this.frm_unidad.getMensajes());
     this.frm_unidad.clearMessages();
   }
   if (event.getButton() == this.btn_limpiar) {
     this.frm_unidad.update();
     this.frm_unidad.updateId();
   }
 }
  public void buttonClick(ClickEvent event) {
    Button source = event.getButton();
    dirty = false;
    if (source == buttonAdd) {
      if (this.documentsForm.isModified()) {
        if (!this.documentsForm.isValid()) {
          getWindow()
              .showNotification(
                  FactoryI18nManager.getI18nManager().getMessage(Messages.DIALOG_INCORRECT_DATA),
                  Notification.TYPE_ERROR_MESSAGE);
          return;
        }
        if (!isValid()) {
          getWindow()
              .showNotification(
                  FactoryI18nManager.getI18nManager()
                      .getMessage(Messages.DIALOG_VALIDATOR_DOCUMENT_EMPTY),
                  Notification.TYPE_ERROR_MESSAGE);
          return;
        }

        dirty = true;

        this.documentsForm.commit();
      }
      close();
    } else if (source == buttonCancel) {
      dirty = true;
      cancel();
      close();
    } else if (source == buttonNew) {
      DocumentObject d = DocumentObjectFactory.getInstance();
      BeanItem<DocumentObject> newBeanItem = new BeanItem<DocumentObject>(d);
      isNewItem = true;
      openForm(newBeanItem, readonly, true, context);
    } else if (source == buttonDelete) {
      deleteItem();
    } else if (source == buttonModify) {
      if (currentFile != null) {
        BeanItem<DocumentObject> newBeanItem = new BeanItem<DocumentObject>(currentFile);
        isNewItem = false;
        openForm(newBeanItem, readonly, false, context);
      }
    } else if (source == buttonLookUp) {
      if (currentFile != null) {
        BeanItem<DocumentObject> newBeanItem = new BeanItem<DocumentObject>(currentFile);
        isNewItem = false;
        openForm(newBeanItem, true, false, context); // readonly puede ser true o false
      }
    } else if (source == buttonDownload) {
      download();
    }
  }
  @Override
  public void buttonClick(ClickEvent event) {

    /* This method in class should be public
     * private boolean isViewBeanNameValidForCurrentUI(String beanName)
     *
     *  workaround
     *
     *  This should be implemented in custom Navigator class.
     */
    if (springViewProvider.getView((String) event.getButton().getData()) == null) {
      /*
       * For this demo, notify user that has no access.
       * Easily, this can be modified to hide adminLink
       */
      // notify user
      Notification.show("Access is alowed only for admin users.", Type.ERROR_MESSAGE);
    } else {
      UI.getCurrent().getNavigator().navigateTo((String) event.getButton().getData());
    }
  }
Ejemplo n.º 20
0
  @Override
  public void buttonClick(ClickEvent event) {
    btFirst.setEnabled(true);
    btLast.setEnabled(true);
    btNext.setEnabled(true);
    btPrevious.setEnabled(true);

    if (event.getButton() == btFirst) {
      currentPage = 1;
    } else if (event.getButton() == btLast) {
      currentPage = getMaxPage();
    } else if (event.getButton() == btNext) {
      currentPage++;
    } else if (event.getButton() == btPrevious) {
      currentPage--;
    }

    // sanitize
    currentPage = sanitizePage(currentPage);

    update(true);
  }
Ejemplo n.º 21
0
  @Override
  public void buttonClick(ClickEvent event) {
    switch ((Integer) event.getButton().getData()) {
      case ADD_NEW_CATEGORY:
        try {
          catFrm.commit();
          if (catFrm.isValid()) {
            accSvc.addNewPaymentCategory(
                (String) catFrm.getField(ADD_CATG_FLD_NAME).getValue(),
                ((CheckBox) catFrm.getField(ADD_CATG_CREDIT_BOOL)).booleanValue(),
                balSheet);
          }
        } catch (InvalidValueException e) {
          // Ignoring InvalidValueException as
          // an appropriate msg is displayed in UI
        } catch (AccountsSheetException e) {
          close();
          Messenger.genericMessage(
              MessageSeverity.ERROR,
              STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR),
              "Failed trying to add Payment Categories for Balance Sheet",
              e);
        }
        break;
      case ADD_NEW_TYPE:
        try {
          typeFrm.commit();
          if (typeFrm.isValid()) {
            accSvc.addNewPaymentType(
                (String) typeFrm.getField(ADD_TYPE_FLD_NAME).getValue(),
                categories.get(typeFrm.getField(ADD_TYPE_FLD_CAT).getValue()));
          }
        } catch (InvalidValueException e) {
          // Ignoring InvalidValueException as
          // an appropriate msg is displayed in UI
        } catch (AccountsSheetException e) {
          close();
          Messenger.genericMessage(
              MessageSeverity.ERROR,
              STRINGS.getString(AccountsMessages.MSGR_UNRECOVERABLE_ERROR),
              "Failed trying to add Payment Types for Balance Sheet",
              e);
        }
        break;
    }

    populatePaymentCategories();
    populatePaymentTypes(categories.get(paymentCategories.getValue()));

    accordion.setSelectedTab(current);
  }
Ejemplo n.º 22
0
  private void onCloseEvent(final ClickEvent clickEvent) {
    if (!clickEvent.getButton().equals(saveButton)) {
      close();
      return;
    }

    if (!closeListener.canWindowSaveOrUpdate()) {
      return;
    }
    closeListener.saveOrUpdate();

    if (closeListener.canWindowClose()) {
      close();
    }
  }
Ejemplo n.º 23
0
 public void buttonClick(ClickEvent event) {
   Button btn = event.getButton();
   if (btn.equals(buttonSave)) {
     Collection<Enrollment> stC = (Collection<Enrollment>) lstStudentSelecteds.getItemIds();
     widget.setStudentsSelecteds(new ArrayList(stC));
     widget.removeSelectableStudent();
     widget.sortTable();
   } else if (btn.equals(buttonCancel)) {
     widget.removeSelectableStudent();
   } else if (btn.equals(btnAddAll)) {
     moveLeftRight();
   } else if (btn.equals(btnRemoveAll)) {
     moveRightLeft();
   } else if (btn.equals(btnSearch)) {
     search((String) txtSearch.getValue());
   }
 }
Ejemplo n.º 24
0
        @Override
        public void buttonClick(ClickEvent event) {

          // Get a reference to the button that received the click
          Button button = event.getButton();

          // Get the requested operation from the button caption
          char requestedOperation = button.getCaption().charAt(0);

          // Calculate the new value
          double newValue = calculate(requestedOperation);

          // Update the result label with the new value
          display.setReadOnly(false);
          display.setValue("" + newValue);
          display.setReadOnly(true);
        }
Ejemplo n.º 25
0
 @Override
 public void buttonClick(ClickEvent event) {
   Button btn = event.getButton();
   ShotcutItem item = (ShotcutItem) btn.getData();
   String action = item.getAction();
   if (SystemProperty.PAGE_TYPE.equals(item.getType())) {
     PageChangeEvent pageChangeEvent = new PageChangeEvent(action);
     eventBus.post(pageChangeEvent);
   } else {
     ContentChangeEvent changeEvent = new ContentChangeEvent();
     changeEvent.setPresenterName(action);
     eventBus.post(changeEvent);
   }
   // change the head menu to home page.
   changeToHomeMenuStyle();
   // change shotcut menu style.
   changeShotCutStyle(action);
 }
 public void buttonClick(ClickEvent event) {
   Button source = event.getButton();
   if (source == newClassroomTypeButton) {
     classroomTypealSubWindow.newClassroomType();
   } else if (source == removeClassroomTypeButton) {
     classroomTypealSubWindow.removeClassroomType();
   } else if (source == minimizeSearchButton) {
     this.classroomTypealSubWindow.minimizeSearchForm();
     minimizeSearchButton.setVisible(false);
     maximizeSearchButton.setVisible(true);
   } else if (source == minimizeListButton) {
     this.classroomTypealSubWindow.minimizeListForm();
   } else if (source == maximizeSearchButton) {
     minimizeSearchButton.setVisible(true);
     maximizeSearchButton.setVisible(false);
     this.classroomTypealSubWindow.maximizeSearchForm();
   } else if (source == searchButton) {
     this.classroomTypealSubWindow.search();
   }
 }
 public void buttonClick(ClickEvent event) {
   Button source = event.getButton();
   if (source == newHealthCoverageButton) {
     health_coveragealSubWindow.newHealth_coverage();
   } else if (source == removeHealthCoverageButton) {
     health_coveragealSubWindow.removeHealthCoverage();
   } else if (source == minimizeSearchButton) {
     this.health_coveragealSubWindow.minimizeSearchForm();
     minimizeSearchButton.setVisible(false);
     maximizeSearchButton.setVisible(true);
   } else if (source == minimizeListButton) {
     this.health_coveragealSubWindow.minimizeListForm();
   } else if (source == maximizeSearchButton) {
     minimizeSearchButton.setVisible(true);
     maximizeSearchButton.setVisible(false);
     this.health_coveragealSubWindow.maximizeSearchForm();
   } else if (source == searchButton) {
     this.health_coveragealSubWindow.search();
   }
 }
 public void buttonClick(ClickEvent event) {
   Button source = event.getButton();
   if (source == newBloodFactorButton) {
     bloodFactoralSubWindow.newBloodFactor();
   } else if (source == removeBloodFactorButton) {
     bloodFactoralSubWindow.removeBloodFactor();
   } else if (source == minimizeSearchButton) {
     this.bloodFactoralSubWindow.minimizeSearchForm();
     minimizeSearchButton.setVisible(false);
     maximizeSearchButton.setVisible(true);
   } else if (source == minimizeListButton) {
     this.bloodFactoralSubWindow.minimizeListForm();
   } else if (source == maximizeSearchButton) {
     minimizeSearchButton.setVisible(true);
     maximizeSearchButton.setVisible(false);
     this.bloodFactoralSubWindow.maximizeSearchForm();
   } else if (source == searchButton) {
     this.bloodFactoralSubWindow.search();
   }
 }
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getSource() == buttonReset) {
     listener.buttonReset();
   } else if (event.getSource() == buttonSubmit) {
     listener.buttonSave();
   } else if (event.getSource() == buttonCancel) {
     listener.buttonCancel();
   } else if (event.getSource() == buttonUpdate) {
     listener.buttonUpdate();
   }
   // tambahkan aksi
   else if (event.getSource() == buttonNext) {
     nextView();
   } else if (event.getSource() == buttonAdd) {
     addForm();
   } else if (event.getSource() == buttonPrev) {
     prevView();
   } else if (event.getSource() == buttonRemove) {
     remove();
   }
 }
 @Override
 public void buttonClick(ClickEvent event) {
   if (event.getSource() == okBtn) {
     try {
       fieldGroup.commit();
       // on successful commit, the currently edited Employee bean is added to
       // the table...
       employeeContainer.addBean(fieldGroup.getItemDataSource().getBean());
       // ... and a new Employee bean is created and set on the form
       fieldGroup.setItemDataSource(new Employee());
     } catch (CommitException e) {
       Notification.show(
           "Validation failed",
           "Unable to commit input. Did you fill out all required fields?",
           Notification.Type.ERROR_MESSAGE);
     }
   } else {
     // discard all input if the discard button was clicked
     fieldGroup.discard();
   }
 }