Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
jvx:reference [2020/06/15 08:43]
cduncan [The Special Case of Containers]
jvx:reference [2020/06/15 09:50]
cduncan [Anatomy of a remote JVx application]
Line 457: Line 457:
 } }
 </​code>​ </​code>​
-All we have to do there is start the launcher itself. As the comment suggests, there might be work required for a “real” application startup. For this example, it is all we need to do. Of course, we could also directly embed this little function into the launcher implementation itself to save us one class.+All we have to do there is start the launcher itself. As the comment suggests, there might be work required for a “real” application startup. For this example, however, it is all we need to do. Of course, we could also directly embed this little function into the launcher implementation itself to save us one class.
  
 ===== The Launcher ===== ===== The Launcher =====
  
-The ''​%%ILauncher%%''​ implementation,​ on the other hand, contains quite some logic but nothing ​not manageable:+The ''​%%ILauncher%%''​ implementation,​ on the other hand, contains quite a bit of logic but nothing ​unmanageable:
  
 <code java> <code java>
Line 576: Line 576:
 ===== Notes on the Launcher ===== ===== Notes on the Launcher =====
  
-As you might have noticed, in our example the launcher is a (window) frame. That makes sense for nearly every desktop GUI toolkit as they all depend upon a window as main method to display their applications. But the launcher could also be simpler: for example, just a call to start the GUI thread. Or it could be something completely different: for example, an incoming HTTP request.+As you might have noticed, in our example the launcher is a (window) frame. That makes sense for nearly every desktop GUI toolkitas they all depend upon a window as the main method to display their applications. But the launcher could also be simpler: for example, just a call to start the GUI thread. Or it could be something completely different: for example, an incoming HTTP request.
  
 Also, don’t forget that the launcher is providing additional functionality to the application,​ like saving file handles, reading and writing the configuration,​ and similar platform and toolkit-dependent operations. See the [[https://​sourceforge.net/​p/​jvx/​code/​HEAD/​tree/​trunk/​java/​swing/​src/​com/​sibvisions/​rad/​ui/​swing/​impl/​SwingApplication.java|launcher for Swing for further details]]. Also, don’t forget that the launcher is providing additional functionality to the application,​ like saving file handles, reading and writing the configuration,​ and similar platform and toolkit-dependent operations. See the [[https://​sourceforge.net/​p/​jvx/​code/​HEAD/​tree/​trunk/​java/​swing/​src/​com/​sibvisions/​rad/​ui/​swing/​impl/​SwingApplication.java|launcher for Swing for further details]].
Line 584: Line 584:
 This example demonstrates how a simple launcher is implemented and why it is necessary to have a launcher in the first place. Compared with the “[[#​jvx|JVx]] are of course a lot more complex than these examples, that is because they implement all the required functionality and also take care of a lot of boiler plate operations. It is taking care of all technology specific code and allows to keep your application free from knowing about the platform it runs on. This example demonstrates how a simple launcher is implemented and why it is necessary to have a launcher in the first place. Compared with the “[[#​jvx|JVx]] are of course a lot more complex than these examples, that is because they implement all the required functionality and also take care of a lot of boiler plate operations. It is taking care of all technology specific code and allows to keep your application free from knowing about the platform it runs on.
  
-====== ​DataBooks ​======+====== ​Data Books ======
  
-Let’s talk about DataBooks, which allow access to data without any effort.+Let’s talk about data books, which allow access to data without any effort.
  
 ===== What is it? ===== ===== What is it? =====
Line 602: Line 602:
 {{:​jvx:​reference:​databook.png?​nolink|DataBook Architecture,​ the DataBook contains DataPages, which contain DataRows.}} {{:​jvx:​reference:​databook.png?​nolink|DataBook Architecture,​ the DataBook contains DataPages, which contain DataRows.}}
  
-===== RowDefinition ​=====+===== Row Definition ​=====
  
-The RowDefinition ​defines what columns are available in the row and stores some additional information about them, like the names of the [[https://​en.wikipedia.org/​wiki/​Unique_key|primary key]] columns. You can think of the RowDefinition ​as the headers of a table.+The row definition ​defines what columns are available in the row and stores some additional information about them, like the names of the [[https://​en.wikipedia.org/​wiki/​Unique_key|primary key]] columns. You can think of the row definition ​as the headers of a table.
  
-Its creation and usage is rather simple, and if you’re working with RemoteDataBooks there is no need to create one at all, as it is automatically created when the DataBook ​is opened. A RowDefinition ​holds and manages ​ColumnDefinitions, which define the columns.+Its creation and usage is rather simple, andif you’re working with RemoteDataBooks there is no need to create one at all, as it is automatically created when the data book is opened. A row definition ​holds and manages ​column definitions, which define the columns.
  
 <code java> <code java>
Line 624: Line 624:
 columnDefinition.setNullable(false);​ columnDefinition.setNullable(false);​
 </​code>​ </​code>​
-==== MetaData ​====+==== Meta Data ====
  
 Most of the column definition is additional information about the column, like if it is nullable, the label of the column, default values, allowed values, and similar information. Most of the column definition is additional information about the column, like if it is nullable, the label of the column, default values, allowed values, and similar information.
  
-==== DataType ​====+==== Data Type ====
  
-Of course, we must define what type the value in the column has. This is done by setting a data type on the column definition. The data type defines what kind of values the column holds, like if it is a String, a Number, or something else. We provide the most often used data types out of the box:+Of course, we must define what type the value in the column has. This is done by setting a data type on the column definition. The data type defines what kind of values the column holds, like if it is a string, a number, or something else. We provide the most often used data types out of the box:
  
   * BigDecimal   * BigDecimal
Line 642: Line 642:
 It is possible to add new data types by simply implementing ''​%%IDataType%%''​. It is possible to add new data types by simply implementing ''​%%IDataType%%''​.
  
-===== DataRow ​=====+===== Data Row =====
  
 The data row represents a single row of data; it holds/​references its own row definition and, of course, provides access to the values of the row. Accessing the  data row can be done either by column index or column name, and the methods either return or accept objects. Let’s look at a simple usage example: The data row represents a single row of data; it holds/​references its own row definition and, of course, provides access to the values of the row. Accessing the  data row can be done either by column index or column name, and the methods either return or accept objects. Let’s look at a simple usage example:
Line 653: Line 653:
 dataRow.setValue("​COLUMN_A",​ "New Value"​);​ dataRow.setValue("​COLUMN_A",​ "New Value"​);​
 </​code>​ </​code>​
-===== DataPage ​=====+===== Data Page =====
  
-The data page is basically a list of data rows, it also holds its own row definition, which is shared with all the contained data rows.+The data page is basically a list of data rows. It also holds its own row definition, which is shared with all the contained data rows.
  
-The main usage of data pages is to allow paging in a master/​detail relationship. If the master selects a different row, the detail ​databook ​selects the related data page.+The main usage of data pages is to allow paging in a master/​detail relationship. If the master selects a different row, the detail ​data book selects the related data page.
  
-===== DataBook ​=====+===== Data Book =====
  
 The data book is the main model of [[https://​sourceforge.net/​projects/​jvx/​|JVx]],​ it provides direct access to its current data page and data row by extending from IDataRow and IDataPage. The data book is the main model of [[https://​sourceforge.net/​projects/​jvx/​|JVx]],​ it provides direct access to its current data page and data row by extending from IDataRow and IDataPage.
Line 667: Line 667:
 ===== Usage Example ===== ===== Usage Example =====
  
-Here is a simple example of a ''​%%MemDataBook%%'',​ an ''​%%IDataBook%%''​ implementation ​which only operates in memory:+Here is a simple example of a ''​%%MemDataBook%%'',​ an ''​%%IDataBook%%''​ implementation ​that only operates in memory:
  
 <code java> <code java>
Line 716: Line 716:
   * Binary Data   * Binary Data
  
-Text and binary data are both objects (arrays of primitives are objects after all) and numbers are either primitives or objects. Most of the time, if we deal with numbers inside a database, we want them to be of arbitrary precision, which means we must represent them as ''​%%BigDecimal%%''​. Supporting ''​%%double%%''​ or ''​%%float%%''​ in these cases would be dangerous because one might write a ''​%%float%%''​ into the database [[https://​en.wikipedia.org/​wiki/​Floating-point_arithmetic|which might or might not end up with the correct value]] in the database. To completely eliminate such problems, we only support objects, which means that one is “limited” to the usage of number extensions like ''​%%BigLong%%''​ and ''​%%BigDecimal%%'',​ which do not suffer from such problems.+Text and binary data are both objects (arrays of primitives are objects after all) and numbers are either primitives or objects. Most of the time, if we deal with numbers inside a database, we want them to be of arbitrary precision, which means we must represent them as ''​%%BigDecimal%%''​. Supporting ''​%%double%%''​ or ''​%%float%%''​ in these cases would be dangerous because one might write a ''​%%float%%''​ into the database [[https://​en.wikipedia.org/​wiki/​Floating-point_arithmetic|which might or might not end up with the correct value]] in the database. To completely eliminate such problems, we only support objects, which means that one is “limited” to the usage of number extensions like ''​%%BigLong%%''​ and ''​%%BigDecimal%%'',​ which do not suffer from such problems.
  
 ==== Where Are the Data Pages? ==== ==== Where Are the Data Pages? ====
Line 724: Line 724:
 ===== Master/​Detail ===== ===== Master/​Detail =====
  
-[[https://​en.wikipedia.org/​wiki/​Master%E2%80%93detail_interface#​Data_model|Master/​detail]] is something that occurs in nearly every data model. It means simply that there is one master ​dataset which is referenced by one or multiple detail ​datasets. Or to express it in SQL:+[[https://​en.wikipedia.org/​wiki/​Master%E2%80%93detail_interface#​Data_model|Master/​detail]] is something that occurs in nearly every data model. It simply ​means that there is one master ​data set that is referenced by one or multiple detail ​data sets. Or to express it in SQL:
  
 <code sql> <code sql>
Line 733: Line 733:
   left join DETAIL d on m.ID=d.MASTER_ID;​   left join DETAIL d on m.ID=d.MASTER_ID;​
 </​code>​ </​code>​
-We can of course express a master/​detail relationship when using data books. For that we just create a ''​%%ReferenceDefinition%%''​ and assign it to the detail data book:+We canof courseexpress a master/​detail relationship when using data books. For thatwe just create a ''​%%ReferenceDefinition%%''​ and assign it to the detail data book:
  
 <code java> <code java>
Line 767: Line 767:
                    ​8| ​        3                    ​8| ​        3
 </​code>​ </​code>​
-Now if we select the second row in the ''​%%masterDataBook%%'',​ the ''​%%detailDataBook%%''​ will just contain the rows with the corresponding ''​%%MASTER_ID%%'',​ so 3, 4 and 5.+Nowif we select the second row in the ''​%%masterDataBook%%'',​ the ''​%%detailDataBook%%''​ will just contain the rows with the corresponding ''​%%MASTER_ID%%'',​ so 3, 4and 5.
  
 <​code>​ <​code>​
Line 778: Line 778:
      ​3 ​            ​5| ​        2      ​3 ​            ​5| ​        2
 </​code>​ </​code>​
-The ''​%%detailDataBook%%''​ is automatically adjusted according to the selection in the ''​%%masterDatabook%%''​. Of course this can have an arbitrary depthtoo.+The ''​%%detailDataBook%%''​ is automatically adjusted according to the selection in the ''​%%masterDatabook%%''​. Of coursethis can have an arbitrary depth too.
  
 ===== Conclusion ===== ===== Conclusion =====
  
-The data book is the backbone of [[https://​sourceforge.net/​projects/​jvx/​|JVx]]it provides a clean and easy way to access and manipulate data. At the same time, it is flexible and can be customized to specific needs with ease.+The data book is the backbone of [[https://​sourceforge.net/​projects/​jvx/​|JVx]]it provides a clean and easy way to access and manipulate data. At the same time, it is flexible and can be customized to specific needs with ease.
  
 ====== Application Basics ====== ====== Application Basics ======
  
-Let’s talk about the basicshow a [[https://​sourceforge.net/​projects/​jvx/​|JVx]] application starts, works and how the connection strings together the client and server side.+Let’s talk about the basicshow a [[https://​sourceforge.net/​projects/​jvx/​|JVx]] application starts, ​how it worksand how the connection strings together the client and server side.
  
 ===== Multitier Architecture ===== ===== Multitier Architecture =====
Line 817: Line 817:
 frame.eventWindowClosed().addListener(() -> System.exit(0));​ frame.eventWindowClosed().addListener(() -> System.exit(0));​
 </​code>​ </​code>​
-We can start to create and manipulate the GUI. In this case we are building a simple window with a label inside. ​Last but not least, we make sure that the JVM will exit when the window is closed.+We can start to create and manipulate the GUI. In this casewe are building a simple window with a label inside. ​Lastly, we make sure that the JVM will exit when the window is closed.
  
 A very good example and showcase for that is the [[https://​github.com/​sibvisions/​jvx.kitchensink|JVx Kitchensink]]. A very good example and showcase for that is the [[https://​github.com/​sibvisions/​jvx.kitchensink|JVx Kitchensink]].
  
-That’s itThat is the most simple way to start a [[https://​sourceforge.net/​projects/​jvx/​|JVx]] application. We can use all controls, and we can use ''​%%MemDataBook%%''​s without any problem or limitation. Best of all, we can simply switch to another technology by using another factory.+That’s itThat is the most simple way to start a [[https://​sourceforge.net/​projects/​jvx/​|JVx]] application. We can use all controls, and we can use ''​%%MemDataBook%%''​s without any problem or limitation. Best of all, we can simply switch to another technology by using another factory.
  
-===== Anatomy of a remote ​JVx application ​=====+===== Anatomy of a Remote ​JVx Application ​=====
  
-Of course [[https://​sourceforge.net/​projects/​jvx/​|JVx]] wouldn’t be that useful if it would just provide static GUI components. Now, to explain what else is required for a remote [[https://​sourceforge.net/​projects/​jvx/​|JVx]] application I have to go far afield, so let’s head down the rabbit hole.+Of course[[https://​sourceforge.net/​projects/​jvx/​|JVx]] wouldn’t be that useful if it would just provide static GUI components. Now, to explain what else is required for a remote [[https://​sourceforge.net/​projects/​jvx/​|JVx]] applicationI have to go far afield, so let’s head down the rabbit hole.
  
 {{:​jvx:​reference:​jvx-client-server.png?​nolink| Layers}} {{:​jvx:​reference:​jvx-client-server.png?​nolink| Layers}}
  
-What you are seeing here is a rough sketch of how the architecture of [[https://​sourceforge.net/​projects/​jvx/​|JVx]] looks like. Let’s walk through the image step by step. We will look at each successive layer and work our way from the database on the server to the databook ​on the client.+What you are seeing here is a rough sketch of how the architecture of [[https://​sourceforge.net/​projects/​jvx/​|JVx]] looks like. Let’s walk through the image step by step. We will look at each successive layer and work our way from the database on the server to the data book on the client.
  
 ==== DBAccess, accessing a database ==== ==== DBAccess, accessing a database ====
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information