2 TreePanels with same store? - extjs4.2

I have the following Case:
TreePanel (width: 400, Height: 300) with a button in the TopBar. When user click on this Button , we open a new Window (width: 800, Height: 600) containing the same TreePanel.
My Question is:
Is it possible to copy the TreePanel into the new Window or at least using the TreePanel's store as a store for the new TreePanel?
Or I am obliged to create a new TreePanel with a new Store?
Thanks,

Yes, you can use the same store in both TreePanels. Give the store a storeId, and then user the Ext.data.StoreManager to get the store based on the storeId.
For more information: http://docs-origin.sencha.com/extjs/4.2.0/#!/api/Ext.data.StoreManager
As for using the same TreePanel, you can't use the exact same instance, but you can create a class that extends TreePanel, and then just instantiate your custom TreePanel in both the places you want it.

Related

How to create shapetext using Java

I am trying to create shape texts directly using codes as the number of shapetext i need may vary.
I tried using the code below, and I created the shapes in a collection (with type shapetext). When I use "traceln(text.getX());" it prints 2500 but I do not see the text anywhere on the screen. May I understand what I have done wrongly and how can I make the shapetext be shown? Do I have to add shapetexts into my network/level and initialize it?
Thank you for your help!
ShapeText text = new ShapeText(SHAPE_DRAW_2D3D, true, (double) 2500, (double) 3000, (double) 0, 0, black, "testing", new Font("SansSerif", Font.BOLD, 100), ALIGNMENT_CENTER );
You have successfully created the text, but you need to add it to the presentation to be shown
Simply add
presentation.add(text);
An alternative option if you have an undetermined amount of texts is to rather create a single text object and then replicate it as many times as you want to show it. Once you add a replication to a presentation object a local variable called index is now available for you to use in many of the fields.
Use this in the dynamic text field to get the values you want to display (like in the example below I stored the texts in a collection)
And you also use this index to change the position of the text (See what I have done in the Y coordinates)

In gwt read value from dynamic created text area

In gwt, I am creating a dynamic text area and now I want to read the value of the text area.
Can some help in me reading the value of dynamic created text area.
It all depends on which classes you use. The convenient way to read from com.google.gwt.user.client.ui.Label is to call getText(). But of cause the most generic way to get the interior of your "text area" is to call getElement().getInnerHTML() of your com.google.gwt.user.client.ui.UIObject object. For example:
FlowPanel myTextArea = new FlowPanel(); // FlowPanel extends Widget extends UIObject
myTextArea.add(someWidget);
GWT.log("Here is what I have inside myTextArea: " +
myTextArea.getElement().getInnerHTML());
A note of criticism. Normally, when you ask a question related to some custom UI, it should come along with at least few lines of code.

Opening frame that is under the JavaFX program category

Most of program is using JFrames throughout the application for all the different windows that can appear. However, I have to play an instructional video for the user inside a JFrame. I couldn't find a way to do this, so I had to make a JavaFX program. Is there a way to get directly from one of my JFrames to the JavaFX window?
I've been using syntax like this to open up other JFrame:
dispose();
paths pths = new paths();
pths.setVisible(true);
However, when trying to open up the JavaFX using the above code, I get errors. I also can't create a new JavaFX inside an already existing project.
I am not sure to understand your problem but in order to create a new frame in JavaFX. You have to create a new class with a new stage. Let's say you create a new class "newFrame" with the code below.
public void show(Stage stage){
//define your root
double width = 200;
double height = 200;
Scene scene = new Scene(root, width , height);
stage.show();
}
You can show the new frame by using :
newFrame NT = new newFrame();
NT.show();

Opening secondary window in Java FX as child, forces overlap - anyway to overcome it?

I am attempting a simple app in Java FX 8 where I will have a window which is the main application and presents a list of to-do's.
When you select a to-do it opens a child window related to the to-do that was opened.
However, the child window will always be in front of the parent (unless side by side), but I will allow opening multiple windows, and navigation back to the parent.
Is there a way to allow the parent to become fully in view while still having the secondary window as a child?
Sample code:
Scene secondScene = new Scene(root, 800, 400);
Stage secondStage = new Stage();
secondStage.setTitle("Your to-do.....");
secondStage.setScene(secondScene);
secondStage.initStyle(StageStyle.DECORATED);
secondStage.initModality(Modality.NONE);
secondStage.initOwner(primaryStage);
primaryStage.toFront();
secondStage.show();
Did you already try secondStage.setAlwaysOnTop(false)? I'd assume it's true by default, that's why the behaviour.
You could use:
secondStage.initModality(Modality.APPLICATION_MODAL);
You can find a reference here: http://docs.oracle.com/javafx/2/api/javafx/stage/Modality.html

Eclipse RCP - Programmatically setting a view to not be closeable

I'm trying to create an RCP view that is not closeable. I need a way to set this property programmatically because I'm creating views with secondary IDs in in the code. I can't do it through the extension editor dialogs because of this.
Is there a way to remove the x from a view programmatically?
I was finally able to figure this out.
In your perspective's createInitialLayout() function you can get the layout of the view and set its closeable property:
IViewLayout vLayout = layout.getViewLayout(View.ID);
vLayout.setCloseable(false);
This will work for views with secondary ids too. The code would be exactly the same in that case, because it will apply the closeable property to all secondary views that share the same primary id.
I've found that the following won't work:
IViewLayout vLayout = layout.getViewLayout(View.ID + ":1");
vLayout.setCloseable(false);
So you can't make individual views closeable based on their secondary ids. Either the whole group is or isn't.
You can do it easily.
Just set the closable property of view to False.
IViewLayout layout= layout.getViewLayout(View.ID);
layout.setCloseable(false);