Package org.zkoss.zk.ui.ext

## Interface Scope

- All Known Subinterfaces:
    `Component`, `Desktop`, `Execution`, `IdSpace`, `Macro`, `Page`, `Session`, `WebApp`
  All Known Implementing Classes:
    `A`, `A`, `Abbr`, `Absolutechildren`, `Absolutelayout`, `AbstractComponent`, `AbstractExecution`, `AbstractPage`, `AbstractTag`, `AbstractWebApp`, `Address`, `Anchorchildren`, `Anchorlayout`, `Anchornav`, `Apply`, `Area`, `Area`, `Article`, `Aside`, `Audio`, `Audio`, `Auxhead`, `Auxheader`, `B`, `Bandbox`, `Bandpopup`, `Barcode`, `Barcodescanner`, `Base`, `Bdi`, `Bdo`, `Biglistbox`, `Blockquote`, `Body`, `Borderlayout`, `Box`, `Br`, `Button`, `Button`, `Calendar`, `Camera`, `Canvas`, `Captcha`, `Caption`, `Caption`, `Cardlayout`, `Cascader`, `Cell`, `Center`, `Chart`, `Checkbox`, `Choose`, `Chosenbox`, `Cite`, `Coachmark`, `Code`, `Col`, `Colgroup`, `Colorbox`, `Column`, `Columnchildren`, `Columnlayout`, `Columns`, `Combobox`, `Combobutton`, `Comboitem`, `ContentTag`, `Cropper`, `Data`, `Datalist`, `Datebox`, `DateTimeFormatInputElement`, `Dd`, `Decimalbox`, `Del`, `DesktopImpl`, `Detail`, `Details`, `Dfn`, `Dialog`, `Div`, `Div`, `Dl`, `Doublebox`, `Doublespinner`, `Drawer`, `Dropupload`, `Dt`, `East`, `Em`, `Embed`, `ExecutionImpl`, `Fieldset`, `Figcaption`, `Figure`, `Fileupload`, `Fileupload`, `FileuploadDlg`, `Fisheye`, `Fisheyebar`, `Foot`, `Footer`, `Footer`, `FooterElement`, `ForEach`, `Form`, `FormatInputElement`, `Frozen`, `GoldenLayout`, `GoldenPanel`, `Grid`, `Group`, `Groupbox`, `Groupfoot`, `H1`, `H2`, `H3`, `H4`, `H5`, `H6`, `Hbox`, `Head`, `Header`, `HeaderElement`, `HeadersElement`, `Hgroup`, `Hlayout`, `Hr`, `Html`, `Html`, `HtmlBasedComponent`, `HtmlMacroComponent`, `HtmlNativeComponent`, `HtmlShadowElement`, `I`, `Idspace`, `If`, `Iframe`, `Iframe`, `Image`, `Imagemap`, `Img`, `Include`, `Input`, `InputElement`, `Inputgroup`, `Ins`, `Intbox`, `IStubComponent`, `IStubsComponent`, `Jasperreport`, `Kbd`, `Label`, `Label`, `LabelElement`, `LabelImageElement`, `Layout`, `LayoutRegion`, `Legend`, `Li`, `Lineitem`, `Linelayout`, `Link`, `Listbox`, `Listcell`, `Listfoot`, `Listfooter`, `Listgroup`, `Listgroupfoot`, `Listhead`, `Listheader`, `Listitem`, `Longbox`, `Main`, `Map`, `Mark`, `Menu`, `Menu`, `Menubar`, `Menuitem`, `Menupopup`, `Menuseparator`, `MeshElement`, `MeshElement.InternalPaging`, `MessageboxDlg`, `MessageboxDlg.Button`, `Meta`, `Meter`, `Multislider`, `Nav`, `Nav`, `Navbar`, `Navitem`, `Navseparator`, `NoDOM`, `North`, `Noscript`, `NumberInputElement`, `Object`, `Ol`, `Optgroup`, `Option`, `Organigram`, `Orgchildren`, `Orgitem`, `Orgnode`, `Otherwise`, `Output`, `P`, `PageImpl`, `Paging`, `Panel`, `Panelchildren`, `Pdfviewer`, `Picture`, `Popup`, `Portalchildren`, `Portallayout`, `Pre`, `Progress`, `Progressmeter`, `Q`, `Radio`, `Radiogroup`, `Rangeslider`, `Rating`, `Raw`, `Row`, `Rowchildren`, `Rowlayout`, `Rows`, `Rp`, `Rt`, `Ruby`, `S`, `Samp`, `Script`, `Script`, `Scrollview`, `Searchbox`, `Section`, `Select`, `Selectbox`, `Separator`, `SerializableSession`, `Signature`, `SimpleScope`, `SimpleSession`, `SimpleWebApp`, `Slider`, `Sliderbuttons`, `Slot`, `Small`, `Source`, `South`, `Space`, `Span`, `Span`, `Spinner`, `Splitlayout`, `Splitter`, `Step`, `Stepbar`, `Strong`, `StubComponent`, `StubsComponent`, `Style`, `Style`, `Sub`, `Summary`, `Sup`, `SynchronizedScope`, `Tab`, `Tabbox`, `Table`, `Tablechildren`, `Tablelayout`, `Tabpanel`, `Tabpanels`, `Tabs`, `Tbeditor`, `Tbody`, `Td`, `Template`, `TemplateBasedShadowElement`, `Text`, `Textarea`, `Textbox`, `Tfoot`, `Th`, `Thead`, `Time`, `Timebox`, `Timepicker`, `Timer`, `Title`, `Toolbar`, `Toolbarbutton`, `Tr`, `Track`, `Track`, `Transformer`, `Tree`, `Treecell`, `Treechildren`, `Treecol`, `Treecols`, `Treefoot`, `Treefooter`, `Treeitem`, `Treerow`, `U`, `Ul`, `Var`, `Vbox`, `Video`, `Video`, `Vlayout`, `VolatileComponent`, `VolatileIPage`, `VolatileIStubsComponent`, `VolatilePage`, `Wbr`, `West`, `When`, `Window`, `XmlMacroComponent`, `XmlNativeComponent`, `XulElement`, `Zkhead`

      public interface Scope

  Represents a scope of attributes.

  In ZK, directly acquiring a lock on a scope for synchronization is uncommon. This method `Scopes.getLockForScopeIfAny(Scope)` provides a reliable way to obtain a consistent lock object associated with a specific scope, ensuring that synchronization is consistently managed across different parts of the application.

  Since:
    3.6.0
  Author:
    tomyeh
  See Also:
    `SimpleScope`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `addScopeListener​(ScopeListener listener)` | Adds a listener to listen whether this scope is changed.
    `java.lang.Object` | `getAttribute​(java.lang.String name)` | Returns the custom attribute associated with this object (scope).
    `java.lang.Object` | `getAttribute​(java.lang.String name, boolean recurse)` | Returns the custom attribute associated with this object.
    `java.util.Map<java.lang.String,​java.lang.Object>` | `getAttributes()` | Returns all custom attributes associated with this object (scope).
    `boolean` | `hasAttribute​(java.lang.String name)` | Returns if a custom attribute is associated with this object (scope).
    `boolean` | `hasAttribute​(java.lang.String name, boolean recurse)` | Returns if a custom attribute is associated with this object.
    `java.lang.Object` | `removeAttribute​(java.lang.String name)` | Removes the attribute from the current scope if any.
    `java.lang.Object` | `removeAttribute​(java.lang.String name, boolean recurse)` | Removes the custom attribute associated with this scope.
    `boolean` | `removeScopeListener​(ScopeListener listener)` | Removes a change listener from this scope.
    `java.lang.Object` | `setAttribute​(java.lang.String name, java.lang.Object value)` | Sets (a.k.a., associates) the value for a custom attribute with this object (scope).
    `java.lang.Object` | `setAttribute​(java.lang.String name, java.lang.Object value, boolean recurse)` | Sets the custom attribute associated with this scope, or the parent scope.

