Certain objects refuse to appear in pop-up [message #695795] |
Tue, 12 July 2011 15:00 |
ouri.maler Messages: 22 Registered: July 2010 |
Junior Member |
|
|
The GUI I'm working on, in addition to several tabs, has progress bars that appear in pop-up Shells and a display where a Graph (using the ZEST library) appears. These all work fine. More recently, however, I wanted to add a feature that would make a sub-graph appear in a pop-up when a node on the graph was clicked. For some reason, though, the new Shell that pops up is blank. When I coded a ProgressBar in there, it displayed just fine, but when I do the same with a Graph, I get no results. When I put a Composite in there, it doesn't show up either, whether its contents are a Graph or a ProgressBar.
//when the user double-clicks a node, we want the node's properties to be displayed:
graph.addListener(SWT.MouseDoubleClick, new Listener() {
public void handleEvent(Event event)
{
try {
Shell automataShell = new Shell(display);
automataShell.setText("automata");
automataShell.setSize(500, 400);
automataShell.open();
automataShell.setLocation(300, 300);
automataShell.setVisible(true);
automataShell.setLayout(new FillLayout());
//this ProgressBar, put there as a test, displays just fine.
ProgressBar progressBar = new ProgressBar(automataShell, SWT.NULL);
progressBar.setMinimum(0);
progressBar.setMaximum(100);
progressBar.setBounds(100, 10, 200, 20);
progressBar.setSelection(0);
GraphNode selected = (GraphNode)graph.getSelection().get(0);
output(selected.getText() + "\n");
DNode node = getNode(nodeList, selected.getText());
String nodeType = null;
if(node instanceof DComponent)
nodeType = "Component";
if(node instanceof DConnector)
nodeType = "Connector";
output("Selection: " + node.getNodeName() + " is a " + nodeType + "; " + node.getDescription());
//This Graph doesn't display. I can't tell why - the method used is similar to the one with which I've created the Graph in the primary Shell.
Graph automataGraph = new Graph(automataShell, SWT.NULL);
automataGraph.setLayoutData(new RowData(490, 390));
makeGraph(node, null, null, automataGraph);
automataGraph.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
automataGraph.applyLayout();
}
catch (Exception e) {
}
}
});
Any suggestions?
|
|
|
Powered by
FUDForum. Page generated in 0.03751 seconds