x.core.Variant.select
*
* @param key {String} The key to select the data for.
* @param variants {Map} The map containing the data for the selectable
* variants.
*
* @return {var} The selected data
*/
qx.Bootstrap.define(«qx.core.Variant»,
{
statics :
{
/**
* Selects a value from a map based on the current variant setting.
*
* @param key {String} The key to select the data for.
* @param variants {Map} The map containing the data for the selectable
* variants.
* @return {var} The selected data
*/
select : function(key, variants)
{
if (qx.core.Environment.get(key) != undefined) {
return variants[qx.core.Environment.get(key)];
}
if (variants.hasOwnProperty(«default»)) {
return variants.default;
}
throw new Error(‘No match for variant «‘ + key + ‘» (‘ + (qx.core.Environment.get(key) || «undefined») + ‘) found!’);
}
}
});
/* ************************************************************************
qooxdoo – the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 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:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* This class is responsible for applying CSS3 key frame animations to plain
* DOM elements.
*
* The implementation is mostly a cross browser wrapper for applying
* the animations. There is no animation queuing or anything like it.
*
* The API is keep to the basics.
*
* @require(qx.bom.element.AnimationCss)
* @require(qx.bom.element.AnimationHandle)
* @internal
*/
qx.Bootstrap.define(«qx.bom.element.Animation»,
{
/**
* @param elem {Element} The element to animate.
* @param desc {Map} Animation description.
* @param duration {Integer?} The duration of the animation which will
* override the duration given in the description.
* @return {qx.bom.element.AnimationHandle} The handle.
*/
animate : function(elem, desc, duration)
{
// stop if an animation is already running
if (elem.$$animation) {
elem.$$animation.stop();
}
// create the animation
var animation = new qx.bom.element.AnimationCss(elem, desc, duration);
// save the animation
elem.$$animation = animation;
// return the handle
return animation;
}
});
/* ************************************************************************
qooxdoo – the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 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:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* This class is responsible for checking the scrolling behavior of the client.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define(«qx.bom.client.Scroll»,
{
/*
*****************************************************************************
STATICS
*****************************************************************************
*/
statics :
{
/**
* Check if the scrollbars should be positioned on top of the content. This
* is true of OSX Lion when the scrollbars dissapear automatically.
*
* @internal
*
* @return {Boolean} true
if the scrollbars should be
* positioned on top of the content.
*/
scrollBarOverlayed : function() {
var scrollBarWidth = qx.bom.element.Scroll.getScrollbarWidth();
var osx = qx.bom.client.OperatingSystem.getName() === «osx»;
return scrollBarWidth == 0 && osx;
}
},
defer : function(statics) {
qx.core.Environment.add(«os.scrollBarOverlayed», statics.scrollBarOverlayed);
}
});
/* ************************************************************************
qooxdoo – the new era of web development
http://qooxdoo.org
Copyright:
2004-2011 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:
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* This class is responsible for checking the scroll execution behavior of the
* client.
*
* This class is used by {@link qx.core.Environment} and should not be used
* directly. Please check its class comment for details how to use it.
*
* @internal
*/
qx.Bootstrap.define(«qx.bom.client.ScrollExecution»,
{
statics :
{
/**
* Check if the scroll execution preventer should be used
* to prevent browser quirks.
*
* @internal
*
* @return {Boolean} true
if the scroll executor should be
* prevented.
*/
shouldPreventScroll : function()
{
// Safari 10.0+
var webkit = qx.bom.client.Engine.WEBKIT;
var version = parseFloat(qx.bom.client.Engine.VERSION);
var shouldPrevent = false;
// Safari 10+
if (webkit && version >= 10) {
shouldPrevent = true;
// Mobile safari
} else if (qx.bom.client.Browser.getName() == «safari» && qx.bom.client.Device.getName() == «ios») {
shouldPrevent = true;
}
return shouldPrevent;
}
},
defer : function(statics) {
qx.core.Environment.add(«os.scrollExecution», statics.shouldPreventScroll);
}
});
/* ************************************************************************
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)
************************************************************************ */
/**
* The TextField is a multi-line text input field.
*/
qx.Class.define(«qx.ui.form.TextArea»,
{
extend : qx.ui.form.AbstractField,
/*
*****************************************************************************
CONSTRUCTOR
*****************************************************************************
*/
/**
* @param value {String?»»} The text area’s initial value
*/
construct : function(value)
{
this.base(arguments, value);
this.initWrap();
this.addListener(«mousewheel», this._onMousewheel, this);
},
/*
*****************************************************************************
PROPERTIES
*****************************************************************************
*/
properties :
{
// overridden
appearance :
{
refine : true,
init : «textarea»
},
/**
* Whether the field is using auto growing
*/
autoSize :
{
check : «Boolean»,
init : false
},
/** Controls whether text wrap is activated or not. */
wrap :
{
check : «Boolean»,
init : true,
apply : «_applyWrap»
},
// overridden
allowGrowY :
{
refine : true,
init : false
},
// overridden
allowShrinkY :
{
refine : true,
init : false
}
},
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members :
{
__areaClone : null,
__areaHeight : null,
__originalAreaHeight : null,
// overridden
setValue : function(value)
{
value = this.base(arguments, value);
this.__autoSize();
return value;
},
/**
* Handles the mouse wheel for scrolling the TextArea.
*
* @param e {qx.event.type.MouseWheel} mouse wheel event.
*/
_onMousewheel : function(e) {
var contentElement = this.getContentElement();
if (qx.bom.client.Engine.GECKO) {
var delta = e.getWheelDelta();
if (delta > 0) {
contentElement.scrollUp(40);
} else {
contentElement.scrollDown(40);
}
e.stop();
} else {
this.base(arguments, e);
}
},
/*
—————————————————————————
AUTO SIZE
—————————————————————————
*/
/**
* Automatically adjusts the height of the text area to the
* height of the content.
*
*/
__autoSize: function() {
if (this.isAutoSize()) {
this.__autoSizeArea();
}
},
/**
* Automatically adjusts the height of the text area to the
* height of the content.
*
*/
__autoSizeArea: function() {
var clone = this.__getAreaClone();
if (!clone) {
return;
}
// Copy all styles
var cloneStyles = {
‘fontFamily’: qx.bom.element.Style.get(this.getContentElement(), ‘fontFamily’),
‘fontSize’: qx.bom.element.Style.get(this.getContentElement(), ‘fontSize’),
‘lineHeight’: qx.bom.element.Style.get(this.getContentElement(), ‘lineHeight’),
‘letterSpacing’: qx.bom.element.Style.get(this.getContentElement(), ‘letterSpacing’),
‘whiteSpace’: qx.bom.element.Style.get(this.getContentElement(), ‘whiteSpace’),
‘boxSizing’: qx.bom.element.Style.get(this.getContentElement(), ‘boxSizing’),
‘padding’: qx.bom.element.Style.get(this.getContentElement(), ‘padding’),
‘paddingTop’: qx.bom.element.Style.get(this.getContentElement(), ‘paddingTop’),
‘paddingLeft’: qx.bom.element.Style.get(this.getContentElement(), ‘paddingLeft’),
‘paddingRight’: qx.bom.element.Style.get(this.getContentElement(),