@Test public void testHidden() throws IOException, SAXException, XpathException { MyInput comp = new MyInput(); WLabel label = new WLabel("label", comp); label.setHidden(true); assertSchemaMatch(label); assertXpathEvaluatesTo("", "//ui:label/@hiddencomponent", label); assertXpathEvaluatesTo("true", "//ui:label/@hidden", label); }
@Test public void testHiddenBoth() throws IOException, SAXException, XpathException { MyInput comp = new MyInput(); WLabel label = new WLabel("label", comp); label.setHidden(true); comp.setHidden(true); assertSchemaMatch(label); assertXpathEvaluatesTo("true", "//ui:label/@hidden", label); assertXpathEvaluatesTo("true", "//ui:label/@hiddencomponent", label); }
/** * Creates a WFieldSet with content and a given FrameType. * * @param title The title to give to the WFieldSet. * @param type The decorative model of the WFieldSet * @return a WFieldSet with form control content. */ private WFieldSet addFieldSet(final String title, final WFieldSet.FrameType type) { final WFieldSet fieldset = new WFieldSet(title); fieldset.setFrameType(type); fieldset.setMargin(new Margin(null, null, Size.LARGE, null)); final WFieldLayout layout = new WFieldLayout(); fieldset.add(layout); layout.setLabelWidth(25); layout.addField("Street address", new WTextField()); final WField add2Field = layout.addField("Street address line 2", new WTextField()); add2Field.getLabel().setHidden(true); layout.addField("Suburb", new WTextField()); layout.addField("State/Territory", new WDropdown( new String[]{"", "ACT", "NSW", "NT", "QLD", "SA", "TAS", "VIC", "WA"})); //NOTE: this is an Australia-specific post code field. An Australian post code is not a number as they may contain a leading zero. final WTextField postcode = new WTextField(); postcode.setMaxLength(4); postcode.setColumns(4); postcode.setMinLength(3); layout.addField("Postcode", postcode); add(fieldset); return fieldset; }
hiddenLabel.setHidden(true); fieldsFlat.addField(hiddenLabel, new WTextField()); hiddenLabel.setHidden(true); WTextField roField = new WTextField(); roField.setReadOnly(true); fieldsFlat.addField(hiddenLabel, roField); hiddenLabel = new WLabel("Hidden label for a compound control"); hiddenLabel.setHidden(true); WCheckBoxSelect cbSelect = new WCheckBoxSelect(new String[]{"Apple", "Cherry", "Orange", "Pineapple", "control label is hidden"}); fieldsFlat.addField(hiddenLabel, cbSelect);
console.setColumns(100); WLabel label = new WLabel("Console", console); label.setHidden(true); add(label); add(console);