B4J Library jRLViews - Custom Views

This library contains a selection of Custom Views.
  • SelectFileTextField: TextField with a file choose button.
  • NumericTextField: TextField, with border indicator for accepting numeric input only.
  • LinkLabel: Label with a clickable link (url).
  • SliderX: Slider with additional property settings (tick labels, tick marks, block increment, major tick unit, minor tick count, snap to ticks, value changing,thumb and track settings).
  • ColorList: List the standard JavaFX colors in a colored customized listview. Select color name and hex-value (0x.....).
  • ListViewEdit: ListView with editable TextFields.
  • ButtonToolbar: Toolbar with buttons (Text or Icon).
  • SeparatorLine: Separator Line VERTICAL or HORIZONTAL.

How to Use
  • Attached the Library with B4J Source Code, Examples and pdf documentation.
  • Copy the file jRLViews.jar, jRLViews.xml, jRLViewsFiles.jar to the B4J Additional Library Folder.
  • The library jRLViews should be listed in the B4J IDE files tab. Check mark the library.
  • In the B4J Visual Designer, see Custom Views listed.
  • Feel free to amend to your requirements.
upload_2016-10-25_15-18-16.png


upload_2016-10-25_15-18-58.png


upload_2016-10-25_15-19-18.png

 

Attachments

  • jRLViews-051-documentation.zip
    394 KB · Views: 365
  • jRLViews-051-source.zip
    78.8 KB · Views: 366
  • jRLViews-051-library.zip
    244.9 KB · Views: 390
Last edited:

rboeck

Well-Known Member
Licensed User
Longtime User
Hi,

first thanks for your work and your ideas and documentation for the community.
Three things with this library after a first test: the bitmap for the SelectFileTextField is not found; if the user is typing in the SelectFiletextfield he get strange results - the cursors stays in the left position and the letters are written to the right, so he gets his typing in opposite direction; maybe you could disable typing here; the third funny effect i have found in numeric TextField: Type 58g, uncheck Valdidation Indicator and type 1 in NumericTextField - now you can see a blinking 1.
Greetings
Reinhard
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

thanks also for feedback, very helpful:
  • "select image not found": Question: did you also copy the file jRLViewsFiles.jar to the additional B4J libraries folder
  • "if the user is typing in the SelectFiletextfield he get strange results": SOLVED
  • "Type 58g, uncheck Valdidation Indicator and type 1 in NumericTextField - now you can see a blinking 1": SOLVED: Able to reproduce; Have not found a solution yet - need to rework the logic - will probably disable keeping the wrong char visible as interfering with putting indicator on & off.
 
Last edited:

micro

Well-Known Member
Licensed User
Longtime User
Thanks Rob for your great library.
It's possible modify the property of NumericTextField?
Choose how decimal "." or ","
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20161015 (see Post #1)
FIX:SelectFileTextField handling text input case and cursor position
CHG:NumericTextField validation indicator (border color) is always used whilst showing the wrong character
NEW:NumericTextField option to set the digital comma
UPD:Example to reflect the changes

Thanks a lot for feedback provided --- still some challenges ahead :)
 

rboeck

Well-Known Member
Licensed User
Longtime User
Thanks for your new version - i had initialy a problem with the library, but with recompilation everything was ok. All my problems are fixed - its a good starting point and template for an own text control i want to make sometimes...
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Thanks appreciated= I just noticed that the zip file in post #1 did not include the latest library jar+xml files in folder libraryfiles (my bad :( ). Have uploaded those now in the zip file.
 

micro

