Class OpenResourceDialog

The OpenResourceDialog class implements ResourceBrowserWindowBase for opening a resource in the library.

Hierarchy (view full)

Constructors

Properties

_libraryBrowser: UILibraryBrowser

Library browser UI element.

_onAction: ((isSaving: boolean, resource: ResourceEntry) => void)

Action called when the user choses a location or cancels.

_resourceNameTextBox: UITextField

Text box used to enter the resource name.

cancelAndClose: (() => void)

Cancel the operation and close the dialog.

onResourceDoubleClick: ((uiEntry: UILibraryEntry) => void)

Triggered when the user doubleclicks an entry.

onSelectionChanged: (() => void)

Triggered when the browser selection changes.

kWindowContentPadding: RectOffset

The default window content padding to be used for modal windows.

kWindowPadding: number

The default window padding to be used for modal windows.

Accessors

  • get contentHeight(): number
  • Returns the height of the content area of the window, in points. The content area represents the area of the window not including the title bar and the border.

    Returns number

  • set contentHeight(value): void
  • Parameters

    • value: number

    Returns void

  • get contentHeightInPixels(): number
  • Returns the height of the content area of the window, in pixels. The content area represents the area of the window not including the title bar and the border.

    Returns number

  • set contentHeightInPixels(value): void
  • Parameters

    • value: number

    Returns void

  • get contentWidth(): number
  • Returns the width of the content area of the window, in points. The content area represents the area of the window not including the title bar and the border.

    Returns number

  • set contentWidth(value): void
  • Parameters

    • value: number

    Returns void

  • get contentWidthInPixels(): number
  • Returns the width of the content area of the window, in pixels. The content area represents the area of the window not including the title bar and the border.

    Returns number

  • set contentWidthInPixels(value): void
  • Parameters

    • value: number

    Returns void

  • get dpiScale(): number
  • Returns the DPI scale factor.

    Returns number

    The DPI scale is in relation to a 1x base resolution of 75 DPI.

  • get height(): number
  • Sets the height of the window in points.

    Returns number

  • set height(value): void
  • Parameters

    • value: number

    Returns void

  • get heightInPixels(): number
  • Sets the height of the window in pixels.

    Returns number

  • set heightInPixels(value): void
  • Parameters

    • value: number

    Returns void

  • get isDestroyed(): boolean
  • Check whether the window was destroyed.

    Returns boolean

  • get isFocused(): boolean
  • Checks whether the window currently has keyboard focus.

    Returns boolean

  • set isFocused(value): void
  • Parameters

    • value: boolean

    Returns void

  • get keyWindow(): KeyWindowBase
  • Gets the key window which owns this window.

    Returns KeyWindowBase

  • get left(): number
  • Returns the X position of the window in screen coordinates in points.

    Returns number

  • get localShortcutContext(): ShortcutContext
  • Specifies the local shortcut context. This context will be automatically disabled whenever the user switches focus from the context.

    Returns ShortcutContext

  • get position(): Immutable<Vector2>
  • Determines the position in which the key window is, in screen coordinates.

    Returns Immutable<Vector2>

  • get renderWindow(): RenderWindow
  • Gets the RenderWindow associated with this EditorWindow.

    Returns RenderWindow

  • get shortcutContext(): ShortcutContext
  • Specifies the global shortcut context. This context will be always enabled as long as the window is active.

    Returns ShortcutContext

  • set title(value): void
  • Changes the text in the modal window title bar.

    Parameters

    Returns void

  • get top(): number
  • Returns the X position of the window in screen coordinates in points.

    Returns number

  • get ui(): UIPanel
  • Returns UIPanel

  • get width(): number
  • Sets the width of the window in points.

    Returns number

  • set width(value): void
  • Parameters

    • value: number

    Returns void

  • get widthInPixels(): number
  • Sets the width of the window in pixels.

    Returns number

  • set widthInPixels(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Adds an option to the resource browser window.

    Parameters

    • label: {
          __brand: "EditorI18N";
          compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
          trimString(value: string): string;
          trimStringEnd(value: string): string;
          trimStringStart(value: string): string;
      }

      The label for the option.

      • __brand: "EditorI18N"
      • compare:function
        • Compares two strings for equality by respecting the given comparison mode.

          Parameters

          • other: string

            The string to compare to.

          • mode: EnumValue<StringCompareMode, number>

            The mode to compare the string. Allows specifying how case sensitivity should be treated on the compare.

          Returns boolean

          True if the strings are considered equal for the given mode; false otherwise.

      • trimString:function
        • Trims the characters from the start and the end and returns the result as a new string.

          Parameters

          • value: string

          Returns string

      • trimStringEnd:function
        • Trims the characters from the end and returns the result as a new string.

          Parameters

          • value: string

          Returns string

      • trimStringStart:function
        • Trims the characters from the start and returns the result as a new string.

          Parameters

          • value: string

          Returns string

    • element: UIElementBase

      The element to add to the options form.

    Returns void

  • Get the parent folder of a resource, if it is a package, return the library root.

    Parameters

    • path: string

    Returns string

  • Implemented by the child class to handle the confirmation action.

    Returns ResourceEntry

    If this method returns a null, the operation will be aborted without closing the window. It is assumed that the child class displays a error or message to the user to inform why the action was canceled.

    If this method returns a valid object of type T, the operation will continue and the onAction handler will be called with the object.

  • Virtual

    Method to override to implement custom behavior of a window, called by the engine once per frame, once all the windows had their onEditorUpdate() method called.

    Returns void

  • Initializes the window content.

    Parameters

    • options: {
          defaultName: string;
          initialLibraryPathOrResourceEntry: string | ResourceEntry;
          message: {
              __brand: "EditorI18N";
              compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
              trimString(value: string): string;
              trimStringEnd(value: string): string;
              trimStringStart(value: string): string;
          };
          nameFieldLabel: {
              __brand: "EditorI18N";
              compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
              trimString(value: string): string;
              trimStringEnd(value: string): string;
              trimStringStart(value: string): string;
          };
          onAction: ((isSaving: boolean, resource: ResourceEntry) => void);
          resourceType: Type | EnumValue<ResourceType, number>;
          title: {
              __brand: "EditorI18N";
              compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
              trimString(value: string): string;
              trimStringEnd(value: string): string;
              trimStringStart(value: string): string;
          };
      }
      • defaultName: string
      • initialLibraryPathOrResourceEntry: string | ResourceEntry
      • message: {
            __brand: "EditorI18N";
            compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
            trimString(value: string): string;
            trimStringEnd(value: string): string;
            trimStringStart(value: string): string;
        }
        • __brand: "EditorI18N"
        • compare:function
          • Compares two strings for equality by respecting the given comparison mode.

            Parameters

            • other: string

              The string to compare to.

            • mode: EnumValue<StringCompareMode, number>

              The mode to compare the string. Allows specifying how case sensitivity should be treated on the compare.

            Returns boolean

            True if the strings are considered equal for the given mode; false otherwise.

        • trimString:function
          • Trims the characters from the start and the end and returns the result as a new string.

            Parameters

            • value: string

            Returns string

        • trimStringEnd:function
          • Trims the characters from the end and returns the result as a new string.

            Parameters

            • value: string

            Returns string

        • trimStringStart:function
          • Trims the characters from the start and returns the result as a new string.

            Parameters

            • value: string

            Returns string

      • nameFieldLabel: {
            __brand: "EditorI18N";
            compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
            trimString(value: string): string;
            trimStringEnd(value: string): string;
            trimStringStart(value: string): string;
        }
        • __brand: "EditorI18N"
        • compare:function
          • Compares two strings for equality by respecting the given comparison mode.

            Parameters

            • other: string

              The string to compare to.

            • mode: EnumValue<StringCompareMode, number>

              The mode to compare the string. Allows specifying how case sensitivity should be treated on the compare.

            Returns boolean

            True if the strings are considered equal for the given mode; false otherwise.

        • trimString:function
          • Trims the characters from the start and the end and returns the result as a new string.

            Parameters

            • value: string

            Returns string

        • trimStringEnd:function
          • Trims the characters from the end and returns the result as a new string.

            Parameters

            • value: string

            Returns string

        • trimStringStart:function
          • Trims the characters from the start and returns the result as a new string.

            Parameters

            • value: string

            Returns string

      • onAction: ((isSaving: boolean, resource: ResourceEntry) => void)
          • (isSaving, resource): void
          • Parameters

            Returns void

      • resourceType: Type | EnumValue<ResourceType, number>
      • title: {
            __brand: "EditorI18N";
            compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
            trimString(value: string): string;
            trimStringEnd(value: string): string;
            trimStringStart(value: string): string;
        }
        • __brand: "EditorI18N"
        • compare:function
          • Compares two strings for equality by respecting the given comparison mode.

            Parameters

            • other: string

              The string to compare to.

            • mode: EnumValue<StringCompareMode, number>

              The mode to compare the string. Allows specifying how case sensitivity should be treated on the compare.

            Returns boolean

            True if the strings are considered equal for the given mode; false otherwise.

        • trimString:function
          • Trims the characters from the start and the end and returns the result as a new string.

            Parameters

            • value: string

            Returns string

        • trimStringEnd:function
          • Trims the characters from the end and returns the result as a new string.

            Parameters

            • value: string

            Returns string

        • trimStringStart:function
          • Trims the characters from the start and returns the result as a new string.

            Parameters

            • value: string

            Returns string

    Returns void

  • Virtual

    Called whenever window visibility changed.

    Parameters

    • isVisible: boolean

    Returns void

    Implementing classes must call super.

  • Virtual

    Triggered whenever the window gains or loses focus.

    Parameters

    • inFocus: boolean

      True if focus was gained, false otherwise.

    Returns void

  • Virtual

    Triggered whenever the window size changes.

    Parameters

    • width: number

      New width of the window in pixels.

    • height: number

      New height of the window in pixels.

    Returns void

  • Performs LibraryBrowser.paste operation. Elements will be pasted in the currently selected directory (if any), or the active directory otherwise.

    Returns void

  • Starts a rename operation on the currently selected elements. If more than one elements are selected only the first one will be affected.

    Returns void

  • Defines the window maximum width and height in points.

    Parameters

    • maxWidth: number
    • maxHeight: number

    Returns void

  • Defines the window minimum width and height in points.

    Parameters

    • minWidth: number

      The minimum width of the window in points.

    • minHeight: number

      The minimum height of the window in points.

    Returns void

  • Moves the window on the desktop. Coordinates are in screen space using points.

    Parameters

    • x: number
    • y: number

    Returns void

  • Resizes the window using a width and height in points.

    Parameters

    • width: number
    • height: number

    Returns void

  • Open the resource browser window.

    Parameters

    • parentWindow: KeyWindowBase | EditorWindow

      The parent window.

    • resourceType: Type | EnumValue<ResourceType, number>

      The optional resource type.

    • title: {
          __brand: "EditorI18N";
          compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
          trimString(value: string): string;
          trimStringEnd(value: string): string;
          trimStringStart(value: string): string;
      }

      The title to display on the window bar.

      • __brand: "EditorI18N"
      • compare:function
        • Compares two strings for equality by respecting the given comparison mode.

          Parameters

          • other: string

            The string to compare to.

          • mode: EnumValue<StringCompareMode, number>

            The mode to compare the string. Allows specifying how case sensitivity should be treated on the compare.

          Returns boolean

          True if the strings are considered equal for the given mode; false otherwise.

      • trimString:function
        • Trims the characters from the start and the end and returns the result as a new string.

          Parameters

          • value: string

          Returns string

      • trimStringEnd:function
        • Trims the characters from the end and returns the result as a new string.

          Parameters

          • value: string

          Returns string

      • trimStringStart:function
        • Trims the characters from the start and returns the result as a new string.

          Parameters

          • value: string

          Returns string

    • message: {
          __brand: "EditorI18N";
          compare(other: string, mode: EnumValue<StringCompareMode, number>): boolean;
          trimString(value: string): string;
          trimStringEnd(value: string): string;
          trimStringStart(value: string): string;
      }

      The message to display above the name field.

      • __brand: "EditorI18N"
      • compare:function
        • Compares two strings for equality by respecting the given comparison mode.

          Parameters

          • other: string

            The string to compare to.

          • mode: EnumValue<StringCompareMode, number>

            The mode to compare the string. Allows specifying how case sensitivity should be treated on the compare.

          Returns boolean

          True if the strings are considered equal for the given mode; false otherwise.

      • trimString:function
        • Trims the characters from the start and the end and returns the result as a new string.

          Parameters

          • value: string

          Returns string

      • trimStringEnd:function
        • Trims the characters from the end and returns the result as a new string.

          Parameters

          • value: string

          Returns string

      • trimStringStart:function
        • Trims the characters from the start and returns the result as a new string.

          Parameters

          • value: string

          Returns string

    • onAction: ((isSuccess: boolean, resourceEntry: ResourceEntry) => void)

      Action executed when the user confirms or cancels the operation.

        • (isSuccess, resourceEntry): void
        • Parameters

          Returns void

    • OptionalinitialLibraryPathOrResourceEntry: string | ResourceEntry

      The optional initial library path or ResourceEntry to select.

    Returns OpenResourceDialog

Events

onResized: Event<[number, number], void>

Triggered whenever widget size changes.

onFocusChangedInternal: Event<[boolean], void>