Search in sources :

Example 1 with ActionEvent

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

the class SelectRowPanel method createRightComponent.

private void createRightComponent() {
    if (qualifierView == null)
        return;
    qualifier = qualifierView.getSelectedQualifier();
    boolean b = qualifier != null;
    if (b) {
        framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
        selectableTableView = new SelectableTableView(framework, dataPlugin.getEngine(), accessRules, qualifier) {
        };
        int dl = splitPane.getDividerLocation();
        splitPane.setRightComponent(createComponent());
        for (Row row : getSelectedRows(qualifier)) selectableTableView.getComponent().getModel().setSelectedRow(selectableTableView.getComponent().getRowSet().findRow(row.getElementId()), true);
        splitPane.revalidate();
        splitPane.repaint();
        splitPane.setDividerLocation(dl);
        selectableTableView.getComponent().getModel().addSelectionListener(selectionListener);
        if (!getSelectType().equals(SelectType.CHECK))
            selectableTableView.setSelectType(getSelectType());
    }
}
Also used : ActionEvent(com.ramussoft.gui.common.event.ActionEvent) Row(com.ramussoft.database.common.Row) SelectableTableView(com.ramussoft.gui.qualifier.table.SelectableTableView)

Example 2 with ActionEvent

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

the class SelectRowDialog method createRightComponent.

private void createRightComponent() {
    if (qualifierView == null)
        return;
    qualifier = qualifierView.getSelectedQualifier();
    boolean b = qualifier != null;
    addQualifier = b;
    if (b) {
        framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
        selectableTableView = new SelectableTableView(framework, dataPlugin.getEngine(), accessRules, qualifier) {
        };
        int dl = splitPane.getDividerLocation();
        splitPane.setRightComponent(createComponent());
        for (Row row : getSelectedRows(qualifier)) selectableTableView.getComponent().getModel().setSelectedRow(row, true);
        splitPane.revalidate();
        splitPane.repaint();
        splitPane.setDividerLocation(dl);
        selectableTableView.getComponent().getModel().addSelectionListener(selectionListener);
        if (!getSelectType().equals(SelectType.CHECK))
            selectableTableView.setSelectType(getSelectType());
    }
}
Also used : ActionEvent(com.ramussoft.gui.common.event.ActionEvent) Row(com.ramussoft.database.common.Row) SelectableTableView(com.ramussoft.gui.qualifier.table.SelectableTableView)

Example 3 with ActionEvent

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

the class ChartSourceSelectPanel method createRightPanel.

private void createRightPanel() {
    if (qualifierView == null)
        return;
    Qualifier qualifier = qualifierView.getSelectedQualifier();
    boolean b = qualifier != null;
    if (b) {
        framework.setOpenDynamikViewEvent(new ActionEvent(QualifierPlugin.OPEN_QUALIFIER, qualifier));
        QualifierSource qualifierSource = null;
        for (QualifierSource s : chartSource.getQualifierSources()) {
            if (s.getQualifier().equals(qualifier)) {
                qualifierSource = s;
                break;
            }
        }
        if (qualifierSource == null) {
            qualifierSource = chartSource.createQualifierSource();
            qualifierSource.setQualifier(qualifier);
            chartSource.getQualifierSources().add(qualifierSource);
        }
        qualifierSelectPanel = new QualifierSourceSelectPanel(framework, qualifier, qualifierSource, (sourceType.getSelectedItem().equals(sourceTypeElements)) ? SelectType.CHECK : SelectType.RADIO);
        int dl = pane.getDividerLocation();
        pane.setRightComponent(qualifierSelectPanel);
        pane.revalidate();
        pane.repaint();
        pane.setDividerLocation(dl);
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) Qualifier(com.ramussoft.common.Qualifier)

Example 4 with ActionEvent

use of com.ramussoft.gui.common.event.ActionEvent 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 5 with ActionEvent

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

the class GUIFramework method propertyChanged.

public void propertyChanged(String key, final Object value, Object metadata) {
    ActionEvent event = new ActionEvent(key, value, metadata);
    put(key, event);
    for (ActionListener listener : getActionListeners()) {
        listener.onAction(event);
    }
    EventListenerList list = keyListeners.get(key);
    if (list != null) {
        for (ActionListener listener : list.getListeners(ActionListener.class)) {
            listener.onAction(event);
        }
    }
    View activeView = getActiveView();
    if (activeView != null)
        for (String a : activeView.getGlobalActions()) {
            if (a.equals(key)) {
                activeView.onAction(event);
            }
        }
}
Also used : ActionListener(com.ramussoft.gui.common.event.ActionListener) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) EventListenerList(javax.swing.event.EventListenerList)

Aggregations

ActionEvent (com.ramussoft.gui.common.event.ActionEvent)17 ActionListener (com.ramussoft.gui.common.event.ActionListener)11 TabbedEvent (com.ramussoft.gui.common.event.TabbedEvent)6 TabView (com.ramussoft.gui.common.TabView)3 ViewTitleEvent (com.ramussoft.gui.common.event.ViewTitleEvent)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Element (com.ramussoft.common.Element)2 Qualifier (com.ramussoft.common.Qualifier)2 ElementAdapter (com.ramussoft.common.event.ElementAdapter)2 ElementEvent (com.ramussoft.common.event.ElementEvent)2 QualifierAdapter (com.ramussoft.common.event.QualifierAdapter)2 QualifierEvent (com.ramussoft.common.event.QualifierEvent)2 StartUserTransactionCommand (com.ramussoft.common.journal.command.StartUserTransactionCommand)2 Row (com.ramussoft.database.common.Row)2 TabbedView (com.ramussoft.gui.common.TabbedView)2 UniqueView (com.ramussoft.gui.common.UniqueView)2 View (com.ramussoft.gui.common.View)2 CloseMainFrameAdapter (com.ramussoft.gui.common.event.CloseMainFrameAdapter)2