Class ViewThemes

java.lang.Object
com.iizigo.panel.ViewThemes

public final class ViewThemes extends Object
The themes a panel is shown in outside the Panel Editor's own page: in the Design Viewer, in the Panel View of a Browser and in Cast to Device (CC-FIX-DESIGNVIEWER-THEME, order 576).

A panel's themes ($themes), masked by its folders' and by the application themes, are a FILTER of what may be shown; the client has the final say within it. Before this class a view opened a panel in the theme the panel's editor properties had saved, else in the LAST theme any editor used (PanelEditor.getLastThemes): ServerAdmin's userDetails, whose themes name flat alone and whose file saved no theme, opened in dbootstrap after a details dialog had been edited in dbootstrap, while the Panel Editor showed it in flat and the server renders it in flat.

Now a view shows a panel as the Panel Designer shows it when the panel is open in an editor - the themes its "Theme and Client" menu shows, within the filter - and otherwise as the server shows it to a Browser of the connecting client's device class: the panel's themes masked by its folders and the application themes, the application's default theme of each type first, then by priority (ClientSessionGyro.setThemes). A theme= parameter of the view's URL (iiziRun Developer's choice from the list the panel allows) is honored when the filter holds it and otherwise ignored with a WARNING.

Author:
Christopher Mindus
  • Method Summary

    Modifier and Type
    Method
    Description
    static GThemes
    filter(GThemes panelThemes, GThemes masked, GThemes appThemes, GThemes device)
    Computes the filter from its parts: the session's selection is the device class filtered by the application themes (unfiltered when they have nothing in common, as ClientSessionGyro.applyApplicationThemes); the panel's masked themes narrowed by it, else the panel's own themes narrowed by it, else the panel's best theme of its type (ClientSessionGyro.getFallbackThemes).
    static GThemes
    filter(UIPanelBase panel, ModuleApp app, EnvProps env)
    Computes the themes filter of a panel in a view: its themes masked by its folders (as the server masks them) and by the application themes, narrowed to the connecting client's device class when the panel is not open in an editor, with the server's fallbacks when the masks have nothing in common.
    static GThemes
    parse(String shown)
    Parses the themes the Panel Editor shows, "desktop,mobile": a named mobile theme makes them mobile (the desktop part is then every desktop theme, the client forces flat), none makes them desktop with the named desktop theme.
    static String
    resolve(GThemes filter, GThemes defaults, String shown, String requested)
    Resolves the client themes string ("desktop list,mobile") a view sends a panel's client.
  • Method Details

    • filter

      public static GThemes filter(UIPanelBase panel, ModuleApp app, EnvProps env)
      Computes the themes filter of a panel in a view: its themes masked by its folders (as the server masks them) and by the application themes, narrowed to the connecting client's device class when the panel is not open in an editor, with the server's fallbacks when the masks have nothing in common.
      Parameters:
      panel - The panel.
      app - The module application of the panel's project.
      env - The environment of the client the panel is shown to, for its device class as the server reads it; null when the panel is open in an editor: the view then mirrors the editor's type too.
      Returns:
      The filter, never null and never a null-mask.
    • filter

      public static GThemes filter(GThemes panelThemes, GThemes masked, GThemes appThemes, GThemes device)
      Computes the filter from its parts: the session's selection is the device class filtered by the application themes (unfiltered when they have nothing in common, as ClientSessionGyro.applyApplicationThemes); the panel's masked themes narrowed by it, else the panel's own themes narrowed by it, else the panel's best theme of its type (ClientSessionGyro.getFallbackThemes).
      Parameters:
      panelThemes - The panel's own themes, null for none configured.
      masked - The panel's themes masked by its folders, null for none.
      appThemes - The application themes, null for all.
      device - The device class's default themes (GThemes.DEFAULT_DESKTOP or GThemes.DEFAULT_MOBILE), null for no device narrowing.
      Returns:
      The filter, never null and never a null-mask.
    • resolve

      public static String resolve(GThemes filter, GThemes defaults, String shown, String requested)
      Resolves the client themes string ("desktop list,mobile") a view sends a panel's client. Without an editor: the filter's themes with the application's default theme of each type first, the others by priority - the client keeps the theme it is in when the list allows it and otherwise takes the first name it knows, so the first name is the one a view starts in (the server's rule). With the panel open in an editor: the theme the editor shows, ALONE, when the filter holds it - the editor has the final say while the panel is open, and the view flips with its menu as the Designer page does - else the filter's list. A requested theme comes first (alone, with an editor) when the filter holds it.

      When the editor shows the panel, the themes it shows decide the type too: a filter open to both types is narrowed to the type the editor shows (no mobile theme = desktop), so that the view renders the panel as the Designer page does.

      Parameters:
      filter - The filter (filter(UIPanelBase, ModuleApp, EnvProps)); null or a null-mask means every theme.
      defaults - The application's default themes, null for none.
      shown - The themes the Panel Editor shows as "desktop,mobile" (its getThemes()), null when the panel is not open in an editor.
      requested - The theme name requested by the view's URL (theme=), null for none.
      Returns:
      The client themes string.
    • parse

      public static GThemes parse(String shown)
      Parses the themes the Panel Editor shows, "desktop,mobile": a named mobile theme makes them mobile (the desktop part is then every desktop theme, the client forces flat), none makes them desktop with the named desktop theme. An unknown or misplaced name counts as none.
      Parameters:
      shown - The themes as "desktop,mobile".
      Returns:
      The themes, never null.