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:28]
cduncan [Adding a New Technology]
jvx:reference [2020/06/15 08:41]
cduncan [An Important Note About the Component Hierarchy]
Line 138: Line 138:
 ===== The Factory ===== ===== The Factory =====
  
-The heart piece of the UI layer is the factory that is creating the implemented classes. It’s a rather simple system, a singleton which is set to the Technology ​specific implementation and can be retrieved later:+The heart piece of the UI layer is the factory that is creating the implemented classes. It’s a rather simple system, a singleton which is set to the technology-specific implementation and can be retrieved later:
  
 <code java> <code java>
Line 172: Line 172:
 {{:​jvx:​reference:​multi-layers.png?​nolink|Multiple Extensions/​Implementations/​Technologies can be used}} {{:​jvx:​reference:​multi-layers.png?​nolink|Multiple Extensions/​Implementations/​Technologies can be used}}
  
-Changing between them can be as easy as setting a different factory. I say “can” because that is only true for Swing, JavaFX, and similar technologies. Vaadin, obviously, requires some more setup work. Theoretically,​ one could embed a complete application server and launch it when the factory for Vaadin is created, allowing the application to be basically stand-alone and be started as easily as a Swing application. That is possible.+Changing between them can be as easy as setting a different factory. I say “can” because that is only true for Swing, JavaFX, and similar technologies. Vaadin, obviously, requires some more setup work. Theoretically,​ one could embed a complete application server and launch it when the factory for Vaadin is created, allowing the application to be basically stand alone and started as easily as a Swing application. That is possible.
  
 ===== What else? ===== ===== What else? =====
  
