Icon icon = pageComponent.getIcon();
if (icon == null) {
IconSource iconSource = (IconSource)ApplicationServicesLocator.services().getService(IconSource.class);
icon = iconSource.getIcon("applicationInfo.image");
}
DockableFrame dockableFrame = new DockableFrame(pageComponent.getId(), icon);
dockableFrame.setTitle(pageComponent.getDisplayName());
dockableFrame.setTabTitle(pageComponent.getDisplayName());
dockableFrame.setFrameIcon(icon);
if(viewDescriptor != null){
dockableFrame.getContext().setInitMode(viewDescriptor.getInitMode());
dockableFrame.getContext().setInitSide(viewDescriptor.getInitSide());
dockableFrame.getContext().setInitIndex(viewDescriptor.getInitIndex());
if(viewDescriptor.getAutohidable() != null){
dockableFrame.setAutohidable(viewDescriptor.getAutohidable().booleanValue());
}
if(viewDescriptor.getFloatable() != null){
dockableFrame.setFloatable(viewDescriptor.getFloatable().booleanValue());
}
if(viewDescriptor.getDockable() != null){
dockableFrame.setDockable(viewDescriptor.getDockable().booleanValue());
}
if(viewDescriptor.getHidable() != null){
dockableFrame.setHidable(viewDescriptor.getHidable().booleanValue());
}
if(viewDescriptor.getSideDockAllowed() != null){
dockableFrame.setSideDockAllowed(viewDescriptor.getSideDockAllowed().booleanValue());
}
if(viewDescriptor.getSlidingAutohide() != null){
dockableFrame.setSlidingAutohide(viewDescriptor.getSlidingAutohide().booleanValue());
}
if(viewDescriptor.getTabDockAllowed() != null){
dockableFrame.setTabDockAllowed(viewDescriptor.getTabDockAllowed().booleanValue());
}
if(viewDescriptor.getShowGripper() != null){
dockableFrame.setShowGripper(viewDescriptor.getShowGripper().booleanValue());
}
if(viewDescriptor.getMaximizable() != null){
dockableFrame.setMaximizable(viewDescriptor.getMaximizable().booleanValue());
}
if(viewDescriptor.getRearrangable() != null){
dockableFrame.setRearrangable(viewDescriptor.getRearrangable().booleanValue());
}
}
else{
dockableFrame.getContext().setInitMode(DockContext.STATE_FRAMEDOCKED);
dockableFrame.getContext().setInitSide(DockContext.DOCK_SIDE_EAST);
dockableFrame.getContext().setInitIndex(0);
}
dockableFrame.addDockableFrameListener(new DockableFrameAdapter() {
public void dockableFrameRemoved(DockableFrameEvent event) {
if(logger.isDebugEnabled()){
logger.debug("Frame removed event on "+pageComponent.getId());
}
fireClosed(pageComponent);
}
public void dockableFrameActivated(DockableFrameEvent e) {
if(logger.isDebugEnabled()){
logger.debug("Frame activated event on "+pageComponent.getId());
}
fireFocusLost(workspaceComponent);
fireFocusGained(pageComponent);
}
public void dockableFrameDeactivated(DockableFrameEvent e){
if(logger.isDebugEnabled()){
logger.debug("Frame deactivated event on "+pageComponent.getId());
}
fireFocusLost(pageComponent);
}
});
dockableFrame.getContentPane().setLayout(new BorderLayout());
dockableFrame.getContentPane().add(pageComponent.getControl());
// This is where the view specific toolbar and menu bar get added. Note,
// that this is different from the editors. With the views they are part
// of the dockable frame, but with editors we add them to the editor
// pane itself in EditorComponentPane
if(pageComponent instanceof JideAbstractView){
JideAbstractView view = (JideAbstractView)pageComponent;
dockableFrame.setTitleBarComponent(view.getViewToolBar());
dockableFrame.setJMenuBar(view.getViewMenuBar());
}
return dockableFrame;
}