Package snap.view

Class WindowView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
PopupWindow

public class WindowView extends ParentView
A class to manage a Window.
  • Field Details

  • Constructor Details

    • WindowView

      public WindowView()
      Creates a WindowView.
  • Method Details

    • getTitle

      public String getTitle()
      Returns the title of the window.
    • setTitle

      public void setTitle(String aValue)
      Sets the title of the window.
    • getType

      public String getType()
      Returns the window type.
    • setType

      public void setType(String aType)
      Sets the window type.
    • isResizable

      public boolean isResizable()
      Returns whether the window is resizable.
    • setResizable

      public void setResizable(boolean aValue)
      Sets whether the window is resizable (default to true).
    • isMaximized

      public boolean isMaximized()
      Returns whether the window is sized to maximum screen size.
    • setMaximized

      public void setMaximized(boolean aValue)
      Sets whether the window is sized to maximum screen size.
    • getMaximizedBounds

      public Rect getMaximizedBounds()
      Returns the window max size.
    • setMaximizedBounds

      public void setMaximizedBounds(Rect aRect)
      Sets the bounds rect to use when window is maximized (uses ViewEnv ScreenBoundsInset by default).
    • getSaveName

      public String getSaveName()
      Returns the save name.
    • setSaveName

      public void setSaveName(String aName)
      Sets the save name.
    • isSaveSize

      public boolean isSaveSize()
      Returns whether to save size
    • setSaveSize

      public void setSaveSize(boolean aValue)
      Sets whether to save size.
    • saveFrame

      public void saveFrame()
      Save frame.
    • getRootView

      public RootView getRootView()
      Returns the root view.
      Overrides:
      getRootView in class View
    • getContent

      public View getContent()
      Returns the content associated with this window.
    • setContent

      public void setContent(View aView)
      Sets the content associated with this window.
    • getContentNative

      public Object getContentNative()
      Returns the native for the window content.
    • isAlwaysOnTop

      public boolean isAlwaysOnTop()
      Returns whether the window is always on top.
    • setAlwaysOnTop

      public void setAlwaysOnTop(boolean aValue)
      Sets whether the window is always on top.
    • getDocURL

      public WebURL getDocURL()
      Returns the document file URL for the window title bar proxy icon.
    • setDocURL

      public void setDocURL(WebURL aURL)
      Returns the document file URL for the window title bar proxy icon.
    • getImage

      public Image getImage()
      Returns the icon image for the window.
    • setImage

      public void setImage(Image anImage)
      Sets the icon image for the window.
    • isHideOnDeactivate

      public boolean isHideOnDeactivate()
      Returns whether the window will hide on deactivate.
    • setHideOnDeactivate

      public void setHideOnDeactivate(boolean aValue)
      Sets whether the window will hide on deacativate.
    • isModal

      public boolean isModal()
      Returns the modal mode of the window.
    • setModal

      public void setModal(boolean aValue)
      Sets the modal mode of the window (defaults to false).
    • getFocusedView

      public View getFocusedView()
      Returns the view that currently receives KeyEvents.
    • getFocusedViewLast

      public View getFocusedViewLast()
      Returns the previous focus view.
    • requestFocus

      protected void requestFocus(View aView)
      Tries to makes the given view the view that receives KeyEvents.
    • getHelper

      public WindowView.WindowHpr getHelper()
      Returns the view helper.
    • initNativeWindow

      protected void initNativeWindow()
      Initializes the native window.
    • showCentered

      public void showCentered(View aView)
      Shows window in center of given view.
    • show

      public void show(View aView, double aX, double aY)
      Show the window relative to given view and View X/Y (screen x/y if view is null).
    • show

      public void show()
      Shows window in center of screen.
    • hide

      public void hide()
      Hide the window.
    • getClientView

      public View getClientView()
      Returns the view associated with the last show() call.
    • pack

      public void pack()
      Packs the window.
    • toFront

      public void toFront()
      Order window to front.
    • getScreenLocation

      public Point getScreenLocation(View aView, Pos aPos, double aDX, double aDY)
      Returns the screen location for given view, position and offsets.
    • getWindow

      public WindowView getWindow()
      Override to return this window.
      Overrides:
      getWindow in class View
    • relayout

      public void relayout()
      Override to do layout immediately.
      Overrides:
      relayout in class ParentView
    • repaint

      public void repaint(double aX, double aY, double aW, double aH)
      Override to change to root view.
      Overrides:
      repaint in class View
    • isVisible

      public boolean isVisible()
      Override to return showing, since it is eqivalent for window.
      Overrides:
      isVisible in class View
    • setVisible

      public void setVisible(boolean aValue)
      Override to call show/hide.
      Overrides:
      setVisible in class View
    • setShowing

      protected void setShowing(boolean aValue)
      Override to update global windows list.
      Overrides:
      setShowing in class ParentView
    • setFocused

      protected void setFocused(boolean aValue)
      Override to move window to front of all windows list.
      Overrides:
      setFocused in class View
    • getActiveCursor

      public Cursor getActiveCursor()
      Returns the active cursor.
    • setActiveCursor

      public void setActiveCursor(Cursor aCursor)
      Sets the current cursor.
    • resetActiveCursor

      public void resetActiveCursor()
      Resets the active cursor.
    • getToolTip

      public String getToolTip(ViewEvent anEvent)
      Override to try to get tool tip from mouse over stack.
      Overrides:
      getToolTip in class View
    • getDispatcher

      public EventDispatcher getDispatcher()
      Returns the EventDispatcher.
    • dispatchEventToWindow

      public void dispatchEventToWindow(ViewEvent anEvent)
      Dispatch event.
    • getUpdater

      public ViewUpdater getUpdater()
      Returns the Updater.
      Overrides:
      getUpdater in class View
    • getPopup

      public PopupWindow getPopup()
      Returns the popup window, if one was added to root view during last event.
    • setPopup

      protected void setPopup(PopupWindow aPopup)
      Sets the popup window, if one added to this root view during last event.
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Returns the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Layout children.
      Overrides:
      layoutImpl in class ParentView
    • getOpenWindows

      public static WindowView[] getOpenWindows()
      Returns an array of all open windows.
    • getOpenWindowOwner

      public static <T extends ViewOwner> T getOpenWindowOwner(Class<T> aClass)
      Returns an array of all open windows.
    • getOpenWindowOwners

      public static <T extends ViewOwner> T[] getOpenWindowOwners(Class<T> aClass)
      Returns an array of all open windows.