Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
jvx:reference [2020/06/24 14:32] cduncan [Abstractions on Every Step] |
jvx:reference [2020/06/24 15:38] cduncan [Terminology] |
||
---|---|---|---|
Line 1178: | Line 1178: | ||
* The editor gets the CellEditor from the model and adds it to itself. | * The editor gets the CellEditor from the model and adds it to itself. | ||
- | ===== One Moment Instance Sharing? ===== | + | ===== Instance Sharing ===== |
If we revisit the example code from above, we will notice that the CellEditor instance is set on the model and must then be used by the editor. That means that a single CellEditor instance is used for all bound editors. We all know that sharing instances in such a way can be fun, but, in this case, it is not a problem because CellEditors are only “factories” for the actual editing components. | If we revisit the example code from above, we will notice that the CellEditor instance is set on the model and must then be used by the editor. That means that a single CellEditor instance is used for all bound editors. We all know that sharing instances in such a way can be fun, but, in this case, it is not a problem because CellEditors are only “factories” for the actual editing components. | ||
Line 1637: | Line 1637: | ||
On the left is the possibility to show and hide anchors together with the information about the currently highlighted anchor. On the right is an Lua scripting area, which allows you to quickly and easily rebuild and test layouts. It utilizes the [[https://blog.sibvisions.com/2017/09/25/jvx-lua-proof-of-concept/|JVx-Lua bridge from a previous blog post]] and so any changes to the code are directly applied. | On the left is the possibility to show and hide anchors together with the information about the currently highlighted anchor. On the right is an Lua scripting area, which allows you to quickly and easily rebuild and test layouts. It utilizes the [[https://blog.sibvisions.com/2017/09/25/jvx-lua-proof-of-concept/|JVx-Lua bridge from a previous blog post]] and so any changes to the code are directly applied. | ||
- | ===== The most simple usage: Flow-like ===== | + | ===== The Simplest Usage: Flow-Like ===== |
- | Enough of the internals, let’s talk use-cases. The most simple use-case for the FormLayout can be a container which flows its contents in a line until a certain number of items is reach, at which it breaks into a new line. | + | Enough of the internals, let’s talk use-cases. The most simple use-case for the FormLayout can be a container which flows its contents in a line until a certain number of items is reach, at which point it breaks into a new line. |
{{:jvx:reference:formlayout-flow.png?nolink|FormLayout with a flow layout}} | {{:jvx:reference:formlayout-flow.png?nolink|FormLayout with a flow layout}} | ||
Line 1671: | Line 1671: | ||
panel:add(stub()); | panel:add(stub()); | ||
</code> | </code> | ||
- | ===== The obvious usage: Grid-like ===== | + | ===== The Most Obvious Usage: Grid-Like ===== |
- | The FormLayout can also be used to align components in a grid, and actually layout them in a grid-like fashion. | + | The FormLayout can also be used to align components in a grid and actually layout them in a grid-like fashion. |
{{:jvx:reference:formlayout-grid.png?nolink|FormLayout with a grid layout}} | {{:jvx:reference:formlayout-grid.png?nolink|FormLayout with a grid layout}} | ||
- | With the main difference being that the columns and rows are sized according to the components in it and not given a fixed slice of the width of the panel. | + | The main difference is that columns and rows are sized according to the components and not given a fixed-width portion of the panel. |
==== Java ==== | ==== Java ==== | ||
Line 1707: | Line 1707: | ||
panel:add(stub(), layout:getConstraints(-1, 2, -1, -1)); | panel:add(stub(), layout:getConstraints(-1, 2, -1, -1)); | ||
</code> | </code> | ||
- | ===== The advanced usage: Anchor Configuration ===== | + | ===== The More Advanced Usage: Anchor Configuration ===== |
- | Additionally, the FormLayout offers the possibility to manually set the anchor positions, for example when it is necessary to give the first elements a certain size. Together with the ability to span components, this allows to create complex and rich layouts. | + | Additionally, the FormLayout offers the possibility to manually set the anchor position (e.g., when it is necessary to give the first elements a certain size). Together with the ability to span components, this allows us to create complex and rich layouts. |
{{:jvx:reference:formlayout-anchorconfiguration.png?nolink|FormLayout with a set anchor configuration}} | {{:jvx:reference:formlayout-anchorconfiguration.png?nolink|FormLayout with a set anchor configuration}} | ||
Line 1749: | Line 1749: | ||
===== Conclusion ===== | ===== Conclusion ===== | ||
- | The [[https://sourceforge.net/projects/jvx/|JVx]] FormLayout allows to quickly and easily create complex, good looking and working layouts which are still flexible enough for the cases when a component is swapped, removed or added. It can be used in many different circumstances and is still easy enough to use to make sure that even beginners are able to create a basic layout within seconds. | + | The [[https://sourceforge.net/projects/jvx/|JVx]] FormLayout allows us to quickly and easily create complex, good looking, and functioning layouts that are still flexible enough for the cases when a component is swapped, removed, or added. It can be used in many different circumstances and is still easy enough to use to make sure that even beginners are able to create a basic layout within seconds. |
====== Events ====== | ====== Events ====== | ||
Line 1755: | Line 1755: | ||
Let’s talk about events and event handling in [[https://sourceforge.net/projects/jvx/|JVx]]. | Let’s talk about events and event handling in [[https://sourceforge.net/projects/jvx/|JVx]]. | ||
- | ===== What are events… ===== | + | ===== What Are Events… ===== |
- | Events are an [[https://en.wikipedia.org/wiki/Event-driven_programming|important mechanism no matter to what programming language or framework you turn to]]. It allows us to react on certain actions and “defer” actions until something triggered them. Such triggers can be anything, like a certain condition is hit in another thread, the user clicked a button or another action has finally finished. Long story short, you get notified that something happened, and that you can now do something. | + | Events are an [[https://en.wikipedia.org/wiki/Event-driven_programming|important mechanism no matter to what programming language or framework you turn to]]. They allow us to react on certain actions and “defer” actions until something triggers them. Such triggers can be anything: a certain condition is hit in another thread, the user clicked a button, or another action has finally finished. Long story short, you are notified that something happened and you can now do something further. |
- | ===== …and why do I need to handle them? ===== | + | ===== …And Why Do I Need to Handle Them? ===== |
- | Well, you can’t skip events, they are a cornerstone of [[https://sourceforge.net/projects/jvx/|JVx]]. Theoretically, you could use [[https://sourceforge.net/projects/jvx/|JVx]] without using any of its events, but you would not only miss out on a lot of functionality but also be unable to do anything useful. But don’t worry, understanding the event system is easy, using it even easier. | + | Well, you can’t skip events, they are a cornerstone of [[https://sourceforge.net/projects/jvx/|JVx]]. Theoretically, you could use [[https://sourceforge.net/projects/jvx/|JVx]] without any of its events, but you would not only miss out on a lot of functionality, but also be unable to do anything useful. But don’t worry, understanding the event system is easy and using it even easier. |
===== Terminology ===== | ===== Terminology ===== | ||
- | For [[https://sourceforge.net/projects/jvx/|JVx]] the following terminology applies: An event is a property of an object, you can register listeners on that event which will get invoked if the event is dispatched (fired). Every event consists of the ''%%EventHandler%%'' which allows to register, remove and manage the listeners and also dispatches the events, meaning invoking the listeners and notifying them that the event occurred. There is no single underlying listener interface. | + | For [[https://sourceforge.net/projects/jvx/|JVx]] the following terminology applies: an event is a property of an object. You can register listeners on that event that will get invoked if the event is dispatched (fired). Every event consists of the ''%%EventHandler%%'', which allows ypi to register, remove, and manage the listeners and also dispatches the events, meaning it invokes the listeners and notifies them that the event occurred. There is no single underlying listener interface. |
- | Within the [[https://sourceforge.net/projects/jvx/|JVx]] framework, every event-property of an object does start with the prefix “event” to make it easily searchable and identifiable. But enough dry talk, let’s get started. | + | Within the [[https://sourceforge.net/projects/jvx/|JVx]] framework, every event property of an object starts with the prefix “event” to make it easily searchable and identifiable. But enough dry talk, let’s get started. |
===== Attaching listeners ===== | ===== Attaching listeners ===== |