Adobe CQ - Specify where JCR content is written (exact path) - java

I am trying to create a dialog that has an xtype of "textfield"...I need to specify that anytime the user updates this field it will always overwrite the same JCR content node.
I am including this component/dialog in multiple pages, so that the author can edit the text. The issue is that the text will be updated for that page. (because I am using a relative path).
What I need to happen...The content is updated and written to a central location so that no matter which page the user edits this text it will always update to a central location.
A real world example:
We have modal dialogs that show throughout the site. Some of these dialogs are global. Out client has requested to have an edit option on any page that these dialogs show. The acceptance criteria is that they can edit on any page and that edit will be applied globally.
My problem is that I am not sure how to set the path that the text field will write to.
I am retrieving the content from here:
<cq:include path="/content/jjj/en/misc/deviceoutmodal/jcr:content/buttontext1" resourceType="zig/components/text"/>
How can I write to the same path?

I think this would be best achieved with design dialogs — you can set a property based on the component (or template), which will then get used by every instance of that component.
The editor can edit the property when in Design mode, (or through the Designer as far as I remember). Design dialogs are created like regular dialogs but named design_dialog.xml. The example use-case that Adobe lists is for a logo component:
The Logo component displays the logo of the website Geometrixx. The
logo image and the home link can be configured globally (same for
every page of the website) so that every instance of this component is
identical. Therefore a design dialog is needed to provide the image
and path of the home link to the design of the corresponding Page. The
Logo component is placed in the upper left corner of all pages on the
website.

Related

JavaFX: Identical tabs with different data

In Lazarus, there are 2 different kinds of tab elements (cf. Free Pascal docs):
TPageControl
TPageControl is a multi-page component that provides a container to hold a variety of controls per page.
TTabControl
It is a tabbed container component which looks identical to a TPageControl. However, there is a fundamental difference because the control always shows the same page whichever tab is selected. In fact, it containts only a single page. The idea behind this concept is illustrated best by an editor or viewer for text files: When the TabControl contains a TMemo then the individual tabs refer to the files loaded into the memo; whenever the active tab changes another file is loaded into the (same) memo.
In this sense, JavaFX TabPanes are quite similar to TPageControls, but I rather want to replicate a TTabControl. I know I could in fact programmatically create a new Tab(), but I want to visually design it in SceneBuilder.
Is there maybe a way to load a separate .fxml file into a new Tab() element which is then added to the TabPane? (And how could I then access a tab's children?)
I chose the easiest approach: Implementing a head-less TabPane to detect when the user switches between tabs. The elements that appear to the user as the “tab content” are actually placed outside the TabPane, and their content is dynamically changed whenever the tab is switched.

how to avoid blank page at the end of pdf report in BIRT?

I am using current BIRT version that is 4.5. I have two master pages in my report. I have huge data to display on a report so i have set some data to display on one master page and the remaining on another master page due to some reason. The problem is when there is no data to display on one of the master page it is rendering a blank page with header and footer of that master page which i want to avoid. In my pdf report how can i avoid this blank page?
Hi, all are pointing to hide tables or other components but my requirement here is, i need to hide the page itself. I dont think there is visibility option for page. even if it is there it is not so useful. Kindly understand that i dont want to display the page itself not only the components in it.so can i expect any help now?
I guess you added the tables directly on the masterpage?
That's not how it works. BIRT will render the (master)page and maybe hide the elements on them (for example a table that has no data. You can do this by setting the visibility property). The problem with this approach is that the Masterpage cannot be 'unrenderred'.
The proper way to fix this, is to add each element on the normal layout. In the properties for each table, grid, etc. you can set the pagebreak properties. Here you can select the Masterpage you want to use. If an element does not need to be rendered (by visibility settings), it wont trigger a 'blank' masterpage.
Hope that helps.

Ratio of GWT Places to Activities to Screen?

I'm trying to write a GWT app that reuses the same template for every "page" (place). There are 4 main "pages" of the app:
Dashboard page (http://www.mywebapp.com/#dashboard)
Calculator page (http://www.mywebapp.com/#calc)
Configurator page (http://www.mywebapp.com/#config)
Login page (http://www.mywebapp.com/#login)
Each "page" has the same templated look-and-feel: (1) a header section that contains the logo and the navigation menu, (2) a content section that contains "page"-specific content (i.e. will be different for the #dashboard place, #login place, etc.), and (3) a footer section that contains some links. So you see, the only thing that changes from page-to-page is the content section. Just like an ordinary, templated web site.
The thing is, each "page" (place) is actually a fairly complicated UI with many different panels consisting of lots of widgets. As the user interacts with the app, these panels will come into and out of existence and the display will be changing all the time. For instance, on the #calc page, the user can select which "mode" to display a calculator in: either as Basic or as Advanced. When the user selects Advanced, several additional panels will display (in addition to the Basic panel).
It would be nice to be able to keep such actions in history, so that the user can bookmark the app in either Basic or Advanced mode, so something like:
http://www.mywebapp.com/#calc/basic; or
http://www.mywebapp.com/#calc/advanced
Here's the problem:
We already have several "levels" of activities/places going on here. At the "app"-level, we have the template that needs to be displayed to the user when the MyWebAppModule implements EntryPoint downloads. This TemplatePlace is the default/initial place that is registered with the HistoryHandler before calling:
public class MyWebAppModule implements EntryPoint {
#Override
public void onModuleLoad() {
// ...
// The first place we go to when this module downloads.
TemplatePlace templatePlace = getSomehow();
historyHandler.register(placeController, eventBus, templatePlace);
historyHandler.handleCurrentHistory();
}
}
Next, we have all the different "pages": DashboardPlace, CalculatorPlace, etc. that all have their own unique views/displays. For instance when the user clicks the Calculator link to go to CalculatorPlace, it should render a different view than when the identify that they want to use the calculator in Basic or Advanced mode.
Finally, we have the different display regions, panels, etc. inside each page/place, such as the BasicCalculatorPlace and AdvancedCalculatorPlace. This is what I mean by different "levels" of navigation:
Application-level (a template to apply to all pages/places)
Page- or place-level
Display- or panel-level
The question:
I want to achieve bookmarkable URLs (places) for when the user does all of the following:
Goes to the home page (http://www.mywebapp.com)
Goes to any of the "pages" (http://www.mywebapp.com/#calc, etc.)
Uses the pages/places which cause page-specific panel or display configurations (http://www.mywebapp.com\#calc\#advanced, etc.)
How many Activities and Places do I create? How many ActivityManagers? I guess I'm asking for how granular Activities/Places need to be for each "level" of bookmarkable UI. Thanks in advance!
I think you only need one ActivityManager and one Activity per "page". You can make your "header" and "footer" into widgets that can be reused in each page.
You can bookmark different states of the same page by using tokens. For example, you can set a token to "basic" - it would tell the CalculatorActivity to show basic calculator panel. The URL will look like:
www.myApp.com/?#Calculator:basic
When a user clicks on a widget to select an advanced option, you do
PlaceController.goTo(new CalculatorPlace("advanced"));
The CalculatorActivity will get the CalculatorView (which is already displayed), it will see that the token is set to "advanced" and it will instruct this view to show advanced panels.
Note that you can make your tokens as detailed as necessary and then parse them in Activity. For example, you can have something like
www.myApp.com/?#Calculator:option=basic&position=top&theme=pink

Trying to Implement "Caret Browsing" Using JavaFX 2

I'm trying to write an application using JavaFX 2.0 that includes a web browser control that allows a user to navigate through the text and images on a HTML page using only the keyboard -- basically like "caret browsing" in Internet Explorer.
The goal is to be able to select bits of text or images and copy them to a variable for further manipulation without using a mouse.
I took a look at the HTMLEditor control here:
http://docs.oracle.com/javafx/2.0/ui_controls/editor.htm#CHDBEGDD
but I don't need any editing capability cluttering up the UI, and the documentation says:
The formatting toolbars are provided in the implementation of the
component. You cannot toggle their visibility.
WebView seems like a logical choice (http://docs.oracle.com/javafx/2.0/webview/jfxpub-webview.htm), but I'm not sure how to get a cursor onto the page.
Any advice would be appreciated.
The current WebView support for caret browsing seems patchy at best to me.
Here is what I found running a quick test:
I can invoke webView.requestFocus to have the WebView request focus for responding to key presses, but it just operates on the WebView as a whole, not individual components within the WebView.
WebView does not implement a selection management API similar to TextInputControl for fine grained programmatic management of selections.
WebView does allow you to select text. However, I had to initiate the selection with a mouse drag, and after that I could use a keyboard to enlarge or shorten the selection (left or right arrow keys for a character by character selection and ctrl + left or right arrow keys for word by word selection - up and down arrows did not affect the selection).
After selecting some text in WebView I could press Ctrl-C on it (in Windows) to copy it to a clipboard and paste the text into another program. Only raw text was copied - associated style/html info and images were not copied.
To copy images I had to right click on an image and select Copy Image from a drop down menu and I could paste the image into MS Paint - I could not find a way to do this without a mouse.
In other browsers I can press TAB and Shift + TAB to go from one hyperlink to the next - in WebView, once it has focus, TAB will just go from one control (e.g. an html text field in the WebView) to the next (e.g. an html button in the text field).
The backspace key works as in other browsers (takes you to the previous page).
The above restrictions, and likely others I didn't test for, will likely make it hard to accomplish what you are trying to do. You could try stuff such as capturing keypress events using an eventfilter, then generating mouse events to initiate the selection and copy process, but that sounds difficult to me, and even then, there is currently no public API in JavaFX to generate mouse events, only an unstable com.sun api.
WebView does expose a document object model, and the document is scriptable by JavaScript. Try capturing key events with an eventfilter, listening to the document property for changes and executing JavaScript against the WebView at appropriate times to get and set the current selection. This also seems a little tricky to implement well.
Accomplish as much as you can with the current WebView control and public API and log issues at http://javafx-jira.kenai.com as and when you encounter short-comings.

How do I add background text or image to BIRT report?

I have to add text or background image as "DRAFT" for report when it match certain condition.I have to dynamically enable or display birt report back ground text ?
I am looking forward to hear any ideas.
Thanks In Advance.
Thillakan.
To set up a static background image as you would:
Select the master page in your report workspace.
Select the "Properties" tab.
Expand the Simple Master Page" section.
Set the background image.
However, to make it dynamic based on something (such as a parameter), you can use Javascript to manipulate the report items directly. This is covered in chapter 13 of "Integrating and Extending BIRT" which, along with "BIRT, A Field Guide to Reporting", every BIRT report designer should have.
The easiest way is to name your master page specifically in the report designer and use ReportDesignHandle.findElement(<name>) to get its handle. Then use a setter to dynamically change the background image. The beforeRender script is the one where you want to put all this code which sets the background image.

Categories