use of de.thischwa.pmcms.gui.treeview.TreeViewManager in project pmcms by th-schwarz.
the class EditComp method createCompositeWorkingArea.
/**
* This method initializes composite.
*/
private void createCompositeWorkingArea(Composite parent) {
GridLayout gridLayoutCompositeWorkspace = new GridLayout();
gridLayoutCompositeWorkspace.horizontalSpacing = 0;
gridLayoutCompositeWorkspace.marginWidth = 0;
gridLayoutCompositeWorkspace.marginHeight = 0;
gridLayoutCompositeWorkspace.verticalSpacing = 0;
Composite compositeWorkingspace = new Composite(parent, SWT.NONE);
compositeWorkingspace.setLayout(gridLayoutCompositeWorkspace);
TreeViewManager treeViewManager = InitializationManager.getBean(TreeViewManager.class);
treeViewManager.init(compositeWorkingspace, SWT.NONE);
}
use of de.thischwa.pmcms.gui.treeview.TreeViewManager in project pmcms by th-schwarz.
the class ListenerEditPage method widgetSelected.
@Override
public void widgetSelected(SelectionEvent e) {
TreeViewManager treeViewManager = InitializationManager.getBean(TreeViewManager.class);
APoormansObject<?> po = treeViewManager.getSelectedTreeSitepo();
if (po != null && InstanceUtil.isPage(po)) {
Page page = (Page) po;
BrowserManager browserManager = InitializationManager.getBean(BrowserManager.class);
browserManager.view(page, ViewMode.EDIT);
}
}
use of de.thischwa.pmcms.gui.treeview.TreeViewManager in project pmcms by th-schwarz.
the class ListenerEditPersistentPojoProperties method actionAfterChangedProperties.
private void actionAfterChangedProperties(final APoormansObject<?> po) {
TreeViewManager treeViewManager = InitializationManager.getBean(TreeViewManager.class);
treeViewManager.fillAndExpands(po);
if (InstanceUtil.isRenderable(po)) {
BrowserManager browserManager = InitializationManager.getBean(BrowserManager.class);
browserManager.view(po, ViewMode.PREVIEW);
}
}
use of de.thischwa.pmcms.gui.treeview.TreeViewManager in project pmcms by th-schwarz.
the class ListenerMoveOrderabelToPosition method widgetSelected.
@Override
public void widgetSelected(SelectionEvent event) {
logger.debug("SEL move to postion");
TreeViewManager treeViewManager = InitializationManager.getBean(TreeViewManager.class);
PoStructurTools.moveOrderableTo(orderable, pos);
treeViewManager.fillAndExpands((APoormansObject<?>) orderable);
if (InstanceUtil.isRenderable(orderable)) {
BrowserManager browserManager = InitializationManager.getBean(BrowserManager.class);
browserManager.view((APoormansObject<?>) orderable, ViewMode.PREVIEW);
SiteHolder siteHolder = InitializationManager.getBean(SiteHolder.class);
try {
SitePersister.write(siteHolder.getSite());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
use of de.thischwa.pmcms.gui.treeview.TreeViewManager in project pmcms by th-schwarz.
the class BrowserManager method initializeBrowser.
private void initializeBrowser(final Shell shell, final Display display, final Browser browser) {
final String urlToIgnore = "about:blank";
final TreeViewManager treeViewManager = this.treeViewManager;
browser.addLocationListener(new LocationListener() {
@Override
public void changing(LocationEvent event) {
if (!event.location.equals(urlToIgnore))
logger.debug("url is changing to: " + event.location);
}
@Override
public void changed(LocationEvent event) {
if (!event.location.equals(urlToIgnore)) {
String url = event.location;
logger.debug("url has changed to: " + url);
Link link = InitializationManager.getBean(Link.class);
link.init(event.location);
if (!link.isPoormansRequest())
return;
String idParam = link.getParameter("id");
if (idParam != null && idParam.equals(APoormansObject.UNSET_VALUE + ""))
idParam = null;
APoormansObject<?> po = StringUtils.isBlank(idParam) ? null : ContextUtil.getpo(link);
// synchronizing with the tree view
treeViewManager.fillAndExpands(po);
// persist the site, if a poormans object was saved
if (url.endsWith(Constants.LINK_IDENTICATOR_SAVE)) {
try {
SitePersister.write(siteHolder.getSite());
} catch (IOException e) {
show(e);
}
}
}
}
});
// visibility handling
browser.addVisibilityWindowListener(new VisibilityWindowListener() {
@Override
public void hide(WindowEvent event) {
Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
shell.setVisible(false);
}
@Override
public void show(WindowEvent event) {
Browser browser = (Browser) event.widget;
final Shell shell = browser.getShell();
if (event.location != null)
shell.setLocation(event.location);
if (event.size != null) {
Point size = event.size;
shell.setSize(shell.computeSize(size.x, size.y));
}
shell.open();
}
});
// setting title of the shell
browser.addTitleListener(new org.eclipse.swt.browser.TitleListener() {
@Override
public void changed(org.eclipse.swt.browser.TitleEvent event) {
final Browser tmpBrowser = (Browser) event.getSource();
if (mainBrowser.equals(tmpBrowser) && StringUtils.isNotBlank(event.title)) {
mainWindow.setTitle(event.title);
}
}
});
// BEGIN popup handling
browser.addOpenWindowListener(new OpenWindowListener() {
@Override
public void open(WindowEvent event) {
Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.CLOSE);
shell.setImages(new Image[] { ImageHolder.SHELL_ICON_SMALL, ImageHolder.SHELL_ICON_BIG });
shell.setLayout(new FillLayout());
SWTUtils.center(shell, parentShell.getBounds());
Browser browser = getBrowser(shell);
initializeBrowser(shell, display, browser);
final Browser tempBrowser = browser;
browser.addTitleListener(new // set title for the popup
TitleListener() {
@Override
public void changed(TitleEvent event) {
tempBrowser.getShell().setText(event.title);
}
});
browser.addVisibilityWindowListener(new VisibilityWindowListener() {
@Override
public void hide(WindowEvent event) {
Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
shell.setVisible(false);
}
@Override
public void show(WindowEvent event) {
final Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
if (event.location != null)
shell.setLocation(event.location);
if (event.size != null) {
Point size = event.size;
// hack for bug with too big of safari popups
if (StringUtils.containsIgnoreCase(browserType, "webkit") && (size.x > parentShell.getSize().x || size.y > parentShell.getSize().y)) {
size.x = parentShell.getSize().x - 50;
size.y = parentShell.getSize().y - 50;
shell.setLocation(parentShell.getLocation().x + 15, parentShell.getLocation().y + 15);
shell.setSize(shell.computeSize(size.x, size.y));
} else
shell.setSize(shell.computeSize(size.x, size.y));
}
shell.open();
}
});
event.browser = browser;
}
});
// END popup handling
browser.addCloseWindowListener(new CloseWindowListener() {
@Override
public void close(WindowEvent event) {
Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
shell.close();
}
});
}
Aggregations