-That is how [[https://​sourceforge.net/​projects/​jvx/​|JVx]] works in regards to the UI layer. It depends on “technology-specific stacks”, which can be swapped out and implemented for pretty much every GUI framework out there. We currently provide support for Swing, JavaFX, and Vaadin, but we also had implementations for GWT and Qt. Additionally,​ we do support a “headless” implementation,​ which uses lightweight objects that can be serialized and send over the wire without much effort.+That is how [[https://​sourceforge.net/​projects/​jvx/​|JVx]] works in regards to the UI layer. It depends on “technology-specific stacks”, which can be swapped out and implemented for pretty much every GUI framework out there. We currently provide support for Swing, JavaFX, and Vaadin, but we also had implementations for GWT and Qt. Additionally,​ we support a “headless” implementation,​ which uses lightweight objects that can be serialized and send over the wire without much effort.
  
 ===== Adding a New Technology ===== ===== Adding a New Technology =====
Line 198: Line 198:
 {{:​jvx:​reference:​resource.png?​nolink|The JVx layers revisited. UI wrapper and implementation implement the interface, extension and technology do not.}} {{:​jvx:​reference:​resource.png?​nolink|The JVx layers revisited. UI wrapper and implementation implement the interface, extension and technology do not.}}
  
-The UI wrappers are the main UI classes that are used to create the GUI (f.e. ''​%%UIButton%%''​). These are wrapping the implementations (f.e. ''​%%SwingButton%%''​),​ which themselves are wrapping the extension/​technology (f.e. a ''​%%JVxButton%%''/''​%%JButton%%''​). Only the UI and implementation classes implementing the interface are required for the component (f.e. ''​%%IButton%%''​). That also means that the implementation is dependent on the extension/​technology component, but the UI can use any object which implements the interface.+The UI wrappers are the main UI classes that are used to create the GUI (e.g., ''​%%UIButton%%''​). These are wrapping the implementations (e.g., ''​%%SwingButton%%''​),​ which themselves are wrapping the extension/​technology (e.g., a ''​%%JVxButton%%''/''​%%JButton%%''​). Only the UI and implementation classes implementing the interface are required for the component (e.g., ''​%%IButton%%''​). That also means that the implementation is dependent on the extension/​technology component, but the UI can use any object which implements the interface.
  
 Now, with that knowledge, we can start defining what is what: Now, with that knowledge, we can start defining what is what:
Line 206: Line 206:
 The resource itself, accessed by calling ''​%%<​uiwrapper>​.getResource()%%'',​ is the extension/​technology component. The  UI resource can be accessed by calling ''​%%<​uiwrapper>​.getUIResource()%%''​. The UI component can be accessed by calling ''​%%<​uiwrapper>​.getUIComponent()%%''​ and is usually the UI wrapper class itself. If we use our previous Swing example, the resource would be a ''​%%JVxButton%%''/''​%%JButton%%'',​ the  UI resource would be the ''​%%SwingButton%%''​ and the UI component would be the ''​%%UIButton%%''​. The resource itself, accessed by calling ''​%%<​uiwrapper>​.getResource()%%'',​ is the extension/​technology component. The  UI resource can be accessed by calling ''​%%<​uiwrapper>​.getUIResource()%%''​. The UI component can be accessed by calling ''​%%<​uiwrapper>​.getUIComponent()%%''​ and is usually the UI wrapper class itself. If we use our previous Swing example, the resource would be a ''​%%JVxButton%%''/''​%%JButton%%'',​ the  UI resource would be the ''​%%SwingButton%%''​ and the UI component would be the ''​%%UIButton%%''​.
  
-As one can see, access to all objects which comprise GUI possible at all times. We, of course, have the UI component, we can access the implementation component, and we can access the extension/​technology component. Theoretically,​ we could also swap them at runtime, but in [[https://​sourceforge.net/​projects/​jvx/​|JVx]],​ this is limited to the construction of the object to greatly reduce the error potential and complexity of the framework code.+As one can see, access to all objects which comprise GUI possible at all times. We, of course, have the UI component, we can access the implementation component, and we can access the extension/​technology component. Theoretically,​ we could also swap them at runtime, but in [[https://​sourceforge.net/​projects/​jvx/​|JVx]],​ this is limited to the construction of the object to greatly reduce the potential ​for error and complexity of the framework code.
  
 ===== Creating Custom Components ===== ===== Creating Custom Components =====
  
-We will use an example from the [[#​part_about_creating_custom_components|part about creating custom components]],​ which we will come to later. The ''​%%BeepComponent%%''​ is a simple ''​%%UIComponent%%''​ extension ​which contains a label and two buttons inside itself.+We will use an example from the [[#​part_about_creating_custom_components|part about creating custom components]],​ which we will come to later. The ''​%%BeepComponent%%''​ is a simple ''​%%UIComponent%%''​ extension ​that contains a label and two buttons inside itself.
  
 <code java> <code java>
Line 234: Line 234:
 } }
 </​code>​ </​code>​
-We are setting a new UI resource (a ''​%%UIPanel%%''​) in the constructor (at line #5) that is to be used by the ''​%%UI component%%''​. In this case, it is not an implementation,​ but another UI component. However, that doesn’t matter because the UI resource ​only must implement the expected interface. At line #15 we start using that custom UI resource.+We are setting a new UI resource (a ''​%%UIPanel%%''​) in the constructor (at line #5), which is to be used by the ''​%%UI component%%''​. In this case, it is not an implementation,​ but another UI component. However, that doesn’t matter because the UI resource must only implement the expected interface. At line #15 we start using that custom UI resource.
  
-Because UI component is an abstract component designed for exactly this usage, the example might not be the most exciting one, but it clearly illustrates the mechanic.+Because UI component is an abstract component designed for exactly this usage, the example might not be the most exciting one, but it clearly illustrates the mechanics.
  
 ===== Bolting on Functionality ===== ===== Bolting on Functionality =====
Line 280: Line 280:
                                     \-Button                                     \-Button
 </​code>​ </​code>​
-That is because such extended components are not “passed” to the technology; they only exist on the UI layer because they do not have a Technology ​component which could be used. That is done by adding the ''​%%UI component%%''​ to the UI parent, but for adding the actual technology component the set UI resource is used.+That is because such extended components are not “passed” to the technology; they only exist on the UI layer because they do not have a technology ​component which could be used. That is done by adding the ''​%%UI component%%''​ to the UI parent, but for adding the actual technology componentthe set UI resource is used.
  
 ===== The Special Case of Containers ===== ===== The Special Case of Containers =====
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information