Well-Known Member
Licensed User
Longtime User
Hi Rob
in NumericTextField The event TextChanged, FocusChanged and Action are disable?
This are important event for the best use.
Also the alignment not work it's always alignment to left also if i set in Extra CSS -fx-alignment:center_right (in standard TextField work fine)
Thanks
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20161022 (see Post #1)
NEW:SelectFileTextField events TextChanged, Action
NEW:NumericTextField events TextChanged, Action
FIX:NumericTextField set property DigitalComma
Hint
Use the style property to set the TextField Style (must be closed by semicolon)
Example: NumericTextField1.Style = "-fx-text-fill:blue; -fx-font-weight: bold; -fx-alignment:center_right;"
ToDo
Exposing Extra CSS property planned for next version (not found a solution yet on how to do that).
Big Learning
When changing the packagename of the library (which I did), then for all applications using the library, in the layout the custom views must be replaced by the ones from the new library. Was not aware of this side effect :(.

@micro: Thanks for the suggestions.
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20161025 (see Post #1)
NEW:ListViewEdit (ListView with editable TextFields).Example included.
NEW:SliderX Thumb and Track settings. Example included.
NEW:All CVs default events added except ColorList (in progress).

Notes
ListViewEdit handling of TextFields to stay in sync with the ListView Item Index was a challenge - but solved with help of events & tags. The up and down key can be used to navigate as well as the mouse.
SliderX setting the thumb and the track properties is a nice feature, realized with JavaFX API methods - brought up the thought of using the slider as progressbar or as a switch.
The source of the library is included - for those interested to explore.
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Reply Post #11
Q1. What is the estimated release date?
A first, rather simple version, is ready (see Post #1). Its only possible to add buttons via the designer, not possible to enable/disable/remove.
Can not state when an improved version is ready as not high on my prio list.

Q2. Will one be able to add / remove / enable / disable buttons via code?
No, buttons can only be added via the B4J Visual Designer using JSON formatted string (similiar to the MenuBar).
An alternative to the jRLViews Toolbar, is below code snippet example using toolbar list of items as nodes. With the list, items can be added, removed via API methods (see JDK9 ref).

B4X:
Sample to create a toolbar with [BUTTON][BUTTON][TEXTFIELD][LABEL][BUTTON]

Sub Process_Globals
  Private fx As JFX      
  Private MainForm As Form
  'Define the toolbar JavaObject
  Private joToolbar As JavaObject
  Private tbButton1 As Button
  Private tbButton2 As Button
  Private tbTextField1 As TextField
  Private tbLabel1 As Label                                                                                    
  Private tbButton3 As Button
End Sub

Sub AppStart (Form1 As Form, Args() As String)
  MainForm = Form1
  MainForm.SetFormStyle("UTILITY")
  MainForm.RootPane.LoadLayout("Main")
  MainForm.Show
  CreateToolBar
End Sub

'Handle resizing of the mainform which adjusts the width of the toolbar object
Sub MainForm_Resize (Width As Double, Height As Double)
    joToolbar.RunMethod("setPrefWidth", Array(Width))
End Sub
                    
Sub CreateToolBar
  joToolbar.InitializeNewInstance("javafx.scene.control.ToolBar", Null)
  tbButton1.Initialize("tbButton1"):tbButton1.Text="Button 1":tbButton1.TextColor=fx.Colors.Red
  tbButton2.Initialize("tbButton2"):tbButton2.Text="Button 2":tbButton2.TextColor=fx.Colors.Blue
  tbTextField1.Initialize("tbTextField1")
  tbTextField1.TooltipText = "Enter text."
  tbTextField1.PromptText = "Enter Text"
  tbLabel1.Initialize("tbLabel1")
  tbLabel1.Text = "Toolbar Label"
  tbButton3.Initialize("tbButton3"):tbButton3.Text="About":tbButton3.TextColor=fx.Colors.Yellow
  'Add the views to the toolbar
  joToolbar.RunMethodJO("getItems", Null).runMethod("add", Array(tbButton1))
  joToolbar.RunMethodJO("getItems", Null).runMethod("add", Array(tbButton2))
  joToolbar.RunMethodJO("getItems", Null).runMethod("add", Array(tbTextField1))
  joToolbar.RunMethodJO("getItems", Null).runMethod("add", Array(tbLabel1))
  joToolbar.RunMethodJO("getItems", Null).runMethod("add", Array(tbButton3))
  joToolbar.RunMethod("setStyle", Array("-fx-background-color: lightgrey;"))
  'Add the toolbar
  MainForm.RootPane.AddNode(joToolbar, 0, 0, MainForm.width, 50)
End Sub

Sub tbButton1_Action
    Log("Toolbar Button1 clicked")
  fx.Msgbox2(MainForm,"Toolbar Button 1 clicked", "Information", "OK", "", "", fx.MSGBOX_INFORMATION)
End Sub

Sub tbButton2_Action
    Log("Toolbar Button2 clicked")
  fx.Msgbox2(MainForm,"Toolbar Button 2 clicked", "Warning", "OK", "", "", fx.MSGBOX_WARNING)
End Sub

Sub tbButton3_Action
  fx.Msgbox2(MainForm,MainForm.title, "About", "OK", "", "", fx.MSGBOX_INFORMATION)
End Sub
 
Last edited:

rwblinn

Well-Known Member
Licensed User
Longtime User
Update 20171011 (see Post #1)
NEW: SeparatorLine
NEW: ButtonToolbar Property ButtonList; Methods SetButtonEnanbled, AddButton, RemoveButton
UPD: Documentation
 
Last edited:

Chris Lee

Member
Licensed User
This looks interesting, but as far as I can tell from discussions around GPL License Version 3, it's not possible to use it in a commercial product, without making the entire application free under the same terms?
 
Top