Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101218

Window should use hide()/show()/isShowing() style API, not setVisible()/isVisible()

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.0
    • Component/s: javafx

      Description

      We currently have a funny state where we have a protected "isVisible" for Window and a mix of "visible" API and "show/hide" API in Window. Visibility is normally tested with isShowing() for "hide/show" style API, but isVisible() is used in Window. So, to be consistent, we need to get rid of the "visible" API from Window and Stage (isVisible() and setVisible()) and add isShowing().

      Since MenuItem and TableColumn are "view model" classes, I think they can stay the same. The rule would be "show/hide" for Window objects, "setVisible()" for everything else.

      Here are the Fx API classes that implement the setVisible(), isVisible():

      javafx.scene.Node.setVisible(boolean)
      javafx.scene.control.MenuItem.setVisible(boolean)
      javafx.scene.control.TableColumn.setVisible(boolean)
      javafx.stage.Stage.setVisible(boolean)
      javafx.stage.Window.setVisible(boolean) (NOTE: method is protected but protected is API)

      javafx.scene.Node.isVisible()
      javafx.scene.control.MenuItem.isVisible()
      javafx.scene.control.TableColumn.isVisible()
      javafx.stage.Window.isVisible()

      Here are the Fx API classes that implement show(), hide(), isShowing(), showingProperty():

      javafx.scene.control.ChoiceBox.show()
      javafx.scene.control.ContextMenu.show(Node, double, double)
      javafx.scene.control.ContextMenu.show(Node, Side, double, double)
      javafx.scene.control.Menu.show()
      javafx.scene.control.MenuButton.show()
      javafx.stage.PopupWindow.show(Node, double, double)
      javafx.stage.PopupWindow.show(Window, double, double)
      javafx.stage.PopupWindow.show(Window)

      javafx.scene.control.ChoiceBox.hide()
      javafx.scene.control.ContextMenu.hide()
      javafx.scene.control.Menu.hide()
      javafx.scene.control.MenuButton.hide()
      javafx.stage.PopupWindow.hide()
      javafx.stage.Window.hide()

      javafx.scene.control.ChoiceBox.isShowing()
      javafx.scene.control.Menu.isShowing()
      javafx.scene.control.MenuButton.isShowing()

      javafx.scene.control.ChoiceBox.showingProperty()
      javafx.scene.control.Menu.showingProperty()
      javafx.scene.control.MenuButton.showingProperty()

      Here are the events for hide() and show() (ignoring the setOnXXX methods, one for each property):

      javafx.scene.control.Menu.onHiddenProperty()
      javafx.stage.Window.onHiddenProperty()

      javafx.scene.control.Menu.onHidingProperty()
      javafx.stage.Window.onHidingProperty()

      javafx.scene.control.Menu.onShowingProperty()
      javafx.stage.Window.onShowingProperty()

      javafx.scene.control.Menu.onShownProperty()
      javafx.stage.Window.onShownProperty()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rbair Richard Bair
                Reporter:
                snorthov Steve Northover (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: