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);
}
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);
}
Aggregations