Skip to content

Instantly share code, notes, and snippets.

@shimondoodkin
Last active January 21, 2017 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shimondoodkin/5842880 to your computer and use it in GitHub Desktop.
Save shimondoodkin/5842880 to your computer and use it in GitHub Desktop.
qooxdoo desktop taskbar class. modify qx.Class.define("charts.Taskbar", ... to your choice of class prefix
//TASKBAR CLASS
/**
* This class provides some well known operating system like taskbar
* behaviours. To every added window a toggle button is attached, that
* can switch the window between maximized and minimized state.
*
* *Example*
*
* Here is a little example of how to use the widget.
*
* <pre class='javascript'>
* var win = new qx.ui.window.Window("A window");
* var taskbar = new addressbook.widgets.Taskbar();
* taskbar.attachWindow(win);
* </pre>
*
* *Full Example*
*
* <pre class='javascript'>
* this.__desktop_with_taskbar = new qx.ui.container.Composite(new qx.ui.layout.VBox());
*
* this.__windowManager = new qx.ui.window.Manager();
* this.__desktop = new qx.ui.window.Desktop(this.__windowManager);
*
* this.__desktop_with_scroll =new qx.ui.container.Scroll()
* this.__desktop_with_scroll.add(this.__desktop);
* this.__desktop_taskbar = new charts.Taskbar();
*
* this.__desktop_with_taskbar.add(this.__desktop_with_scroll, {flex : 1});
* this.__desktop_with_taskbar.add(this.__desktop_taskbar, {flex : 0});
*
*
* var win = new qx.ui.window.Window("First Window", "icon/16/apps/office-calendar.png");
* win.setShowStatusbar(true);
* win.setStatus("Demo loaded");
* win.open()
*
* this.__desktop.add(win, {left:20, top:20});
* this.__desktop_taskbar.attachWindow(win);
*
* this.getRoot().add(this.__desktop_with_taskbar,{edge:0});
* </pre>
*
*/
qx.Class.define("charts.Taskbar",
{
extend : qx.ui.core.Widget,
construct : function()
{
this.base(arguments);
//the menu to which all the windows are added
var taskbar = new qx.ui.toolbar.ToolBar();
this.setHeight(26);
taskbar.setSpacing(0);
//TODO stop the bar from stretching if too many windows are added
this._setLayout(new qx.ui.layout.VBox());
this._add(taskbar);
this.__taskbar = taskbar;
},
properties :
{
},
members : {
__taskbar : null,
/**
* Every window that is added gets an associated taskbar button which can toggle
* it between minimized and maximized.
*/
attachWindow : function(window) {
var button = this.__newTaskbarItem(window);
window.addListener("close", this.__close, this);
this.__taskbar.add(button);
// if(window.isActive()) button.setValue(true);
},
/**
* Listens to added windows and removes their taskbar button if they are closed.
*/
__close : function(e) {
var button = e.getTarget().getUserData("taskbarButton");
if(button !==null){
button.destroy();
}
},
/**
* Switches the window between shown and hidden
*/
__toggleMinMax : function(e){
// console.log(e,"Checked: " + e.getData());
//e.preventDefault(); //why prevent default???
var button = e.getTarget();
var window = button.getUserData("window");
//this.debug("value: " + button.get("value"));
//this.debug(window);
//console.log(Math.random(),"1button.getValue:",button.getValue(),'window.isVisible:',window.isVisible(),'window.isActive:',window.isActive(),button);
if( window.isActive() && window.isVisible() ) window.minimize();
else if( !window.isVisible() ) window.restore();
//console.log(Math.random(),"2button.getValue:",button.getValue(),'window.isVisible:',window.isVisible(),'window.isActive:',window.isActive(),button);
},
/**
* Creates a taskbar button that represents the given window.
*/
__newTaskbarItem : function(window){
var button = new qx.ui.form.ToggleButton(window.get("caption"), window.get("icon"));
if(!this.isbb)this.isbb=0;
if(this.isbb==0)bb1=button;
if(this.isbb==1)bb2=button;
this.isbb++;
//button.setAppearance("button");
//attach the window to this button, so it can be shown again if the button is clicked
button.setUserData("window", window);
//attach the button to the window, so it can be removed, if thewindow is closed
window.setUserData("taskbarButton", button);
//bidirectional bind of active to value
window.bind("active", button, "value");
button.bind("value", window, "active");
window.bind("caption", button, "label");
window.bind("icon", button, "icon");
//if the button is clicked switch the state of the window and the button
button.addListener("mousedown", this.__toggleMinMax, this);
//button.addListener("press", this.__toggleMinMax, this);
return button;
}
}
});
//example
/* ************************************************************************
Copyright:
License:
Authors:
************************************************************************ */
/* ************************************************************************
#asset(charts/*)
************************************************************************ */
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Fabian Jakobs (fjakobs)
************************************************************************ */
/**
* This is the main application class of your custom application "charts"
*/
qx.Class.define("charts.Application",
{
extend : qx.application.Standalone,
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members :
{
/**
* This method contains the initial application code and gets called
* during startup of the application
*
* @lint ignoreDeprecated(alert)
*/
createWindow1 : function()
{
// Create the Window
var win = new qx.ui.window.Window("First Window", "icon/16/apps/office-calendar.png");
win.setLayout(new qx.ui.layout.VBox(10));
win.setShowStatusbar(true);
win.setStatus("Demo loaded");
win.open();
// Test for move listener
win.addListener("move", function(e) {
this.debug("Moved to: " + e.getData().left + "x" + e.getData().top);
}, this);
// Test for resize listener
win.addListener("resize", function(e) {
this.debug("Resized to: " + e.getData().width + "x" + e.getData().height);
}, this);
// Add an Atom
var atom = new qx.ui.basic.Atom("Welcome to your first own Window.<br/>Have fun!", "icon/16/apps/office-calendar.png");
atom.setRich(true);
win.add(atom);
// Add a TabView
var tabView = new qx.ui.tabview.TabView;
win.add(tabView, {flex:1});
var page1 = new qx.ui.tabview.Page("Page 1");
tabView.add(page1);
var b
//page1.add(b=new qx.ui.form.Button("Child Widget 4"));
page1.addListener("click", function(e) {
win.setCaption('isntrument long long longer');
}, this);
var page2 = new qx.ui.tabview.Page("Page 2");
tabView.add(page2);
var page3 = new qx.ui.tabview.Page("Page 3");
tabView.add(page3);
return win;
},
main : function()
{
// Call super class
this.base(arguments);
// Enable logging in debug variant
if (qx.core.Environment.get("qx.debug"))
{
// support native logging capabilities, e.g. Firebug for Firefox
qx.log.appender.Native;
// support additional cross-browser console. Press F7 to toggle visibility
qx.log.appender.Console;
}
/*
-------------------------------------------------------------------------
Below is your actual application code...
-------------------------------------------------------------------------
*/
/*
// Load current locale part
var currentLanguage = qx.locale.Manager.getInstance().getLanguage();
var knownParts = qx.Part.getInstance().getParts();
// if the locale is available as part
if (knownParts[currentLanguage]) {
// load this part
qx.io.PartLoader.require([currentLanguage], function() {
// forcing identical locale
qx.locale.Manager.getInstance().setLocale(currentLanguage);
// build the GUI after the initial locals has been loaded
this.buildUpGui();
}, this);
} else {
// if we cant find the default locale, print a warning and load the gui
this.warn(
"Cannot load locale part for current language " +
currentLanguage + ", falling back to English."
);
this.buildUpGui();
}
*/
///////
// main container
var mainContainer = new qx.ui.container.Composite( new qx.ui.layout.Dock());
this.getRoot().add(mainContainer,{edge:0});
// Create toolbar
this.__toolBarView = new qx.ui.toolbar.ToolBar(this);
var button4=new qx.ui.form.Button("Add Test Child Window");
this.__toolBarView.add(button4);
var www=0;
var that=this;
// Add an event listener
button4.addListener("execute", function(e) {
var win=that.createWindow1();
win.setCaption('Test '+(www++));
that.__desktop.add(win, {left:20+(www*20), top:20+(www*20)});
that.__desktop_taskbar.attachWindow(win);
});
mainContainer.add(this.__toolBarView, {edge: "north"});
// Create a horizontal split pane
this.__pane = new qx.ui.splitpane.Pane("horizontal");//.set({ width : 450,height : 300 });
// Create container with fixed dimensions for the left:
this.__container1 = new qx.ui.container.Composite(new qx.ui.layout.Grow()).set({
width : 200,
height: 100//,
// decorator : "main"
});
this.__container2 = new qx.ui.container.Composite(new qx.ui.layout.VBox());
this.__windowManager = new qx.ui.window.Manager();
this.__desktop = new qx.ui.window.Desktop(this.__windowManager);
//this.__container2 = new qx.ui.window.Desktop(this.__windowManager);
this.__desktop_with_scroll =new qx.ui.container.Scroll()
this.__desktop_with_scroll.add(this.__desktop);
this.__desktop_taskbar = new charts.Taskbar();
this.__container2.add(this.__desktop_with_scroll, {flex : 1});
this.__container2.add(this.__desktop_taskbar, {flex : 0});
//this.__container2 = new charts.ScrollSesktop(this.__windowManager);
//tab_page.add(myScrollContainer, {edge:0})
//this.__container2 = new qx.ui.container.Composite(new qx.ui.layout.Grow)//.set({
// minWidth : 200//,
// height: 100//,
//decorator : "main"
// });
var tree = new qx.ui.tree.Tree().set({ width : 200, height : 300 } );
var root = new qx.ui.tree.TreeFolder("root");
root.setOpen(true);
tree.setHideRoot(true);
tree.setRoot(root);
var te2_3 = new qx.ui.tree.TreeFolder("Group");
for (var i=0; i<30; i++) {
te2_3.add(new qx.ui.tree.TreeFile("Item #" + i));
}
root.add(te2_3);
this.__container1.add(tree);
//charts.ChartWindow
var win=this.createWindow1();
this.__desktop.add(win, {left:20, top:20});
this.__desktop_taskbar.attachWindow(win);
var win2=this.createWindow1();
ww1= win
ww2= win2
this.__desktop.add(win2, {left:200, top:20});
this.__desktop_taskbar.attachWindow(win2);
//this.__container2.add(new qx.ui.form.Button("Child Widget r"));
// Add the first container to the pane. Flex = 0 means that this child should not grow
this.__pane.add(this.__container1, 0);
// Add the second container. Flex = 1 means that this child should consume all available space.
this.__pane.add(this.__container2, 1);
mainContainer.add(this.__pane, {edge: "center"});
//this.setLayout(new qx.ui.layout.vBox());
/*
// Create a button
var button1 = new qx.ui.form.Button("First Button1", "charts/test.png");
// Create a button
var button2 = new qx.ui.form.Button("First Button2", "charts/test.png");
var tree = new qx.ui.tree.Tree().set({ width : 200, height : '300' } );
var root = new qx.ui.tree.TreeFolder("root");
root.setOpen(true);
tree.setHideRoot(true);
tree.setRoot(root);
var te2_3 = new qx.ui.tree.TreeFolder("Trash");
for (var i=0; i<30; i++) {
te2_3.add(new qx.ui.tree.TreeFile("Junk #" + i));
}
root.add(te2_3);
// Document is the application root
var doc = this.getRoot();
var splitpane = new qx.ui.splitpane.Pane("horizontal");
splitpane.setWidth(400);
splitpane.setHeight(60);
splitpane.setDecorator("main");
this.getRoot().add(splitpane, {left:20, top:20});
// Left
var leftWidget = new qx.ui.form.TextArea("Flex:1");
leftWidget.setDecorator(null);
leftWidget.setWrap(true);
splitpane.add(leftWidget, 1);
// Right
var rightWidget = new qx.ui.form.TextArea("Flex:2");
rightWidget.setDecorator(null);
rightWidget.setWrap(true);
splitpane.add(rightWidget, 2);
// y-axis first, auto-sized
var dock = new qx.ui.layout.Dock();
dock.setSort("y");
var widget = (new qx.ui.container.Composite(dock)).set(
{
decorator: "main",
backgroundColor: "yellow",
allowGrowX : false
});
var w1 = new qx.ui.core.Widget().set({decorator: "main", backgroundColor: "red"});
var w2 = new qx.ui.core.Widget().set({decorator: "main", backgroundColor: "blue"});
var w3 = new qx.ui.core.Widget().set({decorator: "main", backgroundColor: "orange"});
var w4 = new qx.ui.core.Widget().set({decorator: "main", backgroundColor: "green"});
var w5 = new qx.ui.core.Widget().set({decorator: "main", backgroundColor: "fuchsia"});
widget.add(w1, {edge:"north"});
widget.add(w2, {edge:"west"});
widget.add(w3, {edge:"south"});
widget.add(w4, {edge:"east"});
widget.add(w5, {edge:"center"});
doc.add(widget);
// Add button to document at fixed coordinates
//doc.add(button1, {left: 5, top: 5});
//doc.add(button2 //, {left: 135, top: 5}
);
doc.add(tree//, {left: 5, top: 60}
);
// Add an event listener
button1.addListener("execute", function(e) {
var win=this.createWindow1();
this.__desktop.add(win, {left:20, top:20});
this.__desktop_taskbar.attachWindow(win);
});
button2.addListener("execute", function(e) {
alert("Hello World2!");
});
*/
}
}
});
/*
http://www.ats.ucla.edu/stat/r/pages/raw_data.htm
http://www.ats.ucla.edu/stat/r/sk/
http://www.dummies.com/how-to/content/how-to-add-calculated-fields-to-data-in-r.html
http://www.ats.ucla.edu/stat/r/seminars/intro.R
https://www.google.com/search?q=quantitative+trading+pdf+download&rlz=1C1CHEU_iwIL440IL440&oq=quantitative+trading+pdf&aqs=chrome.1.57j0l3j62l2.15191j0&sourceid=chrome&ie=UTF-8
ftp://ftp.cs.utexas.edu/pub/techreports/honor_theses/cs-06-14-ignatovich.pdf
http://quantbank.com/vba-code-bank/volatility-and-correlation/
http://www.2shared.com/complete/QO0GInwy/Quantitative_Trading.html
http://www.filecrop.com/83231661/index.html
http://quantbank.com/matlab-code-bank/matlab-books/Quantitative%20Trading.pdf
http://quantbank.com/python/
http://quantbank.com/c-code-bank/simulated/
http://lovendon.tistory.com/
http://www.mediafire.com/download/zajd31ynmak/Chan%2C+Ernest+P.+Quantitative+Trading%3B+How+to+Build+Your+Own+Algorithmic+Trading+Business.pdf
http://quantbank.com/c-code-bank/functions/
http://quantbank.com/c-code-bank/discrete-fast-fourier-transform/
http://quantbank.com/papers/
http://quantbank.com/cnet-code-bank/trading/
http://quantbank.com/cnet-code-bank/functions/
http://quantbank.com/cnet-code-bank/libraries/
$file = 'myfile.php';
$last_modified_time = filemtime($file);
$etag = md5_file($file);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT");
header("Etag: $etag");
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
header("HTTP/1.1 304 Not Modified");
exit;
}
https://www.google.co.il/#safe=off&output=search&sclient=psy-ab&q=qooxdoo+layout&oq=qooxdoo+layout&gs_l=hp.3..0j0i22i30l3.1067171.1080410.0.1080616.14.13.0.1.1.1.504.1361.4-2j1.3.0...0.0.0..1c.1.16.psy-ab.F3EaxN1PIKE&pbx=1&bav=on.2,or.r_cp.r_qf.&bvm=bv.47534661,d.bGE&fp=38047d7bbd62cfd0&biw=1137&bih=596
http://blog.muhuk.com/2009/02/04/using-layouts-in-qooxdoo-part-2-vbox-layout.html#.UbcQPuc0wxI
http://manual.qooxdoo.org/1.6/pages/layout/dock.html?highlight=layout
http://demo.qooxdoo.org/1.6/demobrowser/#layout~Dock.html
http://demo.qooxdoo.org/1.6/demobrowser/#layout~Dock_FlexShrinking.html
http://demo.qooxdoo.org/1.6/demobrowser/#layout~Dock_Separator.html
http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%22var%2520container%2520%253D%2520new%2520qx.ui.container.Composite(new%2520qx.ui.layout.HBox())%253B%250Athis.getRoot().add(container%252C%2520%257Bedge%2520%253A%25201%257D)%253B%250A%250Avar%2520w1%2520%253D%2520new%2520qx.ui.core.Widget()%253B%250Aw1.setMinWidth(250)%253B%250Aw1.setBackgroundColor(%2522green%2522)%253B%250Acontainer.add(w1%252C%2520%257Bflex%2520%253A%25200%257D)%253B%250A%250Avar%2520w2%2520%253D%2520new%2520qx.ui.core.Widget()%253B%250Aw2.setBackgroundColor(%2522red%2522)%253B%250Acontainer.add(w2%252C%2520%257Bflex%2520%253A%25201%257D)%253B%22%2C%20%22mode%22%3A%22ria%22%7D
http://demo.qooxdoo.org/current/playground/#Dialog-ria
http://demo.qooxdoo.org/2.1.1/apiviewer/#qx
view-source:http://demo.qooxdoo.org/current/playground/#Table-ria
http://www.packtpub.com/article/qooxdoo-working-with-layouts
http://212.235.44.178:5000/charts/source/
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment