Search in sources :

Example 1 with TabbedView

use of com.ramussoft.gui.common.TabbedView in project ramus by Vitaliy-Yakovchuk.

the class SimleGUIPluginFactory method initContent.

// @SuppressWarnings("deprecation")
private void initContent() {
    control = new Control(plugableFrame, this);
    // control.setTheme(control.getThemes().getFactory(2).create());
    control.addControlListener(new ControlListener() {

        @Override
        public void closed(Control control, DFrame dockable) {
            Boolean b = recHash.get(Thread.currentThread());
            if (b != null)
                return;
            recHash.put(Thread.currentThread(), true);
            List<TabView> list = new ArrayList<TabView>();
            for (Entry<TabView, TabFrame> e : tabDockables.entrySet()) {
                if (e.getValue().equals(dockable)) {
                    TabView view = e.getKey();
                    list.add(view);
                }
            }
            for (TabView view : list) view.close();
            recHash.remove(Thread.currentThread());
        }
    });
    control.addFocusListener(new FrameFocusListener() {

        @Override
        public void focusGained(DFrame dockable) {
            List<View> list = new ArrayList<View>();
            for (Entry<TabView, TabFrame> e : tabDockables.entrySet()) {
                if (e.getValue().equals(dockable)) {
                    TabView view = e.getKey();
                    list.add(view);
                }
            }
            if (dockable instanceof UniqueDFrame) {
                list.add(findUniqueView(((UniqueDFrame) dockable).getUniqueId()));
            }
            for (View view : list) {
                lastActiveView = view;
                view.focusGained();
                plugableFrame.setViewActions(view.getGlobalActions());
                if ((!(view instanceof UniqueView)) && (view instanceof TabView)) {
                    if (currentWorkspace != null)
                        workspaceViews.put(currentWorkspace, view);
                }
            }
        }

        @Override
        public void focusLost(DFrame dockable) {
            List<View> list = new ArrayList<View>();
            for (Entry<TabView, TabFrame> e : tabDockables.entrySet()) {
                if (e.getValue().equals(dockable)) {
                    TabView view = e.getKey();
                    list.add(view);
                }
            }
            if (dockable instanceof UniqueDFrame) {
                list.add(findUniqueView(((UniqueDFrame) dockable).getUniqueId()));
            }
            for (View view : list) view.focusLost();
            plugableFrame.setViewActions(new String[] {});
        }
    });
    // control.setTheme(ThemeMap.KEY_ECLIPSE_THEME);
    contentArea = control.getContentArea();
    plugableFrame.add(contentArea, BorderLayout.CENTER);
    for (UniqueView view : uniqueViews) {
        String id = view.getId();
        final UniqueDFrame dockable = new UniqueDFrame(control, id, findPluginForViewId(id).getString(id), view);
        dockable.setCloseable(true);
        initActions(view.getId(), view, dockable);
        control.add(dockable);
        uniqueDockables.add(dockable);
        framework.addActionListener(id, new ActionListener() {

            @Override
            public void onAction(ActionEvent event) {
                dockable.setVisible(true);
            }
        });
        if (currentWorkspace.equals(view.getDefaultWorkspace()))
            dockable.setVisible(true);
    }
    control.commitUniqueViews();
    for (TabbedView view : tabbedViews) {
        String id = view.getId();
        if (getWorkingArea(id) != null)
            continue;
        Area area = control.createWorkingArea(id);
        uniqueWorkingAreas.add(area);
        area.setVisible(true);
    }
    framework.setMainFrame(plugableFrame);
}
Also used : TabView(com.ramussoft.gui.common.TabView) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) UniqueView(com.ramussoft.gui.common.UniqueView) TabView(com.ramussoft.gui.common.TabView) TabbedView(com.ramussoft.gui.common.TabbedView) View(com.ramussoft.gui.common.View) TabbedView(com.ramussoft.gui.common.TabbedView) Entry(java.util.Map.Entry) UniqueView(com.ramussoft.gui.common.UniqueView) ActionListener(com.ramussoft.gui.common.event.ActionListener) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with TabbedView

use of com.ramussoft.gui.common.TabbedView in project ramus by Vitaliy-Yakovchuk.

the class GUIPluginFactory method initContent.

