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
jvx:client:gui:temporary_values [2019/08/26 09:42]
admin
jvx:client:gui:temporary_values [2021/02/01 12:47] (current)
admin
Line 1: Line 1:
 ~~NOTRANS~~ ~~NOTRANS~~
-~~Title: Temporary ​values~~+~~Title: Temporary ​Values~~
  
-Sometimes it's important to store/cache temporary information. It's no problem to create or use a variable to save such information. This is also the recommended solution because it makes the code readable and references can be found. ​But sometimes it's good to have an alternative to clean code because sometimes you want to add information to existing objects, quick and easy.+Sometimes it's important to store/cache temporary information. It's no problem to create or use a variable to save such information. This is also the recommended solution because it makes the code readable and references can be found. ​However, ​sometimes it's good to have an alternative to clean code because sometimes you want to add information to existing objects ​quickly ​and easily.
  
-=== Instance ​values ​===+=== Instance ​Values ​===
  
-As example, you could open a work-screen and add additional metadata like readonly ​or allowed users. To solve this problem, you could save the screen in a HashMap with metadata as values. This information should be saved in the Application ​because the screen has access to the application. This makes things a little bit complicated.+As an example, you could open a work-screen and add additional metadata like read-only ​or allowed users. To solve this problem, you could save the screen in a HashMap with metadata as values. This information should be saved in the application ​because the screen has access to the application. This makes things a little bit complicated.
  
-To make everything easier, every UI resource (e.g. a component) has the methods:+To make everything easier, every UI resource (e.g.a component) has the methods:
  
 <code java> <code java>
Line 19: Line 19:
 </​code>​ </​code>​
  
-So it's super easy to add temporary information to any UI resource. We recommend to use constants as object namesto find references easily. If you use hardcoded strings, it will be hard to find the usage in your whole application.+Soit's super easy to add temporary information to any UI resource. We recommend to use constants as object names in order to find references easily. If you use hardcoded strings, it will be hard to find the usage in your whole application.
  
 Here's a short example: Here's a short example:
Line 31: Line 31:
 } }
 </​code>​ </​code>​
-We save a simple **"​state"​** for the screendirectly in the screen instance.+We save a simple **"​state"​** for the screen directly in the screen instance.
  
-It's also possible to use the launcher or application,​ e.g.+It's also possible to use the launcher or application,​ e.g.,
  
 <code java> <code java>
Line 46: Line 46:
 We save the **"​application mode"​** in the launcher and this information is available in every screen or any other class which has access to the launcher. It's not possible to add variables to the launcher or to change the class directly, so it's a good alternative to use custom objects to add metadata and to avoid HashMap for simple caching. We save the **"​application mode"​** in the launcher and this information is available in every screen or any other class which has access to the launcher. It's not possible to add variables to the launcher or to change the class directly, so it's a good alternative to use custom objects to add metadata and to avoid HashMap for simple caching.
  
-==== Global ​values ​====+==== Global ​Values ​====
  
-We have another alternative for above instance values. It's also possible to use our [[jvx:​common:​util:​classes#​the_object_cache|ObjectCache]],​ e.g.+We have another alternative for the above instance values. It's also possible to use our [[jvx:​common:​util:​classes#​the_object_cache|ObjectCache]],​ e.g.,
  
 <code java> <code java>
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information