use of com.ramussoft.gui.common.event.ActionListener in project ramus by Vitaliy-Yakovchuk.
the class ElistView method createComponent.
@Override
public JComponent createComponent() {
framework.addActionListener(FULL_REFRESH, new ActionListener() {
@Override
public void onAction(com.ramussoft.gui.common.event.ActionEvent event) {
component.close();
root.removeAll();
createInnerComponent();
}
});
root = new JPanel(new BorderLayout());
createInnerComponent();
return root;
}
use of com.ramussoft.gui.common.event.ActionListener in project ramus by Vitaliy-Yakovchuk.
the class FilePlugin method setFramework.
@SuppressWarnings("unused")
@Override
public void setFramework(final GUIFramework framework) {
super.setFramework(framework);
framework.addCloseMainFrameListener(new CloseMainFrameAdapter() {
@Override
public boolean close() {
boolean close = closeFrame(framework);
return close;
}
@Override
public void closed() {
plugins.remove(FilePlugin.this);
}
});
setFile(file);
if ((!Metadata.CORPORATE) && (Options.getBoolean(CHECK_FOR_UPDATES, true)) && (isTimeToUpdate())) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(20000);
checkForUpdates();
} catch (Exception e) {
}
}
}, "Update-checker");
thread.setPriority(Thread.MIN_PRIORITY);
thread.start();
}
if (Metadata.DEMO) {
framework.put("FilePlugin", this);
framework.addActionListener("DisableSaveActions", new ActionListener() {
@Override
public void onAction(com.ramussoft.gui.common.event.ActionEvent event) {
saveAction.setEnabled(false);
saveFileAsAction.setEnabled(false);
}
});
framework.addActionListener("EnableSaveActions", new ActionListener() {
@Override
public void onAction(com.ramussoft.gui.common.event.ActionEvent event) {
saveAction.setEnabled(true);
saveFileAsAction.setEnabled(true);
}
});
}
}
use of com.ramussoft.gui.common.event.ActionListener 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);
}
use of com.ramussoft.gui.common.event.ActionListener in project ramus by Vitaliy-Yakovchuk.
the class ShowWorkspacePlugin method setFramework.
@Override
public void setFramework(GUIFramework framework) {
super.setFramework(framework);
framework.addActionListener("ShowWorkspace", new ActionListener() {
@Override
public void onAction(com.ramussoft.gui.common.event.ActionEvent event) {
for (ActionDescriptor action : actions) if (action.getAction() instanceof ShowWorkspaceAction) {
if (((ShowWorkspaceAction) action.getAction()).getWorkspace().equals(event.getValue())) {
action.getAction().actionPerformed(null);
action.getAction().putValue(Action.SELECTED_KEY, Boolean.TRUE);
}
}
}
});
}
use of com.ramussoft.gui.common.event.ActionListener 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);
}
}
}
Aggregations