implement window menu

This commit is contained in:
servertude
2008-03-08 10:50:44 +00:00
parent e2b768f194
commit e5b63bb385
5 changed files with 70 additions and 4 deletions

View File

@@ -1,10 +1,10 @@
import javax.swing.tree.*;
String who = arg("source");
String who = arg("source");
WindowContext context = argObj("windowContext");
log.debug("Event received: " + who);
log.debug("Event received: " + who);
if ("Connect".equals(who) )
{
@@ -106,6 +106,7 @@ else if ("Help".equals(who))
else if ("Close".equals(who) )
{
Frame window = context.get("/");
script("removeFromWindowMenu", args());
window.dispose();
}
else {

View File

@@ -8,6 +8,7 @@ log.debug("Event received: " + who);
if ("Close".equals(who) )
{
Frame window = context.get("/");
script("removeFromWindowMenu", args());
window.dispose();
}
else if ("Connection".equals(who))

View File

@@ -0,0 +1,42 @@
import java.util.*;
WindowContext context = argObj("windowContext");
HashObject profile = context.get("profile");
String profileName = profile.get("name");
Frame thisFrame = context.get("/");
// dont confuse Context (global context) with the variable context (the window context)
HashObject windowList = Context.get("windowList");
windowList.remove(thisFrame);
//now rebuild all the window menus on all open frames
for (Object o : windowList)
{
Frame f = (Frame)o;
Menu windowMenu = f.get("Window");
windowMenu.removeAll();
for (Object o2 : windowList)
{
windowMenu.item(((String)((Frame)o2).getProperty("windowId")));
}
}

View File

@@ -19,7 +19,7 @@
m.item("separator", "User-Manager", "Maintenance", "separator", "Preferences");
app.menu("&Import").item("Import CSV File", "Load SQL File", "Insert Files into Blob Fields");
app.menu("E&xport").item("Export Tables as SQL","separator", "Copy as CSV Data", "Copy as HTML Data", "Copy as XML Data","Export Data...");
app.menu("&Window").item("Connection 1");
app.menu("&Window").events("windowMenuEvents");
Menu help = app.menu("&Help");
help.events("helpMenuEvents").item("SQL Help", "separator", "Heidi SQL Website", "Downloads", "Support Forums", "Bug Tracker", "Feature Tracker",
"separator", "About");
@@ -121,6 +121,7 @@
args().put("windowContext", context);
script("initDB", args());
script("initTree", args());
script("addToWindowMenu", args());
thread("loadHostInfo", args(), true);

View File

@@ -0,0 +1,21 @@
String who = arg("source");
log.debug("Event received: " + who);
WindowContext context = argObj("windowContext");
HashObject windowList = Context.get("windowList");
Frame f = windowList.getObject(who);
if (f != (Frame)context.get("/"))
{
f.toFront();
}