Example #1
0
 /* (non-Javadoc)
  * @see net.cbtltd.client.panel.AbstractPopup#setValue(java.lang.Object)
  */
 public void setValue(License license) {
   Log.debug("setValue " + license);
   if (license != null) {
     setResetting(true);
     onStateChange(license.getState());
     id = license.getId();
     downstreamidField.setValue(license.getDownstreamid());
     productField.setValue(license.getProductid());
     typeField.setValue(license.getType());
     waitField.setValue(license.getWait());
     fromtodateField.setValue(license.getFromdate());
     fromtodateField.setTovalue(license.getTodate());
     subscriptionField.setValue(license.getSubscription());
     transactionField.setValue(license.getTransaction());
     upstreamField.setValue(license.getUpstream());
     downstreamField.setValue(license.getDownstream());
     notesField.setValue(license.getNotes());
     center();
     setResetting(false);
   }
 }
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 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;
  }