Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public WColumnLayout() {
* @param heading the heading text.
*/
public WColumnLayout(final String heading) {
this(new WHeading(WHeading.SECTION, heading));
this(new WHeading(HeadingLevel.H3, heading));
}

/**
Expand Down Expand Up @@ -80,7 +80,7 @@ public void setLeftColumn(final WComponent content) {
* @param content the content.
*/
public void setLeftColumn(final String heading, final WComponent content) {
setLeftColumn(new WHeading(WHeading.MINOR, heading), content);
setLeftColumn(new WHeading(HeadingLevel.H4, heading), content);
}

/**
Expand Down Expand Up @@ -109,7 +109,7 @@ public void setRightColumn(final WComponent content) {
* @param content the content.
*/
public void setRightColumn(final String heading, final WComponent content) {
setRightColumn(new WHeading(WHeading.MINOR, heading), content);
setRightColumn(new WHeading(HeadingLevel.H4, heading), content);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void testSetLeftColumn() {
WColumnLayout col = new WColumnLayout();
WLabel label = new WLabel("leftLabel");
String headingText = "leftHeading";
WHeading heading = new WHeading(WHeading.MINOR, headingText);
WHeading heading = new WHeading(HeadingLevel.H4, headingText);

Assert.assertFalse("Should not have any content by default", col.hasLeftContent());
col.setLeftColumn(label);
Expand Down Expand Up @@ -68,7 +68,7 @@ public void testSetRightColumn() {
WColumnLayout col = new WColumnLayout();
WLabel label = new WLabel("rightLabel");
String headingText = "rightHeading";
WHeading heading = new WHeading(WHeading.MINOR, headingText);
WHeading heading = new WHeading(HeadingLevel.H4, headingText);

Assert.assertFalse("Should not have any content by default", col.hasRightContent());
col.setRightColumn(label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,20 @@ public void testHeadingLevelAccessors() {
HeadingLevel.H1, HeadingLevel.H2, HeadingLevel.H3);
}

@Test
public void testHeadingTypeToHeadingLevelConversion() {

testHeadingLevelConversion(WHeading.TITLE, HeadingLevel.H1);
testHeadingLevelConversion(WHeading.MAJOR, HeadingLevel.H2);
testHeadingLevelConversion(WHeading.SECTION, HeadingLevel.H3);
testHeadingLevelConversion(WHeading.MINOR, HeadingLevel.H4);
testHeadingLevelConversion(WHeading.SUB_HEADING, HeadingLevel.H5);
testHeadingLevelConversion(WHeading.SUB_SUB_HEADING, HeadingLevel.H6);
}

private void testHeadingLevelConversion(int type, HeadingLevel headingLevel) {
WHeading heading = new WHeading(type, "dummy");
Assert.assertEquals("WHeading type conversion to HeadingLevel failed",
headingLevel, heading.getHeadingLevel());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bordertech.wcomponents.render.webxml;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.Margin;
import com.github.bordertech.wcomponents.Size;
import com.github.bordertech.wcomponents.WDecoratedLabel;
Expand All @@ -21,7 +22,7 @@ public class WHeadingRenderer_Test extends AbstractWebXmlRendererTestCase {

@Test
public void testRendererCorrectlyConfigured() {
WHeading component = new WHeading(WHeading.TITLE, "");
WHeading component = new WHeading(HeadingLevel.H1, "");
Assert.assertTrue("Incorrect renderer supplied",
getWebXmlRenderer(component) instanceof WHeadingRenderer);
}
Expand All @@ -30,27 +31,27 @@ public void testRendererCorrectlyConfigured() {
public void testPaint() throws IOException, SAXException, XpathException {
final String text = "WHeading_Test.testPaint.heading";

WHeading heading = new WHeading(WHeading.TITLE, text);
WHeading heading = new WHeading(HeadingLevel.H1, text);
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text, "//ui:heading[@level=1]", heading);

heading = new WHeading(WHeading.MAJOR, text);
heading = new WHeading(HeadingLevel.H2, text);
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text, "//ui:heading[@level=2]", heading);

heading = new WHeading(WHeading.SECTION, text);
heading = new WHeading(HeadingLevel.H3, text);
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text, "//ui:heading[@level=3]", heading);

heading = new WHeading(WHeading.MINOR, text);
heading = new WHeading(HeadingLevel.H4, text);
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text, "//ui:heading[@level=4]", heading);

heading = new WHeading(WHeading.SUB_HEADING, text);
heading = new WHeading(HeadingLevel.H5, text);
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text, "//ui:heading[@level=5]", heading);

heading = new WHeading(WHeading.SUB_SUB_HEADING, text);
heading = new WHeading(HeadingLevel.H6, text);
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text, "//ui:heading[@level=6]", heading);

Expand All @@ -67,7 +68,7 @@ public void testPaintWithDecoratedLabel() throws IOException, SAXException, Xpat
final String text1 = "WHeading_Test.testPaintWithDecoratedLabel.text1";
final String text2 = "WHeading_Test.testPaintWithDecoratedLabel.text2";

WHeading heading = new WHeading(WHeading.TITLE, new WDecoratedLabel(new WText(text1)));
WHeading heading = new WHeading(HeadingLevel.H1, new WDecoratedLabel(new WText(text1)));
assertSchemaMatch(heading);

assertXpathEvaluatesTo(text1, "//ui:heading[@level=1]/ui:decoratedlabel/ui:labelbody/text()",
Expand All @@ -81,7 +82,7 @@ public void testPaintWithDecoratedLabel() throws IOException, SAXException, Xpat

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WHeading heading = new WHeading(WHeading.TITLE, "test");
WHeading heading = new WHeading(HeadingLevel.H1, "test");
assertXpathNotExists("//ui:heading/ui:margin", heading);

Margin margin = new Margin(0);
Expand Down Expand Up @@ -109,7 +110,7 @@ public void testRenderedWithMargins() throws IOException, SAXException, XpathExc

@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
WHeading heading = new WHeading(WHeading.TITLE, new WDecoratedLabel(new WText("dummy")));
WHeading heading = new WHeading(HeadingLevel.H1, new WDecoratedLabel(new WText("dummy")));

assertSafeContent(heading);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.bordertech.wcomponents.Action;
import com.github.bordertech.wcomponents.ActionEvent;
import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.RadioButtonGroup;
import com.github.bordertech.wcomponents.TestLookupTable;
import com.github.bordertech.wcomponents.WButton;
Expand Down Expand Up @@ -47,7 +48,7 @@ public BigPanel() {

List<String> progTypeList = getProgrammerTypeList();

add(new WHeading(WHeading.MAJOR, "Programmer social network"));
add(new WHeading(HeadingLevel.H2, "Programmer social network"));
leftColumn.addField("Name", new WTextField());
leftColumn.addField("Date Of birth", new WDateField());
leftColumn.addField("Day of week", new WDropdown(TestLookupTable.DayOfWeekTable.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.bordertech.wcomponents.Action;
import com.github.bordertech.wcomponents.ActionEvent;
import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.RadioButtonGroup;
import com.github.bordertech.wcomponents.TestLookupTable;
import com.github.bordertech.wcomponents.WButton;
Expand Down Expand Up @@ -34,7 +35,7 @@ public class DetailsPage extends WContainer {
* Creates a DetailsPage.
*/
public DetailsPage() {
add(new WHeading(WHeading.MAJOR, "Details"));
add(new WHeading(HeadingLevel.H2, "Details"));
// core input fields, tabs, collapsible, menu

WTabSet tabs = new WTabSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.bordertech.wcomponents.Action;
import com.github.bordertech.wcomponents.ActionEvent;
import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.Request;
import com.github.bordertech.wcomponents.WButton;
import com.github.bordertech.wcomponents.WContainer;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void execute(final ActionEvent event) {
tabs.addTab(new DuplicatorGroup(), "Dynamic Additions", WTabSet.TAB_MODE_CLIENT);
tabs.addTab(new TextDuplicator(), "Text Duplicator", WTabSet.TAB_MODE_CLIENT);

add(new WHeading(WHeading.MAJOR, "Selection of tests"));
add(new WHeading(HeadingLevel.H2, "Selection of tests"));
add(tabs);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bordertech.wcomponents.examples;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.WCollapsible;
import com.github.bordertech.wcomponents.WCollapsible.CollapsibleMode;
import com.github.bordertech.wcomponents.WContainer;
Expand Down Expand Up @@ -42,61 +43,61 @@ public LoadAjaxControlsExample() {
CollapsibleMode.DYNAMIC);
add(collapse);

content.add(new WHeading(WHeading.SECTION, "Lists using datalist"));
content.add(new WHeading(HeadingLevel.H3, "Lists using datalist"));

WFieldLayout layout = new WFieldLayout();
createFields(layout, "icao");
content.add(layout);

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Lists using different datalist"));
content.add(new WHeading(HeadingLevel.H3, "Lists using different datalist"));

WFieldLayout layout2 = new WFieldLayout();
createFields(layout2, new TableWithNullOption("icao"));
content.add(layout2);

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Eager Panel"));
content.add(new WHeading(HeadingLevel.H3, "Eager Panel"));

WPanel eager = new WPanel(WPanel.Type.BOX);
eager.setMode(PanelMode.EAGER);
eager.add(new WText("Eager panel content loaded via ajax."));
content.add(eager);

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - Button"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - Button"));
content.add(new AjaxWButtonExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - CheckBox"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - CheckBox"));
content.add(new AjaxWCheckboxExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - Dropdown"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - Dropdown"));
content.add(new AjaxWDropdownExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - Table"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - Table"));
content.add(new TreeTableExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - Polling"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - Polling"));
content.add(new AjaxPollingWButtonExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - Lazy Panel"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - Lazy Panel"));
content.add(new AjaxWPanelExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Ajax - RadioButtonSelect"));
content.add(new WHeading(HeadingLevel.H3, "Ajax - RadioButtonSelect"));
content.add(new AjaxWRadioButtonSelectExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Dialog"));
content.add(new WHeading(HeadingLevel.H3, "Dialog"));
content.add(new WDialogExample());

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Tab Modes"));
content.add(new WHeading(HeadingLevel.H3, "Tab Modes"));
WTabSet tabset1 = new WTabSet();
tabset1.
addTab(new DateText("Tab Content 1"), "Tab 1 (client)", WTabSet.TAB_MODE_CLIENT, '1');
Expand All @@ -111,7 +112,7 @@ public LoadAjaxControlsExample() {
content.add(tabset1);

content.add(new WHorizontalRule());
content.add(new WHeading(WHeading.SECTION, "Collapsibles"));
content.add(new WHeading(HeadingLevel.H3, "Collapsibles"));
content.add(new WCollapsible(new DateText("Eager Collapsible Content"), "Eager Mode",
CollapsibleMode.EAGER));
content.add(new WCollapsible(new DateText("Lazy Collapsible Content"), "Lazy Mode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.bordertech.wcomponents.Action;
import com.github.bordertech.wcomponents.ActionEvent;
import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.Request;
import com.github.bordertech.wcomponents.WButton;
import com.github.bordertech.wcomponents.WDefinitionList;
Expand Down Expand Up @@ -126,7 +127,7 @@ public void execute(final ActionEvent event) {
fieldLayout.addField("Ten column field", tf5);

add(new WHorizontalRule());
WHeading heading = new WHeading(WHeading.MAJOR, "Values read from fields");
WHeading heading = new WHeading(HeadingLevel.H2, "Values read from fields");
add(heading);
WDefinitionList defList = new WDefinitionList(WDefinitionList.Type.COLUMN);
defList.addTerm(tf1.getLabel().getText(), plain);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bordertech.wcomponents.examples;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.Request;
import com.github.bordertech.wcomponents.WButton;
import com.github.bordertech.wcomponents.WComponent;
Expand Down Expand Up @@ -53,7 +54,7 @@ public class WDataListServletExample extends WContainer {
* Construct the example.
*/
public WDataListServletExample() {
add(new WHeading(WHeading.SECTION,
add(new WHeading(HeadingLevel.H3,
"Example of components using cached lists (WDataListServlet)"));

add(layout);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bordertech.wcomponents.examples;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.WContainer;
import com.github.bordertech.wcomponents.WDefinitionList;
import com.github.bordertech.wcomponents.WHeading;
Expand All @@ -17,22 +18,22 @@ public class WDefinitionListExample extends WContainer {
* Creates a WDefinitionListExample.
*/
public WDefinitionListExample() {
add(new WHeading(WHeading.SECTION, "Normal layout"));
add(new WHeading(HeadingLevel.H3, "Normal layout"));
WDefinitionList list = new WDefinitionList();
addListItems(list);
add(list);

add(new WHeading(WHeading.SECTION, "Flat layout"));
add(new WHeading(HeadingLevel.H3, "Flat layout"));
list = new WDefinitionList(WDefinitionList.Type.FLAT);
addListItems(list);
add(list);

add(new WHeading(WHeading.SECTION, "Stacked layout"));
add(new WHeading(HeadingLevel.H3, "Stacked layout"));
list = new WDefinitionList(WDefinitionList.Type.STACKED);
addListItems(list);
add(list);

add(new WHeading(WHeading.SECTION, "Column layout"));
add(new WHeading(HeadingLevel.H3, "Column layout"));
list = new WDefinitionList(WDefinitionList.Type.COLUMN);
addListItems(list);
add(list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@ public void execute(final ActionEvent event) {
add(dialogWithHeight2);
add(dialogWithMode);

add(new WHeading(WHeading.MAJOR, "Dialogs which open without page reload"));
add(new WHeading(HeadingLevel.H2, "Dialogs which open without page reload"));
//remember the button of an immediate is part of the dialog: it will be place into the UI wherever the dialog is placed
add(nonModalDialog);
add(modalDialog);
// for buttons which will result in a dialog on reload the button is added to the UI explicitly

add(new WHeading(WHeading.MAJOR, "Dialogs which open after page reload"));
add(new WHeading(HeadingLevel.H2, "Dialogs which open after page reload"));
add(dialogButton1);
add(dialogButton2);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bordertech.wcomponents.examples;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.WButton;
import com.github.bordertech.wcomponents.WContainer;
import com.github.bordertech.wcomponents.WHeading;
Expand All @@ -26,7 +27,7 @@ public WPanelExample() {
add(new WHorizontalRule());
}

add(new WHeading(WHeading.SECTION, panelType.toString()));
add(new WHeading(HeadingLevel.H3, panelType.toString()));

WPanel panel = new WPanel(panelType);
panel.setTitleText("Panel title");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.bordertech.wcomponents.examples;

import com.github.bordertech.wcomponents.HeadingLevel;
import com.github.bordertech.wcomponents.Request;
import com.github.bordertech.wcomponents.WButton;
import com.github.bordertech.wcomponents.WContainer;
Expand Down Expand Up @@ -30,7 +31,7 @@ public class WShufflerExample extends WContainer {
* Construct the example.
*/
public WShufflerExample() {
add(new WHeading(WHeading.SECTION, "WShuffler examples"));
add(new WHeading(HeadingLevel.H3, "WShuffler examples"));

WFieldLayout layout = new WFieldLayout();
add(layout);
Expand Down
Loading