Why Content frame is introduced into Touch UI - aem

In Touch UI, there is an iFrame called Content frame is added.
Can you please tell me
what is the reason of having an iFrame to display the page during the authoring?
There is an observer (/libs/cq/gui/components/authoring/editors/clientlibs/internal/page/js/observe.js) which observes the changes made to the DOM and sends post message accordingly.
What is the reason of sending postmessage and how this is helping?

The AEM developers realized that many problems arose from the fact that edit UI and WYSIWYG content view were rendered into the same context in Classic UI:
Edit UI would push content around, thus making it less WYSIWYG
Content styles could interfere with edit UI, accidentally misplace or hide it
Editor scripts could interfere with content scripts, meaning website authors would need to code around that
Edit UI inserts additional HTML element which need to be accounted for in content stylesheets and scripts
Which is why they decided on a better approach for Touch UI:
All content UI would reside in an iframe under the edit UI
Edit UI aligns to the content UI by measuring where it appears, not by inserting DOM nodes into the content
The observer is one of the few scripts still needed in the content UI to notify the edit UI when it needs to update its overlays

Related

Wicket AjaxTabbedPanel with tab content panels that defer rendering until tab is activated

I have a page with an AjaxTabbedPanel with lots of tabs with content like charts, reports, etc., whose content is quite expensive to produce. Most users spend most of their time on the first panel and don't need to venture to the tabs with charts, reports etc.,
To avoid unnecessary work on the back end and provide a faster initial page render I thought it would be advantageous to avoid doing the work to populate a tab's contents until (and only if) the user clicks on a tab to activate and thus render that tab's content.
Of course the first tab will always load during initial page load as that is the one that is active by default but the other tabs' contents will lay dormant until the user clicks on the corresponding tab, avoiding doing any work for those dormant panels until necessary.
Is that possible?
I thought that I could possibly employ the AjaxLazyLoadedPanel but it seems to be designed for a different purpose and the lazy loaded panel is regularly polled until it is 'ready' but that's not what I need in my case: there's no need for polling, we will know when to render a panel's content i.e. when activation of the panel occurs.
TabbedPanel does not need a tab's content as long at is isn't shown.
Make sure that you implement ITab#getPanel() 'lazy', i.e. the panel is created only when that method is called the first time. See PanelCachingTab for inspiration.

Dynamically update install4j screen content

We have a screen which displays only if we detect a problem with the environment. The screen has a button which retries the environment check. Each time the user retries the error can change and so I'd like to update my Multi-line HTML label accordingly. The content of the label needs to contain information produced during the environment check so even if we get the same type of error twice we may need a different message.
Is there a way to dynamically update the content of a screen? In other answers I've seen that it's usually recommended to set the content of the screen to a variable, and then updating the variable, but since I'm not moving between screens I don't believe the content will be updated. I've seen that calling context.gotoScreen(currentScreen) will refresh the content, but I'm worries this is not standard, and may change in the future in a way that if the provided screen is the current screen, nothing happens.
So the question is, what's the best approach to dynamically update the content of a screen based on user interaction without moving between screens.
Cheers
Each time a form screen is shown, all form components will be reinitialized. For a multi-line HTML label component, this means that the label text will be refreshed.
To update all components from within the screen, call
formEnvironment.reinitializeFormComponents();

New SoundCloud HTML5 widget animation on track finish

The new update for the html5 widget has added an animation at the end that hides the waveform and shows sharing options and embed codes.
This breaks the effect that was desired in one of my clients sites that relies on the widget as its audio engine.
Is there a way to stop this animation or revert back to the older widget as it worked fine as it was.
The site is http://www.bushytunes.net
Play a track, skip to the end as see for yourself.
Thanks, James
-------UPDATE-------
On messing around with the iframes css in chrome web inspector, ive come across the .sound__sharePanel DOM element, all i require is the simple option to add display: none to this and the problem will be fixed.
I do belive i am passing a false boolean to the sharing paramater when loading the player iframe. Shouldn't this handle hiding the element as the api docs state that this parameter will 'Show/hide share buttons/dialogues.'

Use attribute selector to change panels in a panel stack (Microstrategy)

So I have an attribute selector that currently changes the view of a grid based on the attribute passed to that grid. I also have a panel stack directly below the grid, with panels that hold iframes, which needs to be changed as the user selects an attribute in the selector. In other words, as the user selects an attribute from the selector, the panels would changes and show the new iframe. Is there a way I can somehow control the panel stack from an attribute selector?
The panel stack contains iframes , and each panel has an iframe with a specific URL source. What would be great is if I could somehow pass the attribute to the URL so that the iframe in a SINGLE panel could change based on the selection made in the attribute selector. For example, if I set the URL source of the iframe to "/servername/microstrategy/asp/{&attribute}.html" and had my html files stored in the correct folder. But there doesnt seem to be a way to pass the selected attribute to the source URL of the iframe.
The only thing I can think of is to somehow access the "code-behind" for the click event so that it BOTH changes the grid as usual, AND causes the panel stack to change panels.
Is there something in the Web Editor or SDK/Eclipse IDE that would allow me to access such logic? Or is there some cool work-around that would allow an attribute selector to change the panels shown in a panel stack.
Thank you for your help,
Kind of old question, but AFAIK there is no way to do it. You should probably go with text-boxes and use them as selectors. Maybe with view filters you could achieve something similar...