- - ### Method Detail

    - #### getAttributes

          java.util.Map<java.lang.String,​java.lang.Object> getAttributes()

      Returns all custom attributes associated with this object (scope).

    - #### getAttribute

          java.lang.Object getAttribute​(java.lang.String name)

      Returns the custom attribute associated with this object (scope).

    - #### getAttribute

          java.lang.Object getAttribute​(java.lang.String name,
                                        boolean recurse)

      Returns the custom attribute associated with this object.
      Parameters:
        `recurse` - whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
      Since:
        5.0.0

    - #### hasAttribute

          boolean hasAttribute​(java.lang.String name)

      Returns if a custom attribute is associated with this object (scope).

      Notice that `null` is a valid value, so you can tell if an attribute is associated by examining the return value of `getAttribute(java.lang.String)`.

      Since:
        5.0.0

    - #### hasAttribute

          boolean hasAttribute​(java.lang.String name,
                               boolean recurse)

      Returns if a custom attribute is associated with this object.

      Notice that `null` is a valid value, so you can tell if an attribute is associated by examining the return value of `getAttribute(java.lang.String)`.

      Parameters:
        `recurse` - whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
      Since:
        5.0.0

    - #### setAttribute

          java.lang.Object setAttribute​(java.lang.String name,
                                        java.lang.Object value)

      Sets (a.k.a., associates) the value for a custom attribute with this object (scope).
      Returns:
        the previous value associated with the attribute, if any
      Since:
        5.0.0

    - #### setAttribute

          java.lang.Object setAttribute​(java.lang.String name,
                                        java.lang.Object value,
                                        boolean recurse)

      Sets the custom attribute associated with this scope, or the parent scope.
      Parameters:
        `recurse` - whether to look up the parent scope for the existence of the attribute.
        If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is replaced. Otherwise, it is the same as `setAttribute(String,Object)`.
      Since:
        5.0.0

    - #### removeAttribute

          java.lang.Object removeAttribute​(java.lang.String name)

      Removes the attribute from the current scope if any.
      Returns:
        the previous value associated with the attribute, if any,
      Since:
        5.0.0

    - #### removeAttribute

          java.lang.Object removeAttribute​(java.lang.String name,
                                           boolean recurse)

      Removes the custom attribute associated with this scope.
      Parameters:
        `recurse` - whether to look up the parent scope for the existence of the attribute.
        If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is removed. Otherwise, it is the same as `removeAttribute(String)`.
      Since:
        5.0.0

    - #### addScopeListener

          boolean addScopeListener​(ScopeListener listener)

      Adds a listener to listen whether this scope is changed. The listener is called when a custom attribute is added, removed, or the parent is changed.
      Returns:
        weather the listener is added successfully. Note: if the resolver was added before, it won't be added again and this method returns false.
      Since:
        5.0.0

    - #### removeScopeListener

          boolean removeScopeListener​(ScopeListener listener)

      Removes a change listener from this scope.
      Returns:
        false if listener is not added before.
      Since:
        5.0.0