B4J Library [Custom View] Tabbed Bar (B4J only)

Discussion in 'B4J Libraries & Classes' started by Cableguy, Nov 14, 2017.

Similar threads

B4J Tutorial Working with JavaFX Scene Builder
B4J Tutorial CSS Example
B4J Library [class] CSS Utils
B4J Tutorial [WebApp] Web Apps Overview
B4J Code Snippet Dark theme - base color
  1. Cableguy

    Cableguy Expert Licensed User

    Hi guys,

    Its been a while since I shared something here, so here goes my Tabbed Bar.
    I created this for my own needs, and the objective is to be able to have a wider tab pane than the panes it point to...
    Plus, it very easily and very highly customizable, as shown in the demo.

    This is beta state, so please, any Bugs, comments or suggestions are welcomed.

    [EDIT : A proper Library presentation]

    TabbedBar v1.1

    upload_2017-11-15_20-14-19.png

    This is a CustomView designed to be used in B4J ONLY.
    It has complete designer support, and can be Anchored just like any other view.

    IMPORTANT!
    Due to a limitation of the IDE, FontAwsome cannot be created from a Class converted to library.
    So you need to add in you code:
    Dim myFont as Font = FX.CreateFontAwsome(FontSize)


    Methods and Properties

    Initialize (Callback As Object, EventName As String)
    Initializes the TabbedBar and sets the Subs that will handle the Events.
    This method is used by the Designer ONLY and SHOULD NOT be used in the code.
    The TabBar will be automatically initialized when the Layout is loaded.

    DesignerCreateView (Base As Pane, Lbl As Label, Props As Map)

    Used by the CustomView mechanism and SHOULD NOT be used in the code.

    Left as Int
    Gets or Sets the Left property of the TabbedBar (related to its Parent).

    Top as Int
    Gets or Sets the Top property of the TabbedBar (related to its Parent).

    Width as Int
    Gets or Sets the Width property of the TabbedBar (related to its Parent).

    Heigth as Int
    Gets or Sets the Height property of the TabbedBar (related to its Parent).

    Base as Pane
    Gets Base Pane of the TabbedBar You can use this to set some CSS props.

    ArrowsStyle (Property As String, Value As String)
    Sets the JavaFX CSS Style property of the TabbedBar.
    This method uses Internally the CSSUtils Library.

    ArrowsStyle2 (css As String)
    Sets the JavaFX CSS Style propertie of the TabbedBar.
    You can use this method to set multiple CSS properties using the SmartString feature.

    GetSelectedTab as Label
    Returns the last Clicked Tab as Label.
    You can use this to set the Selected Tab CSS or any other Label Property.

    Tabs as List
    Gets the LIst that holds the TABs of the TabbedBar.

    Tabs.Initialize (owner As Object)
    Initializes the List. This method is used internally
    and SHOULD NOT be used in the code.

    Tabs.Add (Item As Object)
    Adds an Item at the end of the List

    Tabs.AddAll (List As List)
    Adds all elements in the specified collection to the end of the List.
    Note that you can add an Array directly.

    Tabs.AddAllAt (Index As Int, List As List)
    Adds all elements in the specified collection to the List starting at the specified index.

    Tabs.Clear

    Removes all items from the List

    Tabs.Get (Index As Int) As Object
    Gets the item at the index position from the List.
    The item is not removed.

    Tabs.IndexOf (Item As Object) As Int
    Returns the index of the specified object or -1 if not found

    Tabs.InsertAt (Index As Int, Item As Object)
    Inserts the specified item in the specified index.
    As a result, all item with an index larger than the specified index are shifted

    Tabs.RemoveAt (Index As Int)
    Removes the item at the specified index

    Tabs.Set (Index As Int, Item As Object)

    Replaces the item at the specified index by the specified item

    Tabs.Size as Int
    Returns the number of items in the list

    Tabs.Sort (Ascending As Boolean)
    Sorts the items in the List.
    All items must be either numbers or strings.

    Tabs.SortCaseInsensitive (Ascending As Boolean)
    Lexicographically sorts the List ignoring the characters case
    All items must be either numbers or strings.

    Tabs.Width (Value As Int)
    Sets the individual Tabs Width

    Tabs.VisibleTabCount (Value As Int)
    Set the quantity of visible Tabs (Tabs will automatically re-size to occupy the TabbedBar Width

    Tabs.Style (Property As String, Value As String)
    Sets the JavaFX CSS Style property of the TabbedBar Tabs.
    This method uses Internally the CSSUtils Library.

    Tabs.Style2 (css as string)
    Sets the JavaFX CSS Style property of the TabbedBar Tabs.
    You can use this method to set multiple CSS properties using the SmartString feature.

    [EDIT: Just uploaded a new file, same example, minor "Style2" property change]
     

    Attached Files:

    Last edited: Nov 16, 2017
  2. NJDude

    NJDude Expert Licensed User

  3. Cableguy

    Cableguy Expert Licensed User

    Have you run the attached example?
    No screenshot needed
     
  4. NJDude

    NJDude Expert Licensed User

    That's the point of a screenshot, I might just want look at it and see if I'm interested.
     
  5. Cableguy

    Cableguy Expert Licensed User

    @NJDude

    upload_2017-11-15_19-44-48.png

    In this ScreenShot, the TAB "Button" is selected
     
    Erel, inakigarm and NJDude like this.
  6. NJDude

    NJDude Expert Licensed User

    Nice!.
     
  7. Cableguy

    Cableguy Expert Licensed User

    v1.1 and a better example uploaded
     
Loading...