[qooxdoo-commit] SF.net SVN: qooxdoo:[15512] trunk/qooxdoo
Brought to you by:
ecker,
martinwittemann
From: <jon...@us...> - 2008-08-12 13:42:38
|
Revision: 15512 http://qooxdoo.svn.sourceforge.net/qooxdoo/?rev=15512&view=rev Author: jonathan_rass Date: 2008-08-12 13:42:26 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Removed ColorField Removed Paths: ------------- trunk/qooxdoo/application/demobrowser/source/class/demobrowser/demo/widget/DateField.js trunk/qooxdoo/application/demobrowser/source/demo/widget/DateField.html trunk/qooxdoo/framework/source/class/qx/ui/form/DateField.js Deleted: trunk/qooxdoo/application/demobrowser/source/class/demobrowser/demo/widget/DateField.js =================================================================== --- trunk/qooxdoo/application/demobrowser/source/class/demobrowser/demo/widget/DateField.js 2008-08-12 13:42:14 UTC (rev 15511) +++ trunk/qooxdoo/application/demobrowser/source/class/demobrowser/demo/widget/DateField.js 2008-08-12 13:42:26 UTC (rev 15512) @@ -1,124 +0,0 @@ -/* ************************************************************************ - - 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: - * Martin Wittemann (martinwittemann) - -************************************************************************ */ - -/* ************************************************************************ - -************************************************************************ */ - -qx.Class.define("demobrowser.demo.widget.DateField", -{ - extend : qx.application.Standalone, - - members : - { - main: function() - { - this.base(arguments); - - // Default date field ////////////////////////////////////// - this.getRoot().add(new qx.ui.basic.Label("Default"), {top: 20, left: 20}); - var dateField = new qx.ui.form.DateField(); - this.getRoot().add(dateField, {top: 35, left: 20}); - dateField.setDate(new Date()); - //////////////////////////////////////////////////////////// - - // Date field with date formater /////////////////////////// - this.getRoot().add(new qx.ui.basic.Label("With date formater"), {top: 20, left: 150}); - var dateFieldFormat = new qx.ui.form.DateField(); - this.getRoot().add(dateFieldFormat, {top: 35, left: 150}); - dateFieldFormat.setDate(new Date()); - - - var format1 = new qx.util.format.DateFormat("MM-yyyy"); - var format2 = new qx.util.format.DateFormat("MM/dd/yyyy"); - var format3 = new qx.util.format.DateFormat("dd.MM.yyyy"); - dateFieldFormat.setDateFormat(format2); - - - var setFormat1Button = new qx.ui.form.Button("MM-yyyy"); - setFormat1Button.setWidth(120); - this.getRoot().add(setFormat1Button, {top: 60, left: 150}); - setFormat1Button.addListener("execute", function(e) { - dateFieldFormat.setDateFormat(format1); - }); - - var setFormat2Button = new qx.ui.form.Button("MM/dd/yyyy"); - setFormat2Button.setWidth(120); - this.getRoot().add(setFormat2Button, {top: 88, left: 150}); - setFormat2Button.addListener("execute", function(e) { - dateFieldFormat.setDateFormat(format2); - }); - - var setFormat3Button = new qx.ui.form.Button("dd.MM.yyyy"); - setFormat3Button.setWidth(120); - this.getRoot().add(setFormat3Button, {top: 116, left: 150}); - setFormat3Button.addListener("execute", function(e) { - dateFieldFormat.setDateFormat(format3); - }); - //////////////////////////////////////////////////////////// - - // external manipulation of the date field ///////////////// - this.getRoot().add(new qx.ui.basic.Label("Set data"), {top: 20, left: 280}); - var dateFieldManipulation = new qx.ui.form.DateField(); - this.getRoot().add(dateFieldManipulation, {top: 35, left: 280}); - - var setCurrentButton = new qx.ui.form.Button("Set current date"); - setCurrentButton.setWidth(120); - this.getRoot().add(setCurrentButton, {top: 60, left: 280}); - setCurrentButton.addListener("execute", function(e) { - dateFieldManipulation.setDate(new Date()); - }); - - var setValueTestButton = new qx.ui.form.Button("Set 'TEST'"); - setValueTestButton.setWidth(120); - this.getRoot().add(setValueTestButton, {top: 88, left: 280}); - setValueTestButton.addListener("execute", function(e) { - dateFieldManipulation.setValue("TEST"); - }); - - var setValueDateButton = new qx.ui.form.Button("Set '01.01.08'"); - setValueDateButton.setWidth(120); - this.getRoot().add(setValueDateButton, {top: 116, left: 280}); - setValueDateButton.addListener("execute", function(e) { - dateFieldManipulation.setValue("01.01.08"); - }); - //////////////////////////////////////////////////////////// - - // Get stuff of the date field ///////////////////////////// - this.getRoot().add(new qx.ui.basic.Label("Get data"), {top: 20, left: 410}); - var dateFieldGet = new qx.ui.form.DateField(); - this.getRoot().add(dateFieldGet, {top: 35, left: 410}); - - var getValueButton = new qx.ui.form.Button("Get value"); - getValueButton.setWidth(120); - this.getRoot().add(getValueButton, {left: 410, top: 60}); - getValueButton.addListener("execute", function(e) { - alert(dateFieldGet.getValue()); - }); - - var getDateButton = new qx.ui.form.Button("Get date"); - getDateButton.setWidth(120); - this.getRoot().add(getDateButton, {left: 410, top: 88}); - getDateButton.addListener("execute", function(e) { - alert(dateFieldGet.getDate()); - }); - //////////////////////////////////////////////////////////// - } - } -}); Deleted: trunk/qooxdoo/application/demobrowser/source/demo/widget/DateField.html =================================================================== --- trunk/qooxdoo/application/demobrowser/source/demo/widget/DateField.html 2008-08-12 13:42:14 UTC (rev 15511) +++ trunk/qooxdoo/application/demobrowser/source/demo/widget/DateField.html 2008-08-12 13:42:26 UTC (rev 15512) @@ -1,10 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <script type="text/javascript" src="../helper.js"></script> -</head> -<body> - -</body> -</html> Deleted: trunk/qooxdoo/framework/source/class/qx/ui/form/DateField.js =================================================================== --- trunk/qooxdoo/framework/source/class/qx/ui/form/DateField.js 2008-08-12 13:42:14 UTC (rev 15511) +++ trunk/qooxdoo/framework/source/class/qx/ui/form/DateField.js 2008-08-12 13:42:26 UTC (rev 15512) @@ -1,275 +0,0 @@ -/* ************************************************************************ - - 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: - * Martin Wittemann (martinwittemann) - -************************************************************************ */ - -/** - * A *date field* is like a combo box with the date as popup. As button to - * open the calendeer a calender icon is shown at the right to the textfield. - * - * To be conform with all form widgets, the {@link qx.ui.form.IFormElement} interface - * is implemented. - * - * The following example creates a date field and sets the current - * date as selected. - * - * <pre> - * var dateField = new qx.ui.form.DateField(); - * this.getRoot().add(dateField, {top: 20, left: 20}); - * dateField.setDate(new Date()); - * </pre> - */ -qx.Class.define("qx.ui.form.DateField", -{ - extend : qx.ui.form.ComboBox, - - - - /* - ***************************************************************************** - CONSTRUCTOR - ***************************************************************************** - */ - - construct : function() - { - this.base(arguments); - - // create a default date format - var curerntDateFormat = qx.locale.Date.getDateFormat("short").toString(); - this.setDateFormat(new qx.util.format.DateFormat(curerntDateFormat)); - }, - - - - /* - ***************************************************************************** - PROPERTIES - ***************************************************************************** - */ - - properties : - { - // overridden - appearance : - { - refine : true, - init : "datefield" - }, - - /** The formater, which convertes the selected date to a string. **/ - dateFormat : - { - check : "qx.util.format.DateFormat", - apply : "_applyDateFormat" - } - }, - - - /* - ***************************************************************************** - MEMBERS - ***************************************************************************** - */ - - members : - { - /* - --------------------------------------------------------------------------- - PUBLIC METHODS - --------------------------------------------------------------------------- - */ - /** - * This method sets the date corresponding to the {@link dateFormat} to the - * date field. It will also select the date in the calender popup. - * - * @param date {Date} The date to set. - */ - setDate : function(date) - { - // set the date to the textfield - var textField = this._getChildControl("textfield"); - textField.setValue(this.getDateFormat().format(date)); - // set the date in the datechooser - var dateChooser = this._getChildControl("list"); - dateChooser.setDate(date); - }, - - - /** - * Returns the current set date corresponding to the {@link dateFormat}. - * If the given text could not be parsed, <code>null</code> will be returned. - * - * @return {Date} The currently set date. - */ - getDate : function() - { - // get the value of the textfield - var textfieldValue = this._getChildControl("textfield").getValue(); - - try { - // return the parsed date - return this.getDateFormat().parse(textfieldValue); - } catch (e) { - // if the text could not be parsed, null will be returned - return null; - } - }, - - - /** - * Sets the given value to the textfield. If the value could be - * a date corresponding to the set {@link dateFormat}, the date is - * selected in the calender popup. - * - * @param value {String} The String value to set. - */ - - setValue : function(value) - { - - var textfield = this._getChildControl("textfield"); - if (textfield.getValue() == value) { - return; - } - - textfield.setValue(value); - - try { - var date = this.getDateFormat().parse(value); - this._getChildControl("list").setDate(date); - } catch (e) { - // remove the selection of the date chooser - this._getChildControl("list").setDate(null); - } - }, - - - /** - * Returns the value in the textfield. - * - * @return {String} The string value of the textfield. - */ - getValue : function() { - return this._getChildControl("textfield").getValue(); - }, - - - /* - --------------------------------------------------------------------------- - APPLY METHODS - --------------------------------------------------------------------------- - */ - // apply method - _applyDateFormat : function(value, old) - { - // get the date with the old date format - try { - var textfield = this._getChildControl("textfield"); - var currentDate = old.parse(textfield.getValue()); - textfield.setValue(value.format(currentDate)); - } catch (e) { - // do nothing if the former date could not be parsed - } - }, - - - /* - --------------------------------------------------------------------------- - OVERRIDDEN METHODS - --------------------------------------------------------------------------- - */ - // overridden - _createChildControlImpl : function(id) - { - var control; - - switch(id) - { - case "list": - control = new qx.ui.control.DateChooser(); - control.setFocusable(false); - control.setKeepFocus(true); - control.addListener("execute", this._onChangeDate, this); - - break; - - case "popup": - control = new qx.ui.popup.Popup(new qx.ui.layout.VBox); - control.setAutoHide(false); - control.add(this._getChildControl("list")); - control.addListener("mouseup", this._onChangeDate, this); - break; - } - - return control || this.base(arguments, id); - }, - - - /* - --------------------------------------------------------------------------- - EVENT LISTENERS - --------------------------------------------------------------------------- - */ - /** - * Handler method which handles the click on the calender popup. - * - * @param e {qx.event.type.Mouse} The mouse event of the click. - */ - _onChangeDate : function(e) - { - var textField = this._getChildControl("textfield"); - - var selectedDate = this._getChildControl("list").getDate(); - - textField.setValue(this.getDateFormat().format(selectedDate)); - this.close(); - }, - - - /** - * Handler method which hadles the key press. It forwards all key event - * to the opened date chooser except the escape key event. Escape closes - * the popup. - * If the list is clodes, all key events will not be processed further. - * - * @param e {qx.event.type.KeyEvent} Keypress event - */ - _onKeyPress : function(e) - { - // if the popup is closed, ignore all - var popup = this._getChildControl("popup"); - if (popup.getVisibility() == "hidden") { - return; - } - - // get the key identifier - var identifier = e.getKeyIdentifier(); - - // hide the list always on escape - if (identifier == "Escape") - { - this.close(); - e.stopPropagation(); - return; - } - - // forward the rest of the events to the date chooser - this._getChildControl("list").handleKeyPress(e); - } - } -}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |