Search in sources :

Example 1 with TreeViewManager

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);
}
Also used : TreeViewManager(de.thischwa.pmcms.gui.treeview.TreeViewManager) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite)

Example 2 with TreeViewManager

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);
    }
}
Also used : TreeViewManager(de.thischwa.pmcms.gui.treeview.TreeViewManager) BrowserManager(de.thischwa.pmcms.gui.BrowserManager) Page(de.thischwa.pmcms.model.domain.pojo.Page)

Example 3 with TreeViewManager

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);
    }
}
Also used : TreeViewManager(de.thischwa.pmcms.gui.treeview.TreeViewManager) BrowserManager(de.thischwa.pmcms.gui.BrowserManager)

Example 4 with TreeViewManager

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);
        }
    }
}
Also used : TreeViewManager(de.thischwa.pmcms.gui.treeview.TreeViewManager) BrowserManager(de.thischwa.pmcms.gui.BrowserManager) SiteHolder(de.thischwa.pmcms.livecycle.SiteHolder) IOException(java.io.IOException)

Example 5 with TreeViewManager

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();
        }
    });
}
Also used : TreeViewManager(de.thischwa.pmcms.gui.treeview.TreeViewManager) APoormansObject(de.thischwa.pmcms.model.domain.pojo.APoormansObject) TitleListener(org.eclipse.swt.browser.TitleListener) IOException(java.io.IOException) Point(org.eclipse.swt.graphics.Point) TitleListener(org.eclipse.swt.browser.TitleListener) FillLayout(org.eclipse.swt.layout.FillLayout) Image(org.eclipse.swt.graphics.Image) Shell(org.eclipse.swt.widgets.Shell) TitleEvent(org.eclipse.swt.browser.TitleEvent) CloseWindowListener(org.eclipse.swt.browser.CloseWindowListener) LocationListener(org.eclipse.swt.browser.LocationListener) WindowEvent(org.eclipse.swt.browser.WindowEvent) VisibilityWindowListener(org.eclipse.swt.browser.VisibilityWindowListener) LocationEvent(org.eclipse.swt.browser.LocationEvent) Link(de.thischwa.pmcms.tool.Link) TitleEvent(org.eclipse.swt.browser.TitleEvent) OpenWindowListener(org.eclipse.swt.browser.OpenWindowListener) Browser(org.eclipse.swt.browser.Browser)

Aggregations

TreeViewManager (de.thischwa.pmcms.gui.treeview.TreeViewManager)9 BrowserManager (de.thischwa.pmcms.gui.BrowserManager)6 SiteHolder (de.thischwa.pmcms.livecycle.SiteHolder)5 IOException (java.io.IOException)5 Site (de.thischwa.pmcms.model.domain.pojo.Site)3 File (java.io.File)3 Shell (org.eclipse.swt.widgets.Shell)3 FatalException (de.thischwa.pmcms.exception.FatalException)2 IRenderable (de.thischwa.pmcms.model.IRenderable)2 APoormansObject (de.thischwa.pmcms.model.domain.pojo.APoormansObject)2 FileDialog (org.eclipse.swt.widgets.FileDialog)2 MessageBox (org.eclipse.swt.widgets.MessageBox)2 PropertiesManager (de.thischwa.pmcms.conf.PropertiesManager)1 ListenerAddSite (de.thischwa.pmcms.gui.listener.ListenerAddSite)1 ListenerBackupSite (de.thischwa.pmcms.gui.listener.ListenerBackupSite)1 ListenerExportSite (de.thischwa.pmcms.gui.listener.ListenerExportSite)1 ListenerImportSite (de.thischwa.pmcms.gui.listener.ListenerImportSite)1 ListenerUploadSite (de.thischwa.pmcms.gui.listener.ListenerUploadSite)1 Image (de.thischwa.pmcms.model.domain.pojo.Image)1 Macro (de.thischwa.pmcms.model.domain.pojo.Macro)1