@SuppressWarnings("deprecation")
private void initContent() {
    control = new CControl(plugableFrame, false);
    // control.setTheme(control.getThemes().getFactory(2).create());
    control.addControlListener(new CControlListener() {

        @Override
        public void added(CControl control, CDockable dockable) {
        }

        @Override
        public void closed(CControl control, CDockable dockable) {
            Boolean b = recHash.get(Thread.currentThread());
            if (b != null)
                return;
            recHash.put(Thread.currentThread(), true);
            List<TabView> list = new ArrayList<TabView>();
            for (Entry<TabView, TabDockable> e : tabDockables.entrySet()) {
                if (e.getValue().equals(dockable)) {
                    TabView view = e.getKey();
                    list.add(view);
                }
            }
            for (TabView view : list) view.close();
            recHash.remove(Thread.currentThread());
        }

        @Override
        public void opened(CControl control, CDockable dockable) {
        }

        @Override
        public void removed(CControl control, CDockable dockable) {
        }
    });
    control.addFocusListener(new CFocusListener() {

        @Override
        public void focusGained(CDockable dockable) {
            List<View> list = new ArrayList<View>();
            for (Entry<TabView, TabDockable> e : tabDockables.entrySet()) {
                if (e.getValue().equals(dockable)) {
                    TabView view = e.getKey();
                    list.add(view);
                }
            }
            if (dockable instanceof DefaultSingleCDockable) {
                list.add(findUniqueView(((DefaultSingleCDockable) dockable).getUniqueId()));
            }
            for (View view : list) {
                lastActiveView = view;
                view.focusGained();
                plugableFrame.setViewActions(view.getGlobalActions());
                if ((!(view instanceof UniqueView)) && (view instanceof TabView)) {
                    if (currentWorkspace != null)
                        workspaceViews.put(currentWorkspace, view);
                }
            }
        }

        @Override
        public void focusLost(CDockable dockable) {
            List<View> list = new ArrayList<View>();
            for (Entry<TabView, TabDockable> e : tabDockables.entrySet()) {
                if (e.getValue().equals(dockable)) {
                    TabView view = e.getKey();
                    list.add(view);
                }
            }
            if (dockable instanceof DefaultSingleCDockable) {
                list.add(findUniqueView(((DefaultSingleCDockable) dockable).getUniqueId()));
            }
            for (View view : list) view.focusLost();
            plugableFrame.setViewActions(new String[] {});
        }
    });
    // control.setTheme(ThemeMap.KEY_ECLIPSE_THEME);
    contentArea = control.getContentArea();
    plugableFrame.add(contentArea, BorderLayout.CENTER);
    for (UniqueView view : uniqueViews) {
        String id = view.getId();
        final DefaultSingleCDockable dockable = new DefaultSingleCDockable(id, findPluginForViewId(id).getString(id), view.createComponent());
        dockable.setCloseable(true);
        initActions(view.getId(), view, dockable);
        control.addDockable(dockable);
        uniqueDockables.add(dockable);
        framework.addActionListener(id, new ActionListener() {

            @Override
            public void onAction(ActionEvent event) {
                dockable.setVisible(true);
            }
        });
        if (currentWorkspace.equals(view.getDefaultWorkspace()))
            dockable.setVisible(true);
    }
    for (TabbedView view : tabbedViews) {
        String id = view.getId();
        if (getWorkingArea(id) != null)
            continue;
        CWorkingArea area = control.createWorkingArea(id);
        uniqueWorkingAreas.add(area);
        // area.setTitleShown(false);
        // if (currentWorkspace.equals(view.getDefaultWorkspace()))
        area.setVisible(true);
        TabbedFactory factory = new TabbedFactory();
        factories.put(id, factory);
        control.addMultipleDockableFactory(id, factory);
    // dockable.setWorkingArea(area);
    // dockable1.setWorkingArea(area);
    // control.add(dockable1);
    // control.add(dockable);
    // dockable.setLocation(CLocation.base().)
    }
    framework.setMainFrame(plugableFrame);
}
Also used : CControl(bibliothek.gui.dock.common.CControl) TabView(com.ramussoft.gui.common.TabView) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) UniqueView(com.ramussoft.gui.common.UniqueView) TabView(com.ramussoft.gui.common.TabView) TabbedView(com.ramussoft.gui.common.TabbedView) View(com.ramussoft.gui.common.View) CWorkingArea(bibliothek.gui.dock.common.CWorkingArea) TabbedView(com.ramussoft.gui.common.TabbedView) Entry(java.util.Map.Entry) UniqueView(com.ramussoft.gui.common.UniqueView) CFocusListener(bibliothek.gui.dock.common.event.CFocusListener) ActionListener(com.ramussoft.gui.common.event.ActionListener) List(java.util.List) ArrayList(java.util.ArrayList) CControlListener(bibliothek.gui.dock.common.event.CControlListener) DefaultSingleCDockable(bibliothek.gui.dock.common.DefaultSingleCDockable) SingleCDockable(bibliothek.gui.dock.common.SingleCDockable) CDockable(bibliothek.gui.dock.common.intern.CDockable) DefaultSingleCDockable(bibliothek.gui.dock.common.DefaultSingleCDockable) DefaultCDockable(bibliothek.gui.dock.common.intern.DefaultCDockable)

Aggregations

TabView (com.ramussoft.gui.common.TabView)2 TabbedView (com.ramussoft.gui.common.TabbedView)2 UniqueView (com.ramussoft.gui.common.UniqueView)2 View (com.ramussoft.gui.common.View)2 ActionEvent (com.ramussoft.gui.common.event.ActionEvent)2 ActionListener (com.ramussoft.gui.common.event.ActionListener)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Entry (java.util.Map.Entry)2 CControl (bibliothek.gui.dock.common.CControl)1 CWorkingArea (bibliothek.gui.dock.common.CWorkingArea)1 DefaultSingleCDockable (bibliothek.gui.dock.common.DefaultSingleCDockable)1 SingleCDockable (bibliothek.gui.dock.common.SingleCDockable)1 CControlListener (bibliothek.gui.dock.common.event.CControlListener)1 CFocusListener (bibliothek.gui.dock.common.event.CFocusListener)1 CDockable (bibliothek.gui.dock.common.intern.CDockable)1 DefaultCDockable (bibliothek.gui.dock.common.intern.DefaultCDockable)1