getJSplitPane().setRightComponent(new JPanel());
if (getLayout() instanceof StructureLayoutItem) {
StructureLayoutItem l = (StructureLayoutItem) getLayout();
LayoutEnumeration e = l.getStructureLayoutArray().getEnumeration();
DefaultLayoutItem leftLayout = (DefaultLayoutItem) e.next();
DefaultLayoutItem rightLayout = (DefaultLayoutItem) e.next();
if (leftLayout != null) {
try {
DataViewer viewer;
StructureLayoutItem structureLayout = new StructureLayoutItem();
if (isEditor()) {
viewer = factory.createViewer(new StructEditorCreator(), getModel());
} else {
viewer = factory.createViewer(new StructViewerCreator(), getModel());
}
structureLayout.append(leftLayout);
viewer.setLayout(structureLayout);
getJSplitPane().setLeftComponent(viewer.getJComponent());
} catch (Exception ex1) {
ex1.printStackTrace();
}
}
if (rightLayout != null) {
try {
DataViewer viewer;
StructureLayoutItem structureLayout = new StructureLayoutItem();
if (isEditor()) {
viewer = factory.createViewer(new StructEditorCreator(), getModel());
} else {
viewer = factory.createViewer(new StructViewerCreator(), getModel());
}
structureLayout.append(rightLayout);
viewer.setLayout(structureLayout);
getJSplitPane().setRightComponent(viewer.getJComponent());
} catch (Exception ex1) {
ex1.printStackTrace();
}
}
} else {
if (getLayout() != null) {
FWLog.log("Unsupported layout for " + getClass().getName() + " have " + getLayout().getClass().getName() + " need instanceof StructureLayoutItem");
}
// take the first two children and create associated editors/viewers
DataModel dm = getModel().getChildren().firstItem();
if (dm != null) {
try {
getJSplitPane().setLeftComponent(factory.createViewer(dm, isEditor()).getJComponent());
} catch (Exception ex) {
ex.printStackTrace();
}
dm = getModel().getChildren().nextItem();
if (dm != null) {
try {
getJSplitPane().setRightComponent(factory.createViewer(dm, isEditor()).getJComponent());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}