All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.cedarsoft.wicket.yaml.YamlPage Maven / Gradle / Ivy

The newest version!
package eu.cedarsoft.wicket.yaml;

import org.apache.wicket.Component;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.resources.StyleSheetReference;
import org.apache.wicket.model.PropertyModel;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

/**
 * Implementing classes should add the following components on their own:
 * 
    *
  • The content of column 1: {@link #ID_COL1_CONTENT} *
  • The content of column 2: {@link #ID_COL2_CONTENT} *
  • The navigation: {@link #ID_NAVIGATION} *
  • The footer: {@link #ID_FOOTER} *
*

* Use the method {@link #addOrReplace(Component))} because empty panels are added per default. *

* To set the layout of the columns use the method {@link #setLayoutStyleSheet(YamlLayout)} */ public abstract class YamlPage extends WebPage { @NotNull @NonNls public static final String ID_PAGE_TITLE = "pageTitle"; /** * The ID for the column 1 */ @NotNull @NonNls public static final String ID_COL1_CONTENT = "col1Content"; /** * The ID for the column 1 */ @NotNull @NonNls public static final String ID_TOP_NAV = "topnav"; /** * The ID for the feedback panel */ @NotNull @NonNls public static final String ID_FEEDBACK_PANEL = "feedbackPanel"; /** * The ID for the column 2 */ @NotNull @NonNls public static final String ID_COL2_CONTENT = "col2Content"; /** * The id for the navigation element */ @NotNull @NonNls public static final String ID_NAVIGATION = "navigation"; /** * The id for the footer element */ @NotNull @NonNls public static final String ID_FOOTER = "footer"; /** * The id for the Header of column 3. * This may be used for additional navigation elements */ @NotNull @NonNls public static final String ID_COLUMN_3_HEAD = "col3head"; /** * The id for the layout style sheet */ @NotNull @NonNls public static final String ID_LAYOUT_STYLE_SHEET = "layoutStyleSheet"; protected YamlPage() { //Page Title add( new Label( ID_PAGE_TITLE, new PropertyModel( this, "pageTitle" ) ) ); //Default style sheets add( new StyleSheetReference( "baseStyleSheet", new ResourceReference( YamlPage.class, "css/core/base.css" ) ) ); add( new StyleSheetReference( "wicketYamlStyleSheet", new ResourceReference( YamlPage.class, "css/core/wicketyaml.css" ) ) ); add( new StyleSheetReference( "ieHacksStyleSheet", new ResourceReference( YamlPage.class, "css/core/iehacks.css" ) ) ); //Add the empty panels for footer, navigation and content add( new EmptyPanel( ID_NAVIGATION ) ); add( new EmptyPanel( ID_FOOTER ) ); add( new EmptyPanel( ID_COL1_CONTENT ) ); add( new EmptyPanel( ID_COL2_CONTENT ) ); add( new EmptyPanel( ID_LAYOUT_STYLE_SHEET ) ); add( new EmptyPanel( ID_TOP_NAV ) ); add( new EmptyPanel( ID_COLUMN_3_HEAD ) ); add( new YamlFeedbackPanel( ID_FEEDBACK_PANEL ) ); //set the default layout setLayoutStyleSheet( YamlLayout.THREE_COL_DEFAULT ); } /** * Call this method to set the layout style * * @param yamlLayout the layout */ public final void setLayoutStyleSheet( @NotNull YamlLayout yamlLayout ) { ResourceReference styleSheetReference = yamlLayout.getStyleSheetReference(); setLayoutStyleSheet( styleSheetReference ); } /** * Sets the layout style sheet * * @param styleSheetReference the style sheet reference for the layout */ public void setLayoutStyleSheet( @NotNull ResourceReference styleSheetReference ) { addOrReplace( new StyleSheetReference( ID_LAYOUT_STYLE_SHEET, styleSheetReference ) ); } /** * Returns the page title * * @return the page title */ @NotNull public abstract String getPageTitle(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy