StringField Height

In the settings page for a gateway configuration, I’d like to display a license file. I believe a StringField is the correct component for this. There is a method to set its width, but I can’t figure out how to set a height. Is there a way?

– chuck

Hi,

StringField is the data type for the persistent record, so I assume you’re building a RecordEditForm off this record, and hence the question. However, do you really want the License to be editable? Or are you just looking for a way to display it?

If you’re just trying to display the license, do you want it to be on its own page, or actually on the page where they set the various settings?

Regards,

Hi Colby,

  1. I’m just looking to display a non-editable field (a license statement) in the Gateway module parameters. It was no problem making it read-only. The only issue is the ability for the text box to wrap.
  2. If there’s a better place to display the open-source info for a module, I’m open to suggestions.

— chuck

Hi,

If you have your own wicket page, one way or another (such as extending a RecordEditForm), a simple wicket label or something might be best. However, if you’re using a persistent record, and just want a quick solution, you can do this:

StringField myField = new StringField(...);

static {
    myField.getFormMeta().setEditorSource(new TextAreaEditorSource(20,45));
}

The parameters for TextAreadEditorSource are rows, cols. NOTE: When doing this, do NOT call StringField.setWidth as you were doing before. That function sets the editor back to a single line text box.

Hope this helps,

Thanks Colby. Works like a charm.
— chuck