Hyperlink vs Anchor

When to use HyperLink and when to use Anchor?
When using HyperLink how to handle clicks?
com.google.gwt.user.client.ui.Hyperlink.addClickHandler(ClickHandler) is deprecated
com.google.gwt.user.client.ui.Hyperlink.addClickListener(ClickListener) is deprecated as well.
Doc suggests to use Anchor#addClickHandler, but how to use Anchor#addClickHandler when using HyperLink
Does it mean that if I need to handle click I should always use Anchor and never use HyperLink?
Great question, because it is so simple, and yet opens up what might be a whole new area for a lot of GWT programmers. I've up-voted the question just because it can be a great lead-in for people exploring what GWT can do.
Anchor is a widget for storing and displaying a hyperlink -- essentially the <a> tag. Really not much more exciting than that. If you want your page to link to some external site, use anchor.
Links are also used for internal navigation. Let's say I have a GWT app that requires the user to login, so on my first panel I put a login button. When the user clicks it, I would display a new panel with widgets to collect the user's information, code to validate it, and then if validated successfully, reconstruct that first panel the user was on.
Buttons are nice, but this is a browser, and I want my user's experience to be more like a web page, not a desktop app, so I want to use links instead of buttons. Hyperlink does that. The documentation for hyperlink describes it well:
A widget that serves as an "internal" hyperlink. That is, it is a link
to another state of the running application. When clicked, it will
create a new history frame using History.newItem(java.lang.String),
but without reloading the page.
Being a true hyperlink, it is also possible for the user to
"right-click, open link in new window", which will cause the
application to be loaded in a new window at the state specified by the
hyperlink.
That second sentence should help clear it up. The hyperlink is not changing the page in a URL sense (the way anchor does), though the URL will reflect the state of the program by displaying the "token" associated with the hyperlink appended to the base URL after a slash. You define the token. It would be something descriptive like "login" or "help" or "about". But this isn't a new page. There is no additional HTML file you've had to construct to display a help page, for example. It is the state of the current GWT app that is changing. Even if you "open in a new window" you are just running the same app in a particular state.
It looks like a link, but it is really a widget that manipulates the history frame, which in turn allows you to move the state of your GWT application. You don't write a click handler for the hyperlink widget, but a value change handler for the history stack. When you see that the "help" token has been put on the history stack, your handler will execute GWT code to attach to the RootPanel a FlowPanel with embedded HTML text with your help information. This is perceived by the user as a "new page", which is what he expects when he clicks on a hyperlink. The URL will be something.html/help. Now pretend he returns to this URL via the back button, not your hyperlink. No problem. You don't care about the hyperlink click. You only care that, somehow, the history stack changes. Your value change handler fires again, and does the same thing as before to display the help panel. The user still enjoys the experience of navigating through web pages, even though you and I know that there is only one web page and that you are attaching and detaching panels to the RootPanel (or whatever scheme you are using to display your GWT panels).
And this leads to a bonus topic.
This bonus is a bit more complicated, but ironically, it could help better understand hyperlinks. I say more complicated, but really, it helps solidify this notion that a GWT application is made up of a series of states, and that the web page on the screen is just the user's perception of those state changes. And that is Activities and Places. Activities and Places abstracts away this history frame manipulation, handling it in the background once you've set up a mapper with a GWT-provided class designed for this purpose, allowing you to break down your app into a series of activities, and as the user interacts through these activities he is put into different places, and each place has a view. Moreover, the user can move from place to place using browser controls like the address bar, bookmarks, history, and the backward/forward buttons, giving the user a real web-like experience. If you really want to get a grip on the conceptual difference between hyperlinks and anchors, you should try to learn this GWT topic. It can really make you change the way you see your apps, and for the better.
Hyperlink (or InlineHyperlink) is basically no more than a kind of Anchor with a ClickHandler that calls History.newItem and preventDefault() the event (so that the link is not actually followed).
Actually, Hyperlink won't do that if it thinks (and yes, it's only a guess) you right-clicked or middle-clicked (or ctrl-clicked) on the link (depending on the browser), to open the link in a new window or tab.
If you need any other behavior, then don't use Hyperlink and use Anchor instead. And if you want to add some behavior to an Hyperlink, then use an Anchor and mimic what the Hyperlink does. And you can reuse the HyperlinkImpl to have the right-click/ctrl-click handling (see links below).
But actually, if you need something that looks like a link and do something on click, but does not have a "target URL" (i.e. it shouldn't be right-clicked/ctrl-clicked to open in a new window/tab, or it wouldn't mean anything to do so), then do not use either an ANchor or Hyperlink, use a Label of whatever instead, and make it look like a link (but well, maybe you should use a Button and have it look like a button then; Google used to have link-alike buttons –such as the "refresh" link/button in GMail– and changed them to look like buttons when they really aren't links).
See also https://groups.google.com/d/msg/google-web-toolkit/P7vwRztO6bA/wTshqYs6NM0J and https://groups.google.com/d/msg/google-web-toolkit/CzOvgVsOfTo/IBNaG631-2QJ