3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>qooxdoo » Demo</title>
5 <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
7 <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
9 <script type="text/javascript" src="../../script/qx.js"></script>
12 <script type="text/javascript" src="../../script/layout.js"></script>
14 <div id="demoDescription">
15 <p>qx.ui.basic.Atom is the parent class for buttons, menu entries, icons, checkboxes. While you can do,
16 you usually don't have to instantiate qx.ui.basic.Atom directly.</p>
19 <script type="text/javascript">
20 qx.lang.Array.merge = function(firstArray, secondArray)
22 var combinedArray = [], currentValue, indexInSecond;
24 for (var i=0, l=firstArray.length; i<l; i++) {
25 (indexInSecond = secondArray.indexOf(currentValue = firstArray[i])) == -1 ? combinedArray.push(currentValue) : qx.lang.Array.append(combinedArray, secondArray.splice(0, indexInSecond+1));
28 return combinedArray.concat(secondArray);
31 var a = [ "before3Mnu", "fileMnu", "editMnu", "saveMnu", "exitMenu" ];
32 var b = [ "before1Mnu", "before2Mnu", "fileMnu", "fooMnu", "editMnu", "saveMnu", "after1Mnu" ];
34 //alert(qx.lang.Array.merge(a, b));
42 groups : [ "mainMp", "helpMp" ]
47 groups : [ "openTb", "editTb" ]
54 "mainMp" : { commands : [ "fileBtn", "editBtn", "viewBtn" ] },
55 "helpMp" : { commands : [ "helpBtn" ] },
58 "openTb" : { commands : [ "openBtn", "openRecentlyBtn" ] },
59 "editTb" : { commands : [ "cutBtn", "copyBtn", "pasteBtn" ] },
62 "openMn" : { commands : [ "openBtn", "openWithBtn", "openRecentlyBtn" ] },
63 "saveMn" : { commands : [ "saveBtn", "saveAsBtn" ] },
64 "closeMn" : { commands : [ "closeBtn" ] },
65 "exitMn" : { commands : [ "exitBtn" ] },
66 "undoMn" : { commands : [ "undoBtn", "redoBtn" ] },
67 "editMn" : { commands : [ "cutBtn", "copyBtn", "pasteBtn", "deleteBtn", "clipboardBtn" ] },
68 "searchMn" : { commands : [ "searchBtn", "replaceBtn", "continueSearchBtn" ] },
70 "barsMn" : { commands : [] },
71 "fontMn" : { commands : [] },
73 "aboutMn" : { commands : [ "aboutBtn" ] },
74 "recentDocsMn" : { commands : [ "doc1Btn", "doc2Btn", "doc3Btn" ] }
79 "fileMnu" : { groups : [ "openMn", "saveMn", "closeMn", "exitMn" ] },
80 "editMnu" : { groups : [ "undoMn", "editMn", "searchMn" ] },
81 "viewMnu" : { groups : [ "barsMn", "fontMn" ] },
82 "helpMnu" : { groups : [ "aboutMn" ] },
83 "openRecentlyMnu" : { groups : [ "recentDocsMn" ] }
89 "fileBtn" : { title : "Datei", menu : "fileMnu" },
90 "editBtn" : { title : "Bearbeiten", menu : "editMnu" },
91 "viewBtn" : { title : "Ansicht", menu : "viewMnu" },
92 "helpBtn" : { title : "Hilfe", menu : "helpMnu" },
94 // Execute-Buttons: Open
95 "openBtn" : { title : "Öffnen", execute : "open" },
96 "openWithBtn" : { title : "Öffnen mit...", execute : "openWith" },
97 "openRecentlyBtn" : { title : "Letzte öffnen...", menu : "openRecentlyMnu" },
99 "saveBtn" : { title : "Speichern", execute : "save" },
100 "saveAsBtn" : { title : "Speichern als...", execute : "saveAs" },
101 "closeBtn" : { title : "Schließen", execute : "close" },
102 "exitBtn" : { title : "Beenden", execute : "exit" },
104 "undoBtn" : { title : "Rückgängig", execute : "undo" },
105 "redoBtn" : { title : "Wiederherstellen", execute : "redo" },
106 "deleteBtn" : { title : "Löschen", execute : "delete" },
107 "clipboardBtn" : { title : "Zwischenablage", execute : "clipboard" },
109 // Execute-Buttons: Search
110 "searchBtn" : { title : "Suchen", execute : "search" },
111 "replaceBtn" : { title : "Ersetzen", execute : "replace" },
112 "continueSearchBtn" : { title : "Weitersuchen", execute : "continuesearch" },
114 // Execute-Buttons: Edit
115 "cutBtn" : { title : "Ausschneiden", execute : "cut" },
116 "copyBtn" : { title : "Kopieren", execute : "copy" },
117 "pasteBtn" : { title : "Einfügen", execute : "paste" },
119 // Execute-Buttons: Info
120 "aboutBtn" : { title : "Über", execute : "about" },
122 "doc1Btn" : { title : "Dokument 1", execute : "openDoc1" },
123 "doc2Btn" : { title : "Dokument 2", execute : "openDoc2" },
124 "doc3Btn" : { title : "Dokument 3", execute : "openDoc3" }
137 qx.OO.defineClass("qx.Generator", qx.core.Target,
144 qx.Proto._generateMenu = function(id)
146 var menu = new qx.ui.menu.Menu;
148 var menuData = this._comp.menus[id];
151 alert("Missing menu: " + id);
154 for (var i=0; i<menuData.groups.length; i++)
156 var groupcontent = this._comp.groups[menuData.groups[i]];
159 alert("Missing menu: " + menuData.groups[i]);
162 var groupcommandlist = groupcontent.commands;
164 for (var j=0; j<groupcommandlist.length; j++)
166 var commandData = this._comp.commands[groupcommandlist[j]];
169 alert("Missing command: " + groupcommandlist[j]);
172 if (commandData.menu)
174 var subMenu = this._generateMenu(commandData.menu);
175 var menuButton = new qx.ui.menu.MenuButton(commandData.title, null, null, subMenu);
177 subMenu.addToDocument();
181 var menuButton = new qx.ui.menu.MenuButton(commandData.title);
184 menu.add(menuButton);
187 if (i < menuData.groups.length-1) {
188 menu.add(new qx.ui.menu.MenuSeparator);
195 qx.Proto.getWidget = function()
197 var can = new qx.ui.layout.CanvasLayout;
199 can.setLocation(100, 100);
200 can.setBorder("2px solid red");
202 for (var i=0; i<this._comp.bars.length; i++)
204 var tb = new qx.ui.toolbar.ToolBar;
205 tb.setLocation(0, (i * 50));
211 var bardata = this._comp.bars[i];
212 var groupdata = bardata.groups;
214 for(var j=0; j<groupdata.length; j++)
216 var part = new qx.ui.toolbar.ToolBarPart;
218 var groupcontent = this._comp.groups[groupdata[j]];
219 var groupcommandlist = groupcontent.commands;
221 if (!groupcommandlist)
223 alert("Missing commands in: " + groupcontent);
226 for (var k=0; k<groupcommandlist.length; k++)
228 var commanddata = this._comp.commands[groupcommandlist[k]];
232 if (typeof commanddata.menu != qx.constant.Type.UNDEFINED)
234 menu = this._generateMenu(commanddata.menu);
235 menu.addToDocument();
237 btn = new qx.ui.toolbar.ToolBarMenuButton(commanddata.title, menu);
241 btn = new qx.ui.toolbar.ToolBarButton(commanddata.title);
248 alert("Missing: " + groupcommandlist[k]);
259 qx.core.Init.getInstance().defineMain(function()
261 var c1 = new qx.Generator(comp1);
262 qx.ui.core.ClientDocument.getInstance().add(c1.getWidget());