use of com.ramussoft.gui.common.UniqueView in project ramus by Vitaliy-Yakovchuk.
the class Control method commitUniqueViews.
public void commitUniqueViews() {
for (UniqueDFrame dFrame : uniqueFrames) {
UniqueView view = (UniqueView) dFrame.getView();
List<String> wks = getDefaultWorkspaces(view.getDefaultWorkspace());
for (String layout : wks) {
if (layouts.indexOf(layout) < 0)
layouts.add(layout);
UniqueViewsHolder holder = getHolder(layout);
if (BorderLayout.EAST.equals(view.getDefaultPosition()))
holder.rights.add(dFrame);
else if (BorderLayout.SOUTH.equals(view.getDefaultPosition()))
holder.bottoms.add(dFrame);
else if (BorderLayout.NORTH.equals(view.getDefaultPosition()))
holder.tops.add(dFrame);
else
holder.lefts.add(dFrame);
if (wks.size() > 1)
holder.toRemove.add(dFrame);
}
}
for (String layout : layouts) {
getHolder(layout).createComponents();
}
}
use of com.ramussoft.gui.common.UniqueView 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.UniqueView in project ramus by Vitaliy-Yakovchuk.
the class ShowViewPlugin method getActionDescriptors.
@Override
public ActionDescriptor[] getActionDescriptors() {
ActionDescriptor[] descriptors = new ActionDescriptor[views.size()];
for (int i = 0; i < descriptors.length; i++) {
final UniqueView view = views.get(i);
ActionDescriptor descriptor = new ActionDescriptor();
descriptors[i] = descriptor;
Action action = new AbstractAction() {
/**
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
framework.propertyChanged(com.ramussoft.gui.common.event.ActionEvent.OPEN_STATIC_VIEW, view.getId());
}
};
action.putValue(Action.ACTION_COMMAND_KEY, factory.findPluginForViewId(view.getId()).getString(view.getId()));
descriptor.setAction(action);
descriptor.setMenu("Windows/ShowView");
}
return descriptors;
}
use of com.ramussoft.gui.common.UniqueView 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);
}
use of com.ramussoft.gui.common.UniqueView in project ramus by Vitaliy-Yakovchuk.
the class GUIPluginFactory method openView.
protected boolean openView(ActionEvent actionEvent) {
for (UniqueView view : uniqueViews) {
if (actionEvent.equals(view.getOpenAction())) {
DefaultSingleCDockable dockable = findUniqueDockable(view.getId());
dockable.setVisible(true);
dockable.intern().getController().setFocusedDockable(dockable.intern(), false);
return true;
}
}
Enumeration<TabView> enumeration = tabDockables.keys();
while (enumeration.hasMoreElements()) {
TabView view = enumeration.nextElement();
if (actionEvent.equals(view.getOpenAction())) {
TabDockable dockable = tabDockables.get(view);
dockable.intern().getController().setFocusedDockable(dockable.intern(), false);
return true;
}
}
return false;
}
Aggregations