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.
Related
I have a configurations pane in my JavaFX 8 application that is spread across a number of tabs within tabs. Currently I am forced to split tabs for a longer configuration process.
I know that I'll have two .fxml files for the two tabs, but I should be able to use the same controller for both. Currently, however, if I make changes to one tab, the other tab doesn't see the changes. I'm guessing it creates a separate instance of the controller. Is it possible for the two .fxml tabs to use the same instance of the controller so that the information can be shared across the two tabs?
Example for more clarification:
Tab1 contains textfield input for email, Firstname, etc.
Tab2 uses email information and generates usernames and allows user to modify other settings using the generated values.
To reuse a controller between multiple FXML loads, you can use fxmlLoader.setController() or fxmlLoader.setControllerFactory().
I don't really recommend a reused controller approach, so I won't post detailed code for it here. Rather, I recommend passing parameters.
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.
For a custom Eclipse plugin, I've been looking into creating a perspective that will help organize views in a way that makes work easier for the editors, with the main requirement that we would like to simultaneously see two editor areas in the perspective.
Our plugin uses two new editor types: A "Workflow Editor" (WE) and a "Trial Editor" (TE) We would like to make sure that all instances of the WE are opened in one area of the perspective, and all in the TE are opened in a separate area.
Essentially, it looks like the perspective whose link is below, except that in place of the Java editing views in the top-right, we'd have the WE views, and in place of the text editing views in the bottom-right, we would have the TE views.
(http://dl.dropbox.com/u/4148918/eclipse-multi-editor.jpg)
I took a look at the tutorial on creating perspectives here: http://www.eclipse.org/articles/using-perspectives/PerspectiveArticle.html . While this is a good start, it looks like by default perspective layouts only support one editor area, in which all editor views are opened:
public void defineLayout(IPageLayout layout) {
// Editors are placed for free.
String editorArea = layout.getEditorArea();
// Place navigator and outline to left of
// editor area.
IFolderLayout left =
layout.createFolder("left", IPageLayout.LEFT, (float) 0.26, editorArea);
left.addView(IPageLayout.ID_RES_NAV);
left.addView(IPageLayout.ID_OUTLINE);
}
How would one customize this layout such that it has two editor areas instead of one, each of which supports the editing of one distinct file type? While I have found a couple of online samples where the editor pane is split, these examples don't inherently support the automatic opening of one file type in one of the editors vs. the other, which is a desired feature for this plugin.
Alternatively, could one use 'folders,' and have instances of each editor open in these specialized folders? If so, what would be the entry point for defining new views associated with these editors, like those enumerated with "IPageLayout.ID_*" above?
Would much appreciate any advice someone has -- I think it's a cool problem to get two editors to show up simultaneously in different sections of an eclipse plugin, and it would be great if we could get it to work!
How would one customize this layout such that it has two editor areas instead of one, each of which supports the editing of one distinct file type?
You can't. As you've mentioned, you can only define one editor area in an Eclipse perspective.
You have two choices. Your first choice is to create your own multi page editor with a "Workflow Editor" (WE) on one page and a "Trial Editor" (TE) on the other page.
You second choice is to build an Eclipse workspace from the ground up with two (or more) editor areas. You can look through the Eclipse source for help, but you would basically be building your own Eclipse.
in my application the user is requested to enter data in a form-like editor.
A form contains a couple of items of different data types (strings, dates,
numbers).
I am looking into Eclipse forms to build this editor, composing the form of
different input elements, one for each data type.
Since the underlying model is not static (items may be added/removed
depending on user selection),
the form view must be dynamically rebuild on model changes. Using SWT I
could have removed all components from the forms
and added the updated components again. How can this be done in SWT /
Eclipse Forms API ? I tried to dispose() the form widgets and create
new ones, but the newly created widgets won't appear.
Since I am new to SWT
this is probably not the way things are meant to be done.
Any ideas or sample code would help...?
After dispose() and creation of new form elements, try to call parent.layout() in order to position your new widgets.
I wonder if there is some library I have missed that allows me to distribute text among different text objects and have it reflow depending on size, newspaper style? it's something pretty easily done in web but I can't find anything like it on Java for Android.
I don't know of any Android Layouts that work that way. You could probably create one that mimics the way html and css work though.
another option is to make your content with the Web technologies that you are used to and just display it inside of a WebView in your application. That would likely be a lot easier than trying to create the Layout yourself.
I had two text fields of different size and different default justification plus offset from the screen border. I simply overlapped them in the same space. Depending on what needed to be displayed, I would null out one field and fill in the other. It kept me from creating 2 different layouts and having to get creative with the text formatting.