Returns component by given component class

If multiple are found you will get an exception,
To avoid that pass 'limit'=>1 as select

@see getComponentsBySameClass
@param string component class
@param array|Kwf_Component_Select
@return Kwf_Component_Data
166531
public function getComponentBySameClass($class, $select = array())
    {
        $components = $this->getComponentsBySameClass($class, $select);
        $this->_checkSingleComponent($components);
        if (isset($components[0])) {
            return $components[0];
        }
        return null;
    }
606251
public static function hasChildComponentClass($class, $generator, $componentKey = null)
    {
        $constraints = array(
            'generator' => $generator,
            'componentKey' => $componentKey
        );
        $classes = self::getChildComponentClasses($class, $constraints);
        return count($classes) > 0;
    }
566126
public function getComponent($component)
    {
        if (isset($this->_components[$component])) {
            return self::createComponents($this->_components[$component]);
        } else {
            throw new \Exception($component . '组件不存在');
        }
    }
1267773
def get_component(self, component_type):
        '''
        
        '''
        matching_components = list(filter(lambda component:
                                          isinstance(component,
                                                     component_type),
                                          self._components))
        if matching_components:
            return matching_components[0]
        else:
            return None
621784
public function select($table, $components = array(), $bind = "")
    {
        $default_components = array(
            'fields'    => '*',
            'groupby'   => '',
            'having'    => '',
            'where'     => '',
            'orderby'   => '',
            'limit'     => ''
        );

        $components = array_merge($default_components,$components);
        $components = array_filter($components);
        $sql = "";
        foreach($components as $key => $value) {

            switch($key) {
                case 'fields':
                    $sql .= "SELECT " . $value . " FROM " . $table;
                    break;

                case 'where':
                    $sql .= " WHERE " . $value;
                    break;

                case 'groupby':
                    $sql .= " GROUP BY " . $value;
                    break;

                case 'having':
                    $sql .= " HAVING " . $value;
                    break;

                case 'orderby':
                    $sql .= " ORDER BY " . $value;
                    break;

                case 'limit':
                    $sql .= " LIMIT " . $value;
                    if($value == 1)$this->limit = $value;
                    break;
            }

        }
        $sql .= ";";

        return $this->run($sql, $bind);
    }
506261
public function searchComponents($search, $by, $limit = 1, $num = 1000, $page = 1)
    {
        $components = $this->indexComponents($num, $page)['data'];

        $filtered = array_filter(
            $components,
            function ($component) use ($search, $by) {

                if (array_key_exists($by, $component)) {
                    if (strpos($component[$by], $search) !== false) {
                        return $component;
                    }
                    if ($component[$by] === $search) {
                        return $component;
                    }
                }

                return false;
            }
        );

        if ($limit == 1) {
            return array_shift($filtered);
        }

        return array_slice($filtered, 0, $limit);
    }
260712
public function getComponent()
    {
        // Simple cache.
        if (!empty($this->component)) {
            return $this->component;
        }

        $filter = new StatementFilter();
        $parser = new CodeParser();

        $notFound   = 'The plugin must define the $plugin->component in the version.php file.';
        $statements = $parser->parseFile($this->directory.'/version.php');

        try {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'plugin', 'component', $notFound);
        } catch (\Exception $e) {
            $assign = $filter->findFirstPropertyFetchAssignment($statements, 'module', 'component', $notFound);
        }

        if (!$assign->expr instanceof String_) {
            throw new \RuntimeException('The $plugin->component must be assigned to a string in the version.php file.');
        }
        $this->component = $assign->expr->value;

        return $this->component;
    }
1289529
public function getIndex ()
  {
    if (!isset($this->parent))
      throw new ComponentException($this, "The component is not attached to a parent.");
    if (!$this->parent->children)
      throw new ComponentException($this, "The parent component has no children.");

    return array_search ($this, $this->parent->children, true);
  }
701280
protected Component getComponentByName(String name) throws QTasteException {
        mFoundComponent = null;
        mFindWithEqual = false;
        LOGGER.debug("try to find a component with the name : " + name);
        // TODO: Think about several component having the same names!
        for (Window window : getDisplayableWindows()) {
            if (mFindWithEqual) {
                break;
            }
            if (!checkName(name, window) || !mFindWithEqual) {
                LOGGER.debug("parse window");
                lookForComponent(name, window.getComponents());
            }
        }
        if (mFoundComponent != null) {
            try {
                SwingUtilities.invokeAndWait(() -> {
                    mFoundComponent.requestFocus();
                    Component parent = mFoundComponent.getParent();
                    //active the parent
                    while (parent != null && !(parent instanceof Window)) {
                        parent = parent.getParent();
                    }
                    if (parent != null) {
                        ((Window) parent).toFront();
                    }
                });
            } catch (InterruptedException | InvocationTargetException e) {
                // ignore
            }

            return mFoundComponent;
        }
        throw new QTasteTestFailException("The component \"" + name + "\" is not found.");
    }
1136646
public function select($multiple = false)
	{
		if ( !$this->isSelected() ) {
			if ( $this->select === null ) {
				throw new SelectException(
					'No SELECT element association defined',
					SelectException::TYPE_UNBOUND_OPTION
				);
			}

			$this->select->getWrappedElement()->selectOption($this->getValue(), $multiple);
		}

		return $this;
	}
1153301
public function getSelect()
    {
        $ret = parent::getSelect();
        $categoryDirectory = $this->getItemDirectory()->getComponent();

        $refData = Kwc_Directories_Category_Detail_List_Component::getTableReferenceData(
            Kwc_Abstract::getSetting(get_class($categoryDirectory), 'categoryToItemModelName'),
            'Category'
        );

        $ret->join($refData['tableName'],
            "{$refData['refTableName']}.{$refData['refItemColumn']} = "
                ."{$refData['tableName']}.{$refData['itemColumn']}", array()
        );

        $refDataItem = Kwc_Directories_Category_Detail_List_Component::getTableReferenceData(
            Kwc_Abstract::getSetting(get_class($categoryDirectory), 'categoryToItemModelName'),
            'Item'
        );

        $ret->where(
            $refDataItem['tableName'].'.'.$refDataItem['itemColumn'].' = ?',
            $this->_getItemDetail()->row->id
        );

        return $ret;
    }
431312
protected JComponent getInnerComponent(JComponent component) {
		if (component instanceof JScrollPane) {
			return getInnerComponent((JComponent) ((JScrollPane) component).getViewport().getView());
		} if (component instanceof HasInnerComponent) {
            return getInnerComponent(((HasInnerComponent) component).getInnerComponent());
        }
		return component;
	}
742667
function Select(el, options) {
      _classCallCheck(this, Select);

      // Don't init if browser default version
      var _this16 = _possibleConstructorReturn(this, (Select.__proto__ || Object.getPrototypeOf(Select)).call(this, Select, el, options));

      if (_this16.$el.hasClass('browser-default')) {
        return _possibleConstructorReturn(_this16);
      }

      _this16.el.M_Select = _this16;

      /**
       * Options for the select
       * @member Select#options
       */
      _this16.options = $.extend({}, Select.defaults, options);

      _this16.isMultiple = _this16.$el.prop('multiple');

      // Setup
      _this16.el.tabIndex = -1;
      _this16._keysSelected = {};
      _this16._valueDict = {}; // Maps key to original and generated option element.
      _this16._setupDropdown();

      _this16._setupEventHandlers();
      return _this16;
    }
520527
public function getTemplate(Kwf_Component_Data $component, $type)
    {
        if ($type == 'Master') {
            if (Kwc_Abstract::hasSetting($component->componentClass, 'masterTemplate')) {
                return Kwc_Abstract::getSetting($component->componentClass, 'masterTemplate');
            }
        }
        $template = Kwc_Abstract::getTemplateFile($component->componentClass, $type);
        if (!$template) throw new Kwf_Exception("No $type-Template found for '{$component->componentClass}'");
        return $template;
    }
154866
public static Val get(Class<?> clazz, String... propertyComponents) {
      return get(clazz.getName(), propertyComponents);
   }
1004330
public function getAction()
    {
        $s = $this->_getSelect();
        if ($this->_loadColumns) {
            foreach ($this->_loadColumns as $c) {
                $s->expr($c);
            }
        }
        $s->whereId($this->_getParam('id'));
        $row = $this->_model->getRow($s);
        if (!$row) throw new Kwf_Exception_NotFound();
        $this->view->data = $this->_loadDataFromRow($row);
    }
1039765
public static function getChildComponentClass($class, $generator, $componentKey = null)
    {
        $constraints = array(
            'generator' => $generator,
        );
        if ($componentKey) $constraints['componentKey'] = $componentKey;
        $classes = array_values(self::getChildComponentClasses($class, $constraints));
        if (!isset($classes[0])) {
            if (!$componentKey) {
                throw new Kwf_Exception("no component for generator '$generator' not set for '$class'");
            } else {
                throw new Kwf_Exception("childComponentClass '$componentKey' for generator '$generator' not set for '$class'");
            }
        }
        return $classes[0];
    }