Class HorizontalSplitter

java.lang.Object
com.jbstrap.core.messagebus.MessageBus
com.jbstrap.ui.Component<HorizontalSplitter>
com.jbstrap.ui.components.layout.splitter.HorizontalSplitter
All Implemented Interfaces:
Animatable<HorizontalSplitter>, CanDrop<HorizontalSplitter>, Draggable<HorizontalSplitter>, HandleMouseEvents<HorizontalSplitter>, Scrollable<HorizontalSplitter>

Horizontally adjustable splitter component

The component enables you to visualize two containers next to each other on the interface where you can insert components arbitrarily. You may enter a default size for the container, however, it is also possible to resize the both containers by moving the separator to left or to the right. The size of both containers always changes simultaneously, that is, if the container to the right shrinks, the one to the left increases.

You may set a minimum and a maximum size for the container that cannot be overridden by the user.

Supported events:

AnimationStart AnimationEnd, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, Scrollable Drop, DragStart, DragEnd

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • HorizontalSplitter

      public HorizontalSplitter()

      Creates a horizontal splitter component

      The containers of the component will be created with a width value of 50%, that is, the containers on the right and on the left will be of the same size.

    • HorizontalSplitter

      public HorizontalSplitter(String id)

      Creates a horizontal splitter component with the specified ID

      The containers of the component will be created with a width value of 50%, that is, the containers on the right and on the left will be of the same size.

      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
  • Method Details

    • init

      public void init() throws JavaScriptLoadError
      Description copied from class: Component
      The component initialization method.

      Empty method, only needs to be overwritten when making a custom component, that needs to call an initializing JavaScript on the client side. The method is called by the framework after the component is drawn, but before the afterDraw() method. The use of this method during application development is not allowed. This method is meant for inner use only.

      Overrides:
      init in class Component<HorizontalSplitter>
      Throws:
      JavaScriptLoadError - If there was a JavaScript error during the initialization.
    • addComponent

      public HorizontalSplitter addComponent(Component<?> component)

      No further components may be added to the splitter component.

      In order to place a component into the container on the left, use the method addLeftComponent. In order to place a component into the container on the right, use the method addRightComponent.

      Overrides:
      addComponent in class Component<HorizontalSplitter>
      Parameters:
      component - The component to be added
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Thrown upon every method calling
    • addComponents

      public HorizontalSplitter addComponents(Component<?>... components)

      No further components may be added to the splitter component.

      In order to place a component into the container on the left, use the method addLeftComponent. In order to place a component into the container on the right, use the method addRightComponent.

      Overrides:
      addComponents in class Component<HorizontalSplitter>
      Parameters:
      components - The instances of the new, to be added components
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Thrown upon every method calling
    • removeComponent

      public HorizontalSplitter removeComponent(Component<?> component)

      No subcomponent can be removed from the splitter component.

      In order to remove a component from the container to the left, use the method removeLeftComponent. In order to remove a component from the container to the right, use the method removeRightComponent.

      Overrides:
      removeComponent in class Component<HorizontalSplitter>
      Parameters:
      component - The component instance
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Thrown every time the method is called.
    • removeComponents

      public HorizontalSplitter removeComponents(Component<?>... components)

      No subcomponent can be removed from the splitter component.

      In order to remove a component from the container to the left, use the method removeLeftComponents. In order to remove a component from the container to the right, use the method removeRightComponents.

      Overrides:
      removeComponents in class Component<HorizontalSplitter>
      Parameters:
      components - The components that will be removed
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Thrown every time the method is called.
    • addLeftComponent

      public HorizontalSplitter addLeftComponent(Component<?> component)
      Adds a component to the left component of the splitter component
      Parameters:
      component - An instance of the component we want to add to the left container of the splitter
      Returns:
      The horizontal splitter component
    • addLeftComponents

      public HorizontalSplitter addLeftComponents(Component<?>... components)
      Adds multiple components to the left container of the splitter
      Parameters:
      components - Instances of the components we want to add to the left container The components will be added according to the order here specified.
      Returns:
      The horizontal splitter component
    • removeLeftComponent

      public HorizontalSplitter removeLeftComponent(Component<?> component)
      Removes a component from the left container of the splitter component
      Parameters:
      component - An instance of the component to be removed
      Returns:
      The horizontal splitter component
    • removeLeftComponents

      public HorizontalSplitter removeLeftComponents(Component<?>... components)
      Removes multiple components from the left container of the splitter
      Parameters:
      components - An enumeration of component instances to be removed
      Returns:
      The horizontal splitter component
    • addRightComponent

      public HorizontalSplitter addRightComponent(Component<?> component)
      Adds a component to the right container of the splitter component
      Parameters:
      component - An instance of the component we want to add to the right container of the splitter
      Returns:
      The horizontal splitter component
    • addRightComponents

      public HorizontalSplitter addRightComponents(Component<?>... components)
      Adds multiple components to the right container of the splitter
      Parameters:
      components - Instances of the components we want to add to the right container The components will be added according to the order here specified.
      Returns:
      The horizontal splitter component
    • removeRightComponent

      public HorizontalSplitter removeRightComponent(Component<?> component)
      Removes a component from the right container of the splitter component
      Parameters:
      component - An instance of the component to be removed
      Returns:
      The horizontal splitter component
    • removeRightComponents

      public HorizontalSplitter removeRightComponents(Component<?>... components)
      Removes multiple components from the right container of the splitter
      Parameters:
      components - An enumeration of component instances to be removed
      Returns:
      The horizontal splitter component
    • afterDraw

      public void afterDraw()
      Description copied from class: Component
      The operations to be executed after the drawing of the component

      By default, this is an empty method. It has to be overwritten on a component or page if additional operations have to be executed after the drawing process. One such operation is data retrieval, which shouldn't run in constructors so that the user could see results of an operation or navigation process.

      Overrides:
      afterDraw in class Component<HorizontalSplitter>
    • redraw

      public HorizontalSplitter redraw()
      Description copied from class: Component
      Redraws the component.

      All changes on the components, (even after drawing) are applied automatically. So for this reason, the components don't have to be redrawn. However, sometimes it is necessary to redraw the entire component. If this method is used, the component and all of its subcomponents will be re-sent to the client-side and the components will be re-initialized, a process that can take a significant amount of time, not to mention burden the communication channels. The use of this method for these reasons is not recommended.

      Overrides:
      redraw in class Component<HorizontalSplitter>
      Returns:
      The component
    • getMinSize

      public String getMinSize()
      Gets the minimum width of the splitter component’s left container
      Returns:
      The minimum width of the splitter component’s left container as provided or null if there is no minimum width set, that is, the user may shrink the left container to any size.
    • setMinSize

      public HorizontalSplitter setMinSize(String minSize)
      Sets the minimum width of the splitter component’s left container If the value null is set, the minimum width of the container will not be limited.
      Parameters:
      minSize - The minimum width of the left container as defined by the CSS3 standard
      Returns:
      The horizontal splitter component
    • setMinSize

      public HorizontalSplitter setMinSize(int minSize)
      Sets the minimum width of the splitter component’s left container in pixels
      Parameters:
      minSize - The left container’s minimum width in pixels
      Returns:
      The horizontal splitter component
    • getMaxSize

      public String getMaxSize()
      Gets the maximum width of the splitter component’s left container
      Returns:
      The maximum width of the splitter component as provided, otherwise null if no maximum width was entered, that is, it is not defined to what size the user is able to grow the left container.
    • setMaxSize

      public HorizontalSplitter setMaxSize(String maxSize)
      Sets the maximum width of the splitter component’s left container If the value null is set, the maximum width of the container will not be limited.
      Parameters:
      maxSize - The maximum width of the left container as defined by the CSS3 standard
      Returns:
      The horizontal splitter component
    • setMaxSize

      public HorizontalSplitter setMaxSize(int maxSize)
      Sets the maximum width of the splitter component’s left container
      Parameters:
      maxSize - The maximum width of the left container in pixels
      Returns:
      The horizontal splitter component
    • getPosition

      public String getPosition()
      Gets the default (start) position of the splitter component’s separator line
      Returns:
      Default (start) position of the line separating the splitter component’s containers
    • setPosition

      public HorizontalSplitter setPosition(String position)
      Sets the position of the line separating the splitter component’s containers, relative to the left side of the component. Default value. 50%, that is, the separating line is in the middle of the component.
      Parameters:
      position - The position of the line separating the containers. The position can be provided as defined in CSS3.
      Returns:
      The horizontal splitter component
    • setPosition

      public HorizontalSplitter setPosition(int position)
      Sets the position of the line separating the splitter component’s containers, relative to the left side of the component. Default value. 50%, that is, the separating line is in the middle of the component.
      Parameters:
      position - The position of the line separating the containers.
      Returns:
      The horizontal splitter component
    • setPosition

      public HorizontalSplitter setPosition(SplitterPosition splitterPosition)
      Sets the position of the line separating the splitter component’s containers, relative to the left side of the component. Default value 50%, that is, the separating line is in the middle of the component.
      Parameters:
      splitterPosition - A parameter corresponding to the position of the line separating the containers. Available position names are listed in the enum SplitterPosition.
      Returns:
      The horizontal splitter component
    • getHeight

      public String getHeight()
      Gets the splitter component’s height value
      Returns:
      The current height of the splitter component as entered or null if there was no height given
    • setHeight

      public HorizontalSplitter setHeight(String height)
      Sets the splitter component’s height value
      Parameters:
      height - The height value of the splitter component as defined in CSS3
      Returns:
      The horizontal splitter component
    • setHeight

      public HorizontalSplitter setHeight(int height)
      Sets the splitter component’s height value
      Parameters:
      height - The height of the splitter component in pixels
      Returns:
      The horizontal splitter component
    • getWidth

      public String getWidth()
      Gets the current width of the splitter component
      Returns:
      The current width of the splitter component as entered or null if there was no height given
    • setWidth

      public HorizontalSplitter setWidth(String width)
      Sets the splitter component’s width value
      Parameters:
      width - The width value of the splitter component as defined in CSS3
      Returns:
      The horizontal splitter component
    • setWidth

      public HorizontalSplitter setWidth(int width)
      Sets the splitter component’s width value
      Parameters:
      width - The width value of the splitter component in pixels
      Returns:
      The horizontal splitter component
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<HorizontalSplitter>
      Returns:
      If the componentwas drawn, true, otherwise false