Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2014 Philip Helger (www.helger.com) philip[at]helger[dot]com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.helger.appbasics.app.page;
 
 
 
Abstract base implementation for IPage.

Author(s):
Philip Helger
 
 public abstract class AbstractPage extends MapBasedAttributeContainer implements IPage
 {
  
The name of the window where the help opens up
 
   public static final String HELP_WINDOW_NAME = "simplehelpwindow";
 
   private final String m_sID;
 
   @Nonnull
   private static ReadonlyMultiLingualText _getAsMLT (@Nonnull final String sText)
   {
     return new ReadonlyMultiLingualText (.sText);
   }

  
Constructor

Parameters:
sID The unique page ID. May not be null.
 
   public AbstractPage (@Nonnull @Nonempty final String sID)
   {
      = ValueEnforcer.notEmpty (sID"ID");
   }

  
Constructor

Parameters:
sID The unique page ID. May not be null.
sName The constant (non-translatable) name of the page. May not be null.
 
   public AbstractPage (@Nonnull @Nonempty final String sID, @Nonnull final String sName)
   {
     this (sID_getAsMLT (sName));
   }

  
Constructor

Parameters:
sID The unique page ID. May not be null.
sName The constant (non-translatable) name of the page. May not be null.
sDescription The constant (non-translatable) description of the page. May be null.
 
   public AbstractPage (@Nonnull @Nonempty final String sID,
                        @Nonnull final String sName,
                        @Nullable final String sDescription)
   {
     this (sID_getAsMLT (sName), sDescription == null ? null : _getAsMLT (sDescription));
   }

  
Constructor

Parameters:
sID The unique page ID. May not be null.
aName The name of the page. May not be null.
  public AbstractPage (@Nonnull @Nonempty final String sID, @Nonnull final IReadonlyMultiLingualText aName)
  {
    this (sIDaNamenull);
  }

  
Constructor

Parameters:
sID The unique page ID. May not be null.
aName The name of the page. May not be null.
aDescription Optional description of the page. May be null.
  public AbstractPage (@Nonnull @Nonempty final String sID,
                       @Nonnull final IReadonlyMultiLingualText aName,
                       @Nullable final IReadonlyMultiLingualText aDescription)
  {
    this (sID);
    setName (aName);
    setDescription (aDescription);
  }
  /*
   * Get the unique page ID
   */
  public final String getID ()
  {
    return ;
  }

  
Set the name of the page.

Parameters:
aName The multilingual name of the page. May not be null.
  public final void setName (@Nonnull final IReadonlyMultiLingualText aName)
  {
     = ValueEnforcer.notNull (aName"Name");
  }

  

Returns:
The complete name of the page in all available locales. Never null.
  public final IReadonlyMultiLingualText getName ()
  {
    return ;
  }
  /*
   * Get the name of the page in the passed locale.
   */
  public final String getDisplayText (@Nonnull final Locale aContentLocale)
  {
    return .getTextWithLocaleFallback (aContentLocale);
  }

  
Set the description of the page.

Parameters:
aDescription The multilingual description of the page. May be null.
  public final void setDescription (@Nullable final IReadonlyMultiLingualText aDescription)
  {
     = aDescription;
  }

  

Returns:
The complete description of the page in all available locales. May be null.
  {
    return ;
  }
  public final String getDescription (@Nonnull final Locale aContentLocale)
  {
    return  == null ? null : .getTextWithLocaleFallback (aContentLocale);
  }
  public boolean isHelpAvailable ()
  {
    return false;
  }
  public String toString ()
  {
    return new ToStringGenerator (this).append ("ID")
                                       .append ("name")
                                       .appendIfNotNull ("description")
                                       .toString ();
  }
New to GrepCode? Check out our FAQ X