Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Dynamic Component, Preview Problem(The Preview will load the View twice, once with the Controller, and once without.)
Dynamic Component, Preview Problem [message #1755927] Thu, 09 March 2017 10:53 Go to next message
Phil Kan is currently offline Phil KanFriend
Messages: 4
Registered: March 2017
Junior Member
Hello Guys,

my Name is Philipp i'm 24 years and from Germany. At the Moment I have a little Problem with the JavaFX Preview Feature in my Project.

To create a custom control I use the "dynamic component" attribute from the FXGraph, which works perfectly at my running Application. But when I use the JavaFX Preview feature, the custom control will be rendered twice. The first time with an active controller (even when I hadn't select the "load controller" button) and than without the controller.

Like I said, it makes no problem at the running Application but it is really annoying when you work at the fxgraph file. Because the preview always loads my controller, it could happen that the fxgraph file did not response for several seconds, because the controller fills his elements with data at the initialize method.

So I want to ask what I can do about this:
- The Controller always loads and not only when I pressed the "Load Controller"
- The Preview loads the own custom control twice.

Maybe it's just my stupid way how I use the dynamic component function. So here is a simple code example

The java Class which should represent the custom control, where I can store my variables and load the FXGraph.
public class BasicButtonView extends VBox {
	
	public BasicButtonView() throws IOException {
		super();
		FXMLLoader loader = new FXMLLoader(this.getClass().getResource("/basic/button/BasicButtonView.fxml"));
		loader.setRoot(this);
		loader.load();
	}
}


My FXGraph File, which has the BasicButtonView (which is a VBox) as root

dynamic component BasicButtonView controlledby BasicButtonController {
	BasicButtonView {
		Button id btnBasic {
			text : "Hello World"
		}
	}
}


My Controller which will be loaded everytime :/
public class BasicButtonController implements Initializable {
	@FXML
	Button btnBasic;

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		//Normally some magic, that can take several seconds
		btnBasic.setText("Goodbye World");
	}
}


The Preview
(Im Not sure if this "Insert image into message body" works that way :/ Its attachment "Preview")
index.php/fa/28716/0/



The way I use it from an other FXGraph file

dynamic component BasicCheckboxView controlledby BasicCheckboxController {
	BasicCheckboxView id rootNode {
		top : BasicButtonView,
		left : Label{
			text : "Magic"
		}
	}
}


The Preview from the other FXGraph

(Im Not sure if this "Insert image into message body" works that way :/ Its attachment "Preview2")
index.php/fa/28717/0/


The way I use it in my Application
	@Override
	public void start(Stage primaryStage) throws Exception {
		Scene scene = new Scene(new BasicButtonView());
		primaryStage.setScene(scene);
		primaryStage.show();
	}


I hope some of you can solve my problem. Thank you in anticipation!
Greetings
Philipp
  • Attachment: Preview.PNG
    (Size: 8.98KB, Downloaded 152 times)
  • Attachment: Preview2.PNG
    (Size: 7.58KB, Downloaded 145 times)
Re: Dynamic Component, Preview Problem [message #1756241 is a reply to message #1755927] Tue, 14 March 2017 12:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6363
Registered: July 2009
Senior Member
I'm not sure I can follow that. Please create a small sample project and push it eg to github so that I can take a look
Re: Dynamic Component, Preview Problem [message #1756245 is a reply to message #1756241] Tue, 14 March 2017 13:21 Go to previous messageGo to next message
Phil Kan is currently offline Phil KanFriend
Messages: 4
Registered: March 2017
Junior Member
Thanks for replying. You can find the example project at: https://github.com/WatzlCe/DCProblem
Re: Dynamic Component, Preview Problem [message #1758418 is a reply to message #1756245] Tue, 28 March 2017 13:51 Go to previous messageGo to next message
Phil Kan is currently offline Phil KanFriend
Messages: 4
Registered: March 2017
Junior Member
Did someone find a solution for this problem yet? It's still present and a little anoying Crying or Very Sad
Re: Dynamic Component, Preview Problem [message #1758492 is a reply to message #1758418] Wed, 29 March 2017 09:18 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6363
Registered: July 2009
Senior Member
I've not had the cycles to look at your example sorry
Previous Topic:Disappointed in e(fx)clipse (and Eclipse.
Next Topic:Problems with installing e(fx)clipse to Eclipse Kepler
Goto Forum:
  


Current Time: Mon Oct 23 04:46:05 GMT 2017

Powered by FUDForum. Page generated in 0.02335 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software