All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rwt.widgets.util.RadioManager.js Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2004, 2014 1&1 Internet AG, Germany, http://www.1und1.de,
 *                          EclipseSource and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    1&1 Internet AG and others - original API and implementation
 *    EclipseSource - adaptation for the Eclipse Remote Application Platform
 ******************************************************************************/

/**
 * Each instance manages vItems set of radio options: qx.ui.form.RadioButton, qx.ui.toolbar.RadioButton, ...
 */
rwt.qx.Class.define("rwt.widgets.util.RadioManager",
{
  extend : rwt.qx.Target,




  /*
  *****************************************************************************
     CONSTRUCTOR
  *****************************************************************************
  */

  construct : function(vName, vMembers)
  {
    // we don't need the manager data structures
    this.base(arguments);

    // create item array
    this._items = [];

    // apply name property
    this.setName(vName != null ? vName : rwt.widgets.util.RadioManager.AUTO_NAME_PREFIX + this.toHashCode());

    if (vMembers != null)
    {
      // add() iterates over arguments, but vMembers is an array
      this.add.apply(this, vMembers);
    }
  },




  /*
  *****************************************************************************
     STATICS
  *****************************************************************************
  */

  statics : {
    AUTO_NAME_PREFIX : "qx-radio-"
  },




  /*
  *****************************************************************************
     PROPERTIES
  *****************************************************************************
  */

  properties :
  {
    selected :
    {
      nullable : true,
      apply : "_applySelected",
      event : "changeSelected",
      check : "rwt.qx.Object"
    },

    name :
    {
      check : "String",
      nullable : true,
      apply : "_applyName"
    }
  },




  /*
  *****************************************************************************
     MEMBERS
  *****************************************************************************
  */

  members :
  {
    /*
    ---------------------------------------------------------------------------
      UTILITIES
    ---------------------------------------------------------------------------
    */

    /**
     * TODOC
     *
     * @type member
     * @return {var} TODOC
     */
    getItems : function() {
      return this._items;
    },


    /**
     * TODOC
     *
     * @type member
     * @return {var} TODOC
     */
    getEnabledItems : function()
    {
      var b = [];

      for (var i=0, a=this._items, l=a.length; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy