Example #1
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.panel.AbstractPopup#getValue(java.lang.Object)
  */
 private Audit getValue(Audit audit) {
   audit.setState(state);
   audit.setOrganizationid(AbstractRoot.getOrganizationid());
   audit.setId(id);
   audit.setProductid(productid);
   audit.setName(nameField.getValue());
   audit.setDate(dateField.getValue());
   audit.setRating(ratingField.getValue());
   audit.setNotes(notesField.getValue());
   Log.debug("getValue " + audit);
   return audit;
 }
Example #2
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.panel.AbstractPopup#getValue(java.lang.Object)
  */
 private License getValue(License license) {
   license.setState(state);
   license.setId(id);
   license.setOrganizationid(AbstractRoot.getOrganizationid());
   license.setActorid(AbstractRoot.getActorid());
   license.setId(id);
   license.setUpstreamid(AbstractRoot.getOrganizationid());
   license.setDownstreamid(downstreamidField.getValue());
   license.setProductid(productField.getValue()); // TODO: set null for zero???
   license.setType(typeField.getValue());
   license.setWait(waitField.getValue());
   license.setFromdate(fromtodateField.getValue());
   license.setTodate(fromtodateField.getTovalue());
   license.setSubscription(subscriptionField.getValue());
   license.setTransaction(transactionField.getValue());
   license.setUpstream(upstreamField.getValue());
   license.setDownstream(downstreamField.getValue());
   license.setNotes(notesField.getValue());
   Log.debug("getValue " + license);
   return license;
 }
Example #3
0
  /*
   * Creates the panel of audit fields.
   *
   * @return the panel of audit fields.
   */
  public VerticalPanel createContent() {
    final VerticalPanel panel = new VerticalPanel();
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    add(panel);
    final Label auditLabel = new Label(CONSTANTS.auditLabel());
    auditLabel.addStyleName(AbstractField.CSS.cbtAbstractPopupLabel());
    panel.add(auditLabel);

    final Label closeButton = new Label();
    closeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });
    closeButton.addStyleName(AbstractField.CSS.cbtAbstractPopupClose());
    panel.add(closeButton);

    final HorizontalPanel content = new HorizontalPanel();
    content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.add(content);

    final VerticalPanel form = new VerticalPanel();
    content.add(form);

    // -----------------------------------------------
    // Audit Date field
    // -----------------------------------------------
    dateField = new DateField(this, null, CONSTANTS.dateLabel(), tab++);
    dateField.setHelpText(CONSTANTS.dateHelp());
    form.add(dateField);

    // -----------------------------------------------
    // Audit Name field
    // -----------------------------------------------
    nameField =
        new SuggestField(
            this, null, new NameIdAction(Service.ATTRIBUTE), CONSTANTS.nameLabel(), 20, tab++);
    nameField.setState(AbstractRoot.getOrganizationid());
    nameField.setType(Value.Type.AuditName.name());
    nameField.setHelpText(CONSTANTS.nameHelp());

    final Image nameButton = new Image(AbstractField.BUNDLE.plus());
    nameButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (AbstractRoot.noOrganizationid()) {
              AbstractField.addMessage(
                  Level.ERROR, AbstractField.CONSTANTS.errOrganizationid(), nameField);
            } else {
              ValuePopup.getInstance()
                  .show(
                      Value.Type.AuditName,
                      CONSTANTS.nameLabel(),
                      AbstractRoot.getOrganizationid(),
                      nameField);
            }
          }
        });
    nameButton.setTitle(CONSTANTS.namebuttonHelp());
    nameField.addButton(nameButton);

    form.add(nameField);

    // -----------------------------------------------
    // Rating range with one anchor slider
    // -----------------------------------------------
    ratingField = new RatingField(this, null, CONSTANTS.ratingLabel(), 10, tab++) {};
    ratingField.setLo(CONSTANTS.ratingLo());
    ratingField.setHi(CONSTANTS.ratingHi());
    ratingField.setDefaultValue(5);
    ratingField.setHelpText(CONSTANTS.ratingHelp());
    form.add(ratingField);

    // -----------------------------------------------
    // Comment field
    // -----------------------------------------------
    notesField = new TextAreaField(this, null, CONSTANTS.notesLabel(), tab++);
    notesField.setFieldStyle(CSS.notesField());
    notesField.setMaxLength(255);
    notesField.setHelpText(CONSTANTS.notesHelp());
    form.add(notesField);

    form.add(createCommands());

    onRefresh();
    return panel;
  }
Example #4
0
  /*
   * Creates the panel of license fields.
   *
   * @return the panel of license fields.
   */
  private VerticalPanel createContent() {
    final VerticalPanel form = new VerticalPanel();
    final Label title = new Label(CONSTANTS.licenseLabel());
    title.addStyleName(AbstractField.CSS.cbtAbstractPopupLabel());
    form.add(title);

    final Label closeButton = new Label();
    closeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            LicensePopup.this.hide();
          }
        });
    closeButton.addStyleName(AbstractField.CSS.cbtAbstractPopupClose());
    form.add(closeButton);

    // -----------------------------------------------
    // Agent field
    // -----------------------------------------------
    downstreamidField =
        new SuggestField(
            this, null, new NameIdAction(Service.PARTY), CONSTANTS.agentLabel(), 20, tab++);
    downstreamidField.setType(Party.Type.Agent.name());
    downstreamidField.setHelpText(CONSTANTS.agentHelp());
    form.add(downstreamidField);

    // -----------------------------------------------
    // Product field
    // -----------------------------------------------
    productField =
        new ListField(
            this, null, new NameIdAction(Service.PRODUCT), CONSTANTS.productLabel(), true, tab++);
    productField.setType(Product.Type.Accommodation.name());
    productField.setHelpText(CONSTANTS.productHelp());
    form.add(productField);

    // -----------------------------------------------
    // Type field
    // -----------------------------------------------
    typeField =
        new ListField(
            this,
            null,
            NameId.getList(CONSTANTS.types(), License.TYPES),
            CONSTANTS.typeLabel(),
            false,
            tab++);
    typeField.setDefaultValue(License.Type.All.name());
    typeField.setFieldHalf();
    typeField.setHelpText(CONSTANTS.typeHelp());

    // -----------------------------------------------
    // Alert Wait field
    // -----------------------------------------------
    waitField = new IntegerField(this, null, CONSTANTS.waitLabel(), tab++);
    waitField.setDefaultValue(1000);
    waitField.setRange(0, 60000);
    waitField.setEnabled(AbstractRoot.hasPermission(AccessControl.SUPERUSER));
    waitField.setHelpText(CONSTANTS.waitHelp());

    HorizontalPanel ts = new HorizontalPanel();
    form.add(ts);
    ts.add(typeField);
    ts.add(waitField);

    // -----------------------------------------------
    // Date span field
    // -----------------------------------------------
    fromtodateField = new DatespanField(this, null, CONSTANTS.fromtodateLabel(), tab++);
    fromtodateField.setHelpText(CONSTANTS.fromtodateHelp());
    form.add(fromtodateField);

    // -----------------------------------------------
    // Subscription field
    // -----------------------------------------------
    subscriptionField =
        new DoubleField(this, null, CONSTANTS.subscriptionLabel(), AbstractField.IF, tab++);
    subscriptionField.setHelpText(CONSTANTS.subscriptionHelp());
    subscriptionField.setDefaultValue(5.0);
    subscriptionField.setRange(0.0, 10000.0);
    subscriptionField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.LICENSE));

    // -----------------------------------------------
    // Transaction field
    // -----------------------------------------------
    transactionField =
        new DoubleField(this, null, CONSTANTS.transactionLabel(), AbstractField.AF, tab++);
    transactionField.setHelpText(CONSTANTS.transactionHelp());
    transactionField.setDefaultValue(2.0);
    transactionField.setRange(0.0, 100.0);
    transactionField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.LICENSE));

    HorizontalPanel st = new HorizontalPanel();
    form.add(st);
    st.add(subscriptionField);
    st.add(transactionField);

    // -----------------------------------------------
    // Upstream field
    // -----------------------------------------------
    upstreamField = new DoubleField(this, null, CONSTANTS.upstreamLabel(), AbstractField.AF, tab++);
    upstreamField.setHelpText(CONSTANTS.upstreamHelp());
    upstreamField.setDefaultValue(0.0);
    upstreamField.setRange(0.0, 100.0);
    upstreamField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.UPSTREAM));

    // -----------------------------------------------
    // Transaction field
    // -----------------------------------------------
    downstreamField =
        new DoubleField(this, null, CONSTANTS.downstreamLabel(), AbstractField.AF, tab++);
    downstreamField.setHelpText(CONSTANTS.downstreamHelp());
    downstreamField.setDefaultValue(0.0);
    downstreamField.setRange(0.0, 100.0);
    downstreamField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.DOWNSTREAM));

    HorizontalPanel ud = new HorizontalPanel();
    form.add(ud);
    ud.add(upstreamField);
    ud.add(downstreamField);

    // -----------------------------------------------
    // Notes field
    // -----------------------------------------------
    notesField =
        new TextAreaField(
            this,
            null,
            CONSTANTS.notesLabel(),
            //				new LanguageNameId(),
            tab++);
    notesField.setMaxLength(255);
    notesField.setHelpText(CONSTANTS.notesHelp());
    form.add(notesField);

    form.add(createCommands());
    onRefresh();
    onReset(License.CREATED);
    return form;
  }