Package org.zkoss.zk.ui.util

## Class ConditionImpl

- java.lang.Object
- - org.zkoss.zk.ui.util.ConditionImpl

- All Implemented Interfaces:
    `java.io.Serializable`

      public class ConditionImpl
      extends java.lang.Object
      implements java.io.Serializable

  An utility to simplify the implementation of `Condition`. Note: it doesn't implement `Condition`.
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConditionImpl​(java.lang.String ifc, java.lang.String unless)` | Construct.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ExValue` | `getIf()` | Returns If expression.
    `static ConditionImpl` | `getInstance​(java.lang.String ifc, java.lang.String unless)` | Returns an instance of Condition, or null if both ifc and unless are empty.
    `ExValue` | `getUnless()` | Returns Unless expression.
    `boolean` | `isEffective​(Evaluator eval, Component comp)` | Used to evaluate whether it is effective.
    `boolean` | `isEffective​(Evaluator eval, Page page)` | Used to evaluate whether it is effective.
    `boolean` | `isIf()` | Returns whether it's If condition.
    `boolean` | `isUnless()` | Returns whether it's Unless condition.
    `void` | `setIf​(java.lang.String cond)` | Sets the if condition.
    `void` | `setUnless​(java.lang.String cond)` | Sets the unless condition.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConditionImpl

          public ConditionImpl​(java.lang.String ifc,
                               java.lang.String unless)

      Construct. In most cases, use `getInstance(java.lang.String, java.lang.String)` instead of this constructor.

  - ### Method Detail

    - #### getInstance

          public static ConditionImpl getInstance​(java.lang.String ifc,
                                                  java.lang.String unless)

      Returns an instance of Condition, or null if both ifc and unless are empty. In other words, it is useful if you use null or empty to denote true.

    - #### setIf

          public void setIf​(java.lang.String cond)

      Sets the if condition.
      Parameters:
        `cond` - the condition. Note: If null (not specified), it is considered effective.
      See Also:
        `isEffective(org.zkoss.zk.xel.Evaluator, org.zkoss.zk.ui.Component)`

    - #### setUnless

          public void setUnless​(java.lang.String cond)

      Sets the unless condition.
      Parameters:
        `cond` - the condition. Note: If null (not specified), it is considered ineffective.
      See Also:
        `isEffective(org.zkoss.zk.xel.Evaluator, org.zkoss.zk.ui.Component)`

    - #### isEffective

          public boolean isEffective​(Evaluator eval,
                                     Component comp)

      Used to evaluate whether it is effective.
      Parameters:
        `eval` - the evaluator to evaluate this condition
        `comp` - used as the self variable. Ignored if null.
      Since:
        3.0.0

    - #### isEffective

          public boolean isEffective​(Evaluator eval,
                                     Page page)

      Used to evaluate whether it is effective.
      Parameters:
        `eval` - the evaluator to evaluate this condition
        `page` - used as the self variable. Ignored if null.
      Since:
        3.0.0

    - #### isIf

          public boolean isIf()

      Returns whether it's If condition.
      Since:
        10.0.0

    - #### getIf

          public ExValue getIf()

      Returns If expression.
      Since:
        10.0.0

    - #### getUnless

          public ExValue getUnless()

      Returns Unless expression.
      Since:
        10.0.0

    - #### isUnless

          public boolean isUnless()

      Returns whether it's Unless condition.
      Since:
        10.0.0