GWT using Activities and Places when screen layout changes per place - gwt

My understanding of GWT's Activities and Places is that for a given region on a screen you have an ActivityManager and an ActivityMapper. You can have multiple regions on the screen which means you can have multiple ActivityManagers and ActivityMappers (one per region). So, whenever there is a PlaceChange the ActivityManagers ask their respective ActivityMapper what activity it is supposed to be showing given the Place. This works great as long as your Places all have a common layout that they reuse in different ways to perform different activities. My question is how do we handle the case where different Places use radically different layouts? My first thought is to just have even more ActivityManagers and ActivityMappers, if the Place doesn't use a particular region then the ActivityMapper for that region will simply return null when we change to that Place. If there is a better way I would appreciate any wisdom.

I found it much easier to use a single ActivityMapper/ActivityManager pair for the entire app.
In a typical case you have a "menu" region and a "main" region. The menu region is very basic: a click on a menu item sends a user to a new place. It also highlights the newly selected item and resets the style of the previously selected item. All of this can be easily done in a simple widget that you can include in all views where this menu is required. Having separate ActivityMapper and ActivityManager for the menu region just complicates everything without providing any benefits.
I use the same approach for "top menu" region and "left menu/tree" region: a widget that tells the presenter which data to show in the "main" region.
I have over 50 different places in my app, and it really helps to have a simple architecture: each place corresponds to one view and one activity.

Related

How can I make a pop-up HUD for widgets to get them off the main interface?

In Netlogo how can I make a second page to the interface, or a pop-up HUD (Heads up Display), to store widgets that I don't use frequently and simply clutter up the main interface?
Rationale: multiple widgets ( sliders, switches, etc.) are helpful for SETUP but then I'd like to hide them to keep the interface clearer, smaller, and less overwhelming to viewers.
Volker Grimm suggested that a set of tabs, each opening a pop-up window to manage different portions of complex models would be helpful.
Since the pop-up might have its own viewing area, you could use it to visually adjust parameters, such as a Normal or Poisson distribution that you want to use for input, without having to use your main interface's viewing area to accomplish this.
In fact, being able to open a second ( or Nth ) graphics window ( "world") into your model could be helpful
Preferably the pop-up would have persistent memory and could be hidden or shown with a single click.
Here's my own solution to the pop-up HUD question.
I used the LevelSpace extension ("ls") in the main model to pop up a second model containing the widgets I'm trying to show or hide as desired.
The main model has more details about how this works in the INFO tab.
In this prototype proof-of-concept, the main model simply displays a few turtles wandering around the world and has hide/show buttons to pull up the HUD.
The HUD has 3 sliders that can be used to set the number of turtles, size of turtles, and shape of turtles, and a button to upload those new settings all at once to the main model. The main model will check once every GO step for updates and apply them and mark them applied.
Alternatively, the HUD can be set to be in automatic-update mode, so the sliders are basically live and as you move each one the changes immediately show up in the main main model ( at the next GO step ).
It works! The full models with the interface buttons and INFO tabs are in the Netlogo Modeling Commons as "Popup-HUD part 1 of 2" and "Popup-HUD part 2 of 2" for download. ( just search for "HUD" as there are only two hits. )
They won't run over the web because they use the LevelSpace extension which isn't available there. You need to download the main model to be able to read the INFO tab.
These are free to copy, modify, etc. so long as attribution is made ( CC 4.0 )

Generated a reusable APEX component from a Page

I want to save myself some time (I have two weeks of my internship left) by creating a simple reusable component based on a Region I created for a reporting page.
It consists out of a Static Region with the collapsible Template, containing 3 very similar Diagrams.
There is one Value which is the same for all 3 Diagrams, and 2 Values I need to change for each diagram.
Any tips how to reach that goal? Copying is dreadful, since I need that component 19 times on this page. I have no experience with creating plugins for APEX.
if you have already created the region you can duplicate it as many times as you like on that page by right clicking the region in the Rendering Tab on the left side of Page Designer and clicking the Duplicate option from the menu:
This is a lot faster than recreating the region from scratch each time. You can also do this to duplicate buttons, page items and dynamic actions.

Binding to custom built control according to different data

Here's the issue, I build a special book reader/browser (For holy quran), my code behind loads the page and constructs how it should look. and then it should bind that look to a some kind of data-bindable custom control to view it properly. the problem is, the look differs from page to page, so I cannot bind to a certain control or wrap panel.
here's how it generally looks:
The decorative border top of the page is always there at any page, it indicates the part and chapter the viewer is in.
If you're starting a new chapter it have additional image under that decorative border or anywhere in the page (there can be multiple chapters in the same page) something like this
or this:
The normal text is not an issue, it's just a special font, however, I put each individual word in its own text block for reasons of user selection by word.
The issue here is, given the previous information, and knowing how random it is to place the decoration picture or the amount of words (text blocks) per page. how can I bind that to some kind of view to separate the view from the VM and Engine that builds the page.
my past solution was to actually build everything in the VM in a wrappanel built inside a scrollviewer having lots of textblocks and images according to the page. but that's naiive solution. I want to rebuild that in a more professional separated way. I also want to do this for Windows RT beside Windows phone so I need to reuse the code behind in a Portable class library.
I think all you need to do is slightly adjust your current design. So perhaps have a VM that represents the entire content, and that would have a Collection of say Pages or Sections. A second VM would represent the Page/Section, allowing you to create a property for the WrapPanel content (i.e. the words) and another property for the Header and or other things.
In the View you would have the scrollviewer and bind to the main VM collection. Then create another View or DataTemplate that represents the Page/Section.
You should be able to do this is a strict MVVM sense quite easily and it will be dynamic based on the content.
You could even cater for advanced scenarios where each section has a different template/view.

TabItems versus Parented TRectangles - Firemonkey Mobile Application

What would be more efficient in a kinda big application for a mobile application? Make a separate TabItem for each menu item or have one TabItem with an empty Rectangle that will become parent of the form of each Menu Item's Unit?
(I assume you mean reparenting the controls on a child form to appear within a container on your main form. If so you'll need to use (e.g.) a TLayout which will handle child controls better rather than a TRectange).
It depends what you mean by 'efficient'.
One big form will take longer at start up and consume more memory.
Creating content on demand will take longer at run time as each form is created and destroyed.

View state, new activity start

I use the MVP pattern in my project. According to it Place define view after a new Activity starts. In some cases when I have to save the content of some Text areas after change of Place. I think that it is not a good idea to put these text areas in Place, because they don't define business logic. To save them in View elements is not good either. How do I resolve this situation?
GUI elements (GWT widgets) belong in Views. Why do you think otherwise?
Then your View interface (or is it Display?) can have getTextData()/setTextData() methods to retrieve data in your TextBox.