diff options
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview')
15 files changed, 1279 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractBar.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractBar.js new file mode 100755 index 0000000000..1c10e5680b --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractBar.js @@ -0,0 +1,129 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.AbstractBar", qx.ui.layout.BoxLayout, +function() +{ + qx.ui.layout.BoxLayout.call(this); + + this._manager = new qx.manager.selection.RadioManager; + + this.addEventListener("mousewheel", this._onmousewheel); +}); + + + + +/* +--------------------------------------------------------------------------- + UTILITY +--------------------------------------------------------------------------- +*/ + +qx.Proto.getManager = function() { + return this._manager; +} + + + + + +/* +--------------------------------------------------------------------------- + EVENTS +--------------------------------------------------------------------------- +*/ + +qx.Proto._lastDate = (new Date(0)).valueOf(); + +qx.Proto._onmousewheel = function(e) +{ + // Make it a bit lazier than it could be + // Hopefully this is a better behaviour for fast scrolling users + var vDate = (new Date).valueOf(); + + if ((vDate - 50) < this._lastDate) { + return; + } + + this._lastDate = vDate; + + var vManager = this.getManager(); + var vItems = vManager.getItems(); + var vPos = vItems.indexOf(vManager.getSelected()); + + if (this.getWheelDelta(e) > 0) + { + var vNext = vItems[vPos+1]; + + if (!vNext) { + vNext = vItems[0]; + } + } + else if (vPos > 0) + { + var vNext = vItems[vPos-1]; + + if (!vNext) { + vNext = vItems[0]; + } + } + else + { + vNext = vItems[vItems.length-1]; + } + + vManager.setSelected(vNext); +} + +qx.Proto.getWheelDelta = function(e) { + return e.getWheelDelta(); +} + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + if (this._manager) + { + this._manager.dispose(); + this._manager = null; + } + + this.removeEventListener("mousewheel", this._onmousewheel); + + return qx.ui.layout.BoxLayout.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractButton.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractButton.js new file mode 100755 index 0000000000..da590a286d --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractButton.js @@ -0,0 +1,219 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + + ************************************************************************ */ + +/* ************************************************************************ + + + ************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.AbstractButton", qx.ui.basic.Atom, +function(vText, vIcon, vIconWidth, vIconHeight, vFlash) { + qx.ui.basic.Atom.call(this, vText, vIcon, vIconWidth, vIconHeight, vFlash); + + this.setTabIndex(1); + + // ************************************************************************ + // MOUSE EVENTS + // ************************************************************************ + this.addEventListener("mouseover", this._onmouseover); + this.addEventListener("mouseout", this._onmouseout); + this.addEventListener("mousedown", this._onmousedown); + + // ************************************************************************ + // KEY EVENTS + // ************************************************************************ + this.addEventListener("keydown", this._onkeydown); + this.addEventListener("keypress", this._onkeypress); +}); + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- + */ + +/*! + If this tab is the currently selected/active one + */ +qx.OO.addProperty({ name : "checked", type : "boolean", defaultValue : false }); + +/*! + The attached page of this tab + */ +qx.OO.addProperty({ name : "page", type : "object" }); + +/*! + The assigned qx.manager.selection.RadioManager which handles the switching between registered buttons + */ +qx.OO.addProperty({ name : "manager", type : "object", instance : "qx.manager.selection.RadioManager", allowNull : true }); + +/*! + The name of the radio group. All the radio elements in a group (registered by the same manager) + have the same name (and could have a different value). + */ +qx.OO.addProperty({ name : "name", type : "string" }); + + + + +/* +--------------------------------------------------------------------------- + UTILITIES +--------------------------------------------------------------------------- + */ + +qx.Proto.getView = function() { + return this.getParent().getParent(); +} + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- + */ + +qx.Proto._modifyManager = function(propValue, propOldValue, propData) { + if (propOldValue) { + propOldValue.remove(this); + } + + if (propValue) { + propValue.add(this); + } + + return true; +} + +qx.Proto._modifyParent = function(propValue, propOldValue, propData) { + if (propOldValue) { + propOldValue.getManager().remove(this); + } + + if (propValue) { + propValue.getManager().add(this); + } + + return qx.ui.basic.Atom.prototype._modifyParent.call(this, propValue, propOldValue, propData); +} + +qx.Proto._modifyPage = function(propValue, propOldValue, propData) { + if (propOldValue) { + propOldValue.setButton(null); + } + + if (propValue) { + propValue.setButton(this); + this.getChecked() ? propValue.show() : propValue.hide(); + } + + return true; +} + +qx.Proto._modifyChecked = function(propValue, propOldValue, propData) { + if (this._hasParent) { + var vManager = this.getManager(); + if (vManager) { + vManager.handleItemChecked(this, propValue); + } + } + + propValue ? this.addState("checked") : this.removeState("checked"); + + var vPage = this.getPage(); + if (vPage) { + this.getChecked() ? vPage.show() : vPage.hide(); + } + + return true; +} + +qx.Proto._modifyName = function(propValue, propOldValue, propData) { + if (this.getManager()) { + this.getManager().setName(propValue); + } + + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- + */ + +qx.Proto._onmousedown = function(e) { + this.setChecked(true); +} + +qx.Proto._onmouseover = function(e) { + this.addState("over"); +} + +qx.Proto._onmouseout = function(e) { + this.removeState("over"); +} + +qx.Proto._onkeydown = function(e) {} +qx.Proto._onkeypress = function(e) {} + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- + */ + +qx.Proto.dispose = function() { + if (this.getDisposed()) { + return; + } + + + // ************************************************************************ + // MOUSE EVENTS + // ************************************************************************ + this.removeEventListener("mouseover", this._onmouseover); + this.removeEventListener("mouseout", this._onmouseout); + this.removeEventListener("mousedown", this._onmousedown); + + + // ************************************************************************ + // KEY EVENTS + // ************************************************************************ + this.removeEventListener("keydown", this._onkeydown); + this.removeEventListener("keypress", this._onkeypress); + + + return qx.ui.basic.Atom.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPage.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPage.js new file mode 100755 index 0000000000..3eed9d20b4 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPage.js @@ -0,0 +1,75 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.AbstractPage", qx.ui.layout.CanvasLayout, +function(vButton) +{ + qx.ui.layout.CanvasLayout.call(this); + + if (qx.util.Validation.isValid(vButton)) { + this.setButton(vButton); + } +}); + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + The attached tab of this page. +*/ +qx.OO.addProperty({ name : "button", type : "object" }); + +/*! + Make element displayed (if switched to true the widget will be created, if needed, too). + Instead of qx.ui.core.Widget, the default is false here. +*/ +qx.OO.changeProperty({ name : "display", type : "boolean", defaultValue : false }); + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyButton = function(propValue, propOldValue, propData) +{ + if (propOldValue) { + propOldValue.setPage(null); + } + + if (propValue) { + propValue.setPage(this); + } + + return true; +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPageView.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPageView.js new file mode 100755 index 0000000000..786bc88145 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPageView.js @@ -0,0 +1,84 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.AbstractPageView", qx.ui.layout.BoxLayout, +function(vBarClass, vPaneClass) +{ + qx.ui.layout.BoxLayout.call(this); + + this._bar = new vBarClass; + this._pane = new vPaneClass; + + this.add(this._bar, this._pane); + this.setOrientation("vertical"); +}); + + + + + +/* +--------------------------------------------------------------------------- + UTILITY +--------------------------------------------------------------------------- +*/ + +qx.Proto.getPane = function() { + return this._pane; +} + +qx.Proto.getBar = function() { + return this._bar; +} + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return true; + } + + if (this._bar) + { + this._bar.dispose(); + this._bar = null; + } + + if (this._pane) + { + this._pane.dispose(); + this._pane = null; + } + + return qx.ui.layout.BoxLayout.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPane.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPane.js new file mode 100755 index 0000000000..a026e0401e --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/AbstractPane.js @@ -0,0 +1,27 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.AbstractPane", qx.ui.layout.CanvasLayout, +function() { + qx.ui.layout.CanvasLayout.call(this); +}); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Bar.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Bar.js new file mode 100644 index 0000000000..43ed8c1f85 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Bar.js @@ -0,0 +1,75 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_buttonview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.buttonview.Bar", qx.ui.pageview.AbstractBar, +function() { + qx.ui.pageview.AbstractBar.call(this); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "bar-view-bar" }); + + + + +/* +--------------------------------------------------------------------------- + EVENTS +--------------------------------------------------------------------------- +*/ + +qx.Proto.getWheelDelta = function(e) +{ + var vWheelDelta = e.getWheelDelta(); + + switch(this.getParent().getBarPosition()) + { + case "left": + case "right": + vWheelDelta *= -1; + } + + return vWheelDelta; +} + + + + + +/* +--------------------------------------------------------------------------- + APPEARANCE ADDITIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyStateAppearance = function() +{ + var vPos = this.getParent().getBarPosition(); + + this._states.barLeft = vPos === "left"; + this._states.barRight = vPos === "right"; + this._states.barTop = vPos === "top"; + this._states.barBottom = vPos === "bottom"; + + qx.ui.pageview.AbstractButton.prototype._applyStateAppearance.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Button.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Button.js new file mode 100644 index 0000000000..2ea00867a9 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Button.js @@ -0,0 +1,120 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_buttonview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.buttonview.Button", qx.ui.pageview.AbstractButton, +function(vText, vIcon, vIconWidth, vIconHeight, vFlash) { + qx.ui.pageview.AbstractButton.call(this, vText, vIcon, vIconWidth, vIconHeight, vFlash); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "bar-view-button" }); + + + + + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- +*/ + +qx.Proto._onkeypress = function(e) +{ + switch(this.getView().getBarPosition()) + { + case "top": + case "bottom": + switch(e.getKeyIdentifier()) + { + case "Left": + var vPrevious = true; + break; + + case "Right": + var vPrevious = false; + break; + + default: + return; + } + + break; + + case "left": + case "right": + switch(e.getKeyIdentifier()) + { + case "Up": + var vPrevious = true; + break; + + case "Down": + var vPrevious = false; + break; + + default: + return; + } + + break; + + default: + return; + } + + var vChild = vPrevious ? this.isFirstChild() ? this.getParent().getLastChild() : this.getPreviousSibling() : this.isLastChild() ? this.getParent().getFirstChild() : this.getNextSibling(); + + // focus next/previous button + vChild.setFocused(true); + + // and naturally also check it + vChild.setChecked(true); +} + + + + + + + + + +/* +--------------------------------------------------------------------------- + APPEARANCE ADDITIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyStateAppearance = function() +{ + var vPos = this.getView().getBarPosition(); + + this._states.barLeft = vPos === "left"; + this._states.barRight = vPos === "right"; + this._states.barTop = vPos === "top"; + this._states.barBottom = vPos === "bottom"; + + qx.ui.pageview.AbstractButton.prototype._applyStateAppearance.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/ButtonView.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/ButtonView.js new file mode 100644 index 0000000000..7521b67683 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/ButtonView.js @@ -0,0 +1,98 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_buttonview) + +************************************************************************ */ + +/*! + One of the widgets which could be used to structurize the interface. + + qx.ui.pageview.buttonview.ButtonView creates the typical apple-like tabview-replacements which could also + be found in more modern versions of the settings dialog in Mozilla Firefox. +*/ +qx.OO.defineClass("qx.ui.pageview.buttonview.ButtonView", qx.ui.pageview.AbstractPageView, +function() +{ + qx.ui.pageview.AbstractPageView.call(this, qx.ui.pageview.buttonview.Bar, qx.ui.pageview.buttonview.Pane); + + this.setOrientation("vertical"); +}); + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.addProperty({ name : "barPosition", type : "string", defaultValue : "top", possibleValues : [ "top", "right", "bottom", "left" ] }); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "bar-view" }); + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyBarPosition = function(propValue, propOldValue, propData) +{ + var vBar = this._bar; + + // move bar around and change orientation + switch(propValue) + { + case "top": + vBar.moveSelfToBegin(); + this.setOrientation("vertical"); + break; + + case "bottom": + vBar.moveSelfToEnd(); + this.setOrientation("vertical"); + break; + + case "left": + vBar.moveSelfToBegin(); + this.setOrientation("horizontal"); + break; + + case "right": + vBar.moveSelfToEnd(); + this.setOrientation("horizontal"); + break; + } + + // force re-apply of states for bar and pane + this._addChildrenToStateQueue(); + + // force re-apply of states for all tabs + vBar._addChildrenToStateQueue(); + + return true; +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Page.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Page.js new file mode 100644 index 0000000000..d5d4b15d4f --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Page.js @@ -0,0 +1,30 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_buttonview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.buttonview.Page", qx.ui.pageview.AbstractPage, +function(vButton) { + qx.ui.pageview.AbstractPage.call(this, vButton); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "bar-view-page" }); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Pane.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Pane.js new file mode 100644 index 0000000000..6f8aabebc4 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/buttonview/Pane.js @@ -0,0 +1,51 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_buttonview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.buttonview.Pane", qx.ui.pageview.AbstractPane, +function() { + qx.ui.pageview.AbstractPane.call(this); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "bar-view-pane" }); + + + + + + + +/* +--------------------------------------------------------------------------- + APPEARANCE ADDITIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyStateAppearance = function() +{ + var vPos = this.getParent().getBarPosition(); + + this._states.barHorizontal = vPos === "top" || vPos === "bottom"; + + qx.ui.pageview.AbstractButton.prototype._applyStateAppearance.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Bar.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Bar.js new file mode 100644 index 0000000000..22f429dd96 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Bar.js @@ -0,0 +1,33 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_tabview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.tabview.Bar", qx.ui.pageview.AbstractBar, +function() +{ + qx.ui.pageview.AbstractBar.call(this); + + this.setZIndex(2); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "tab-view-bar" }); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Button.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Button.js new file mode 100644 index 0000000000..9566bb2a51 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Button.js @@ -0,0 +1,189 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_tabview) + +************************************************************************ */ + +/** + * @event closetab {qx.event.type.DataEvent} + */ +qx.OO.defineClass("qx.ui.pageview.tabview.Button", qx.ui.pageview.AbstractButton, +function(vText, vIcon, vIconWidth, vIconHeight, vFlash) { + qx.ui.pageview.AbstractButton.call(this, vText, vIcon, vIconWidth, vIconHeight, vFlash); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "tab-view-button" }); + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- + */ + +/*! + default Close Tab Button + */ +qx.OO.addProperty({ name : "showCloseButton", type : "boolean", defaultValue : false }); + +/*! + Close Tab Icon + */ +qx.OO.addProperty({ name : "closeButtonImage", type : "string", defaultValue : "icon/16/cancel.png"}); + + + + + + + +/* +--------------------------------------------------------------------------- + EVENT HANDLER +--------------------------------------------------------------------------- +*/ + +qx.Proto._onkeydown = function(e) +{ + var identifier = e.getKeyIdentifier(); + if (identifier == "Enter" || identifier == "Space") { + // there is no toggeling, just make it checked + this.setChecked(true); + } +}; + + +qx.Proto._onkeypress = function(e) +{ + switch(e.getKeyIdentifier()) + { + case "Left": + var vPrev = this.getPreviousSibling() || this.getParent().getLastChild(); + if (vPrev && vPrev != this) + { + // we want to enable the outline border, because + // the user used the keyboard for activation + delete qx.event.handler.FocusHandler.mouseFocus; + + // focus previous tab + vPrev.setFocused(true); + + // and naturally make it also checked + vPrev.setChecked(true); + } + break; + + case "Right": + var vNext = this.getNextSibling() || this.getParent().getFirstVisibleChild(); + if (vNext && vNext != this) + { + // we want to enable the outline border, because + // the user used the keyboard for activation + delete qx.event.handler.FocusHandler.mouseFocus; + + // focus next tab + vNext.setFocused(true); + + // and naturally make it also checked + vNext.setChecked(true); + } + break; + } +}; + + +qx.Proto._ontabclose = function(e){ + this.createDispatchDataEvent("closetab", this); +} + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- + */ + +qx.Proto._modifyShowCloseButton = function(propValue, propOldValue, propData) { + + // if no image exists, then create one + if (!this._closeButtonImage) { + this._closeButtonImage = new qx.ui.basic.Image(this.getCloseButtonImage()); + } + if (propValue) { + this._closeButtonImage.addEventListener("click", this._ontabclose, this); + this.add(this._closeButtonImage); + } else { + this.remove(this._closeButtonImage); + this._closeButtonImage.removeEventListener("click", this._ontabclose); + } + + return true; +} + +qx.Proto._modifyCloseButtonImage = function(propValue, propOldValue, propData) { + if (this._closeButtonImage) { + this._closeButtonImage.setSource(propValue); + } + + return true; +} + + + +/* +--------------------------------------------------------------------------- + APPEARANCE ADDITIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto._applyStateAppearance = function() +{ + this._states.firstChild = this.isFirstVisibleChild(); + this._states.lastChild = this.isLastVisibleChild(); + this._states.alignLeft = this.getView().getAlignTabsToLeft(); + this._states.barTop = this.getView().getPlaceBarOnTop(); + + qx.ui.pageview.AbstractButton.prototype._applyStateAppearance.call(this); +} + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- + */ + +qx.Proto.dispose = function() { + if (this.getDisposed()) { + return; + } + + if(this._closeButtonImage){ + this._closeButtonImage.dispose(); + this._closeButtonImage = null; + } + + return qx.ui.pageview.AbstractButton.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Page.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Page.js new file mode 100644 index 0000000000..8f1f654ed4 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Page.js @@ -0,0 +1,30 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_tabview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.tabview.Page", qx.ui.pageview.AbstractPage, +function(vButton) { + qx.ui.pageview.AbstractPage.call(this, vButton); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "tab-view-page" }); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Pane.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Pane.js new file mode 100644 index 0000000000..d31d4ee0ae --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/Pane.js @@ -0,0 +1,33 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_tabview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.tabview.Pane", qx.ui.pageview.AbstractPane, +function() +{ + qx.ui.pageview.AbstractPane.call(this); + + this.setZIndex(1); +}); + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "tab-view-pane" }); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/TabView.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/TabView.js new file mode 100644 index 0000000000..b1cfe9c2b8 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/pageview/tabview/TabView.js @@ -0,0 +1,86 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_tabview) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.pageview.tabview.TabView", qx.ui.pageview.AbstractPageView, +function() { + qx.ui.pageview.AbstractPageView.call(this, qx.ui.pageview.tabview.Bar, qx.ui.pageview.tabview.Pane); +}); + + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "tab-view" }); + +qx.OO.addProperty({ name : "alignTabsToLeft", type : "boolean", defaultValue : true }); +qx.OO.addProperty({ name : "placeBarOnTop", type : "boolean", defaultValue : true }); + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyAlignTabsToLeft = function(propValue, propOldValue, propData) +{ + var vBar = this._bar; + + vBar.setHorizontalChildrenAlign(propValue ? "left" : "right"); + + // force re-apply of states for all tabs + vBar._addChildrenToStateQueue(); + + return true; +} + +qx.Proto._modifyPlaceBarOnTop = function(propValue, propOldValue, propData) +{ + // This does not work if we use flexible zones + // this.setReverseChildrenOrder(!propValue); + + var vBar = this._bar; + + // move bar around + if (propValue) { + vBar.moveSelfToBegin(); + } else { + vBar.moveSelfToEnd(); + } + + // force re-apply of states for all tabs + vBar._addChildrenToStateQueue(); + + return true; +} |