Ejemplo n.º 1
0
  public RuleAttributeWidget(
      final RuleModeller parent, final RuleModel model, final boolean isReadOnly) {
    this.parent = parent;
    this.model = model;
    FormStyleLayout layout = new FormStyleLayout();
    // Adding metadata here, seems redundant to add a new widget for metadata. Model does handle
    // meta data separate.
    RuleMetadata[] meta = model.metadataList;
    if (meta.length > 0) {
      HorizontalPanel hp = new HorizontalPanel();
      hp.add(new SmallLabel(Constants.INSTANCE.Metadata2()));
      layout.addRow(hp);
    }
    for (int i = 0; i < meta.length; i++) {
      RuleMetadata rmd = meta[i];
      layout.addAttribute(rmd.getAttributeName(), getEditorWidget(rmd, i, isReadOnly));
    }
    RuleAttribute[] attrs = model.attributes;
    if (attrs.length > 0) {
      HorizontalPanel hp = new HorizontalPanel();
      hp.add(new SmallLabel(Constants.INSTANCE.Attributes1()));
      layout.addRow(hp);
    }
    for (int i = 0; i < attrs.length; i++) {
      RuleAttribute at = attrs[i];
      layout.addAttribute(at.getAttributeName(), getEditorWidget(at, i, isReadOnly));
    }

    initWidget(layout);
  }
  public void setPath(Path path) {
    this.fullPath = path;
    // ts.clear();
    ts.addAttribute(
        DecisionTableXLSEditorConstants.INSTANCE.UploadNewVersion() + ":",
        new AttachmentFileWidget(
            fullPath,
            new Command() {
              @Override
              public void execute() {}
            }));

    Button dl = new Button("Download");
    // dl.setEnabled( this.asset.getVersionNumber() > 0 );
    dl.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Window.open(
                GWT.getModuleBaseURL()
                    + "file?"
                    + HTMLFileManagerFields.FORM_FIELD_PATH
                    + "="
                    + fullPath.toURI(),
                "downloading",
                "resizable=no,scrollbars=yes,status=no");
          }
        });
    ts.addAttribute(DecisionTableXLSEditorConstants.INSTANCE.DownloadCurrentVersion() + ":", dl);
  }