| | |
| | |
|
| | | /**
|
| | | * Represents a page link registration for the topbar.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class PageRegistration implements Serializable {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
| | | PageParameters params) {
|
| | | this(translationKey, pageClass, params, false);
|
| | | }
|
| | | |
| | |
|
| | | public PageRegistration(String translationKey, Class<? extends WebPage> pageClass,
|
| | | PageParameters params, boolean hiddenPhone) {
|
| | | this.translationKey = translationKey;
|
| | |
| | |
|
| | | /**
|
| | | * Represents a page link to a non-Wicket page. Might be external.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public static class OtherPageLink extends PageRegistration {
|
| | |
|
| | |
| | | super(translationKey, null);
|
| | | this.url = url;
|
| | | }
|
| | | |
| | |
|
| | | public OtherPageLink(String translationKey, String url, boolean hiddenPhone) {
|
| | | super(translationKey, null, null, hiddenPhone);
|
| | | this.url = url;
|
| | |
| | |
|
| | | /**
|
| | | * Represents a DropDownMenu for the topbar
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public static class DropDownMenuRegistration extends PageRegistration {
|
| | |
|
| | |
| | |
|
| | | /**
|
| | | * A MenuItem for the DropDownMenu.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public static class DropDownMenuItem implements Serializable {
|
| | |
|
| | |
| | |
|
| | | /**
|
| | | * Standard Menu Item constructor.
|
| | | * |
| | | *
|
| | | * @param displayText
|
| | | * @param parameter
|
| | | * @param value
|
| | |
| | |
|
| | | /**
|
| | | * Standard Menu Item constructor that preserves aggregate parameters.
|
| | | * |
| | | *
|
| | | * @param displayText
|
| | | * @param parameter
|
| | | * @param value
|
| | |
| | | parameters = new PageParameters(params);
|
| | | if (parameters.containsKey(parameter)) {
|
| | | isSelected = params.getString(parameter).equals(value);
|
| | | if (isSelected) {
|
| | | // already selected, so remove this enables toggling
|
| | | parameters.remove(parameter);
|
| | | } else {
|
| | | // set the new selection value
|
| | | setParameter(parameter, value);
|
| | | }
|
| | | // set the new selection value
|
| | | setParameter(parameter, value);
|
| | | } else {
|
| | | // not currently selected
|
| | | isSelected = false;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void setParameter(String parameter, String value) {
|
| | | protected void setParameter(String parameter, String value) {
|
| | | if (!StringUtils.isEmpty(parameter)) {
|
| | | if (StringUtils.isEmpty(value)) {
|
| | | this.parameters.remove(parameter);
|
| | |
| | | return displayText;
|
| | | }
|
| | | }
|
| | |
|
| | | public static class DropDownToggleItem extends DropDownMenuItem {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | /**
|
| | | * Toggle Menu Item constructor that preserves aggregate parameters.
|
| | | *
|
| | | * @param displayText
|
| | | * @param parameter
|
| | | * @param value
|
| | | */
|
| | | public DropDownToggleItem(String displayText, String parameter, String value,
|
| | | PageParameters params) {
|
| | | super(displayText, parameter, value, params);
|
| | | if (isSelected) {
|
| | | // already selected, so remove this enables toggling
|
| | | parameters.remove(parameter);
|
| | | }
|
| | | }
|
| | | }
|
| | | } |