Class DefaultCalendarView.CellGrid.DateCell

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
CellGridImpl<Date>.Cell
com.google.gwt.user.datepicker.client.DefaultCalendarView.CellGrid.DateCell
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget
Enclosing class:
DefaultCalendarView.CellGrid

class DefaultCalendarView.CellGrid.DateCell extends CellGridImpl<Date>.Cell
A cell representing a date.
  • Constructor Details

    • DateCell

      DateCell(boolean isWeekend)
  • Method Details

    • addStyleName

      public void addStyleName(String styleName)
      Description copied from class: UIObject
      Adds a secondary or dependent style name to this object. A secondary style name is an additional style name that is, in HTML/CSS terms, included as a space-separated token in the value of the CSS class attribute for this object's root element.

      The most important use for this method is to add a special kind of secondary style name called a dependent style name. To add a dependent style name, use UIObject.addStyleDependentName(String), which will prefix the 'style' argument with the result of UIObject.getStylePrimaryName() (followed by a '-'). For example, suppose the primary style name is gwt-TextBox. If the following method is called as obj.setReadOnly(true):

       public void setReadOnly(boolean readOnly) {
         isReadOnlyMode = readOnly;
         
         // Create a dependent style name.
         String readOnlyStyle = "readonly";
          
         if (readOnly) {
           addStyleDependentName(readOnlyStyle);
         } else {
           removeStyleDependentName(readOnlyStyle);
         }
       }

      then both of the CSS style rules below will be applied:

      
       // This rule is based on the primary style name and is always active.
       .gwt-TextBox {
         font-size: 12pt;
       }
       
       // This rule is based on a dependent style name that is only active
       // when the widget has called addStyleName(getStylePrimaryName() +
       // "-readonly").
       .gwt-TextBox-readonly {
         background-color: lightgrey;
         border: none;
       }

      The code can also be simplified with UIObject.setStyleDependentName(String, boolean):

       public void setReadOnly(boolean readOnly) {
         isReadOnlyMode = readOnly;
         setStyleDependentName("readonly", readOnly);
       }

      Dependent style names are powerful because they are automatically updated whenever the primary style name changes. Continuing with the example above, if the primary style name changed due to the following call:

      setStylePrimaryName("my-TextThingy");

      then the object would be re-associated with following style rules, removing those that were shown above.

       .my-TextThingy {
         font-size: 20pt;
       }
       
       .my-TextThingy-readonly {
         background-color: red;
         border: 2px solid yellow;
       }

      Secondary style names that are not dependent style names are not automatically updated when the primary style name changes.

      Overrides:
      addStyleName in class UIObject
      Parameters:
      styleName - the secondary style name to be added
      See Also:
    • isFiller

      public boolean isFiller()
    • onHighlighted

      public void onHighlighted(boolean highlighted)
      Overrides:
      onHighlighted in class CellGridImpl<Date>.Cell
    • onSelected

      public void onSelected(boolean selected)
      Overrides:
      onSelected in class CellGridImpl<Date>.Cell
    • removeStyleName

      public void removeStyleName(String styleName)
      Description copied from class: UIObject
      Removes a style name. This method is typically used to remove secondary style names, but it can be used to remove primary stylenames as well. That use is not recommended.
      Overrides:
      removeStyleName in class UIObject
      Parameters:
      styleName - the secondary style name to be removed
      See Also:
    • setAriaSelected

      public void setAriaSelected(boolean value)
    • updateStyle

      public void updateStyle()
      Specified by:
      updateStyle in class CellGridImpl<Date>.Cell
    • update

      void update(Date current)