{@inheritdoc}

@throws DcGeneralInvalidArgumentException Is thrown if there is no palette with this name.
773002
public function getPaletteByName($paletteName)
    {
        foreach ($this->palettes as $palette) {
            if ($paletteName === $palette->getName()) {
                return $palette;
            }
        }

        throw new DcGeneralInvalidArgumentException('No palette found for name ' . $paletteName);
    }
504362
function parsePalette (palette) {
  var vars = {
    camelCased : {},
    paramCased : {}
  };
  Object.keys(palette).forEach(function (key) {
    var hex = color(palette[key]).hexString();
    vars.camelCased[cameled(key)] = hex;
    vars.paramCased[dashed(key)] = hex;
  });
  return vars;
}
758888
private function restrictSpotColorSpace($c, &$PDFAXwarnings = [])
	{
		if (!isset($this->mpdf->spotColorIDs[$c[1]])) {
				throw new \Mpdf\MpdfException('Error: Spot colour has not been defined - ' . $this->mpdf->spotColorIDs[$c[1]]);
		}

		if ($this->mpdf->PDFA) {
			if ($this->mpdf->PDFA && !$this->mpdf->PDFAauto) {
				$PDFAXwarnings[] = "Spot color specified '" . $this->mpdf->spotColorIDs[$c[1]] . "' (converted to process color)";
			}
			if ($this->mode != 3) {
				$sp = $this->mpdf->spotColors[$this->mpdf->spotColorIDs[$c[1]]];
				$c = $this->colorModeConverter->cmyk2rgb([4, $sp['c'], $sp['m'], $sp['y'], $sp['k']]);
			}
		} elseif ($this->mode == 1) {
			$sp = $this->mpdf->spotColors[$this->mpdf->spotColorIDs[$c[1]]];
			$c = $this->colorModeConverter->cmyk2gray([4, $sp['c'], $sp['m'], $sp['y'], $sp['k']]);
		}

		return $c;
	}
18369
private function getVisibleAndEditAbleProperties(PaletteInterface $palette, ModelInterface $model)
    {
        return \array_intersect(
            \array_map(
                function (PropertyInterface $property) {
                    return $property->getName();
                },
                $palette->getVisibleProperties($model)
            ),
            \array_map(
                function (PropertyInterface $property) {
                    return $property->getName();
                },
                $palette->getEditableProperties($model)
            )
        );
    }
56474
private void cmdAddActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cmdAddActionPerformed
		Object item = cboPropertyAutoSuggest.getSelectedItem();
		addPredicateProperty(item);
		validatePredicateProperty();
	}
703736
function allocateColor( $name, $red, $green, $blue )
    {
        if ( isset( $this->Palette[$name] ) )
        {
            eZDebug::writeError( 'Color already defined: ' . $name, __METHOD__ );
            return null;
        }
        $red = max( 0, min( 255, $red ) );
        $green = max( 0, min( 255, $green ) );
        $blue = max( 0, min( 255, $blue ) );
        $color = ImageColorAllocate( $this->ImageObject, $red, $green, $blue );
        $this->Palette[$name] = $color;
        $this->PaletteIndex[] = $color;
        return $color;
    }
1188677
public function getProperty($name)
    {
        if (!$this->hasProperty($name)) {
            throw new DcGeneralInvalidArgumentException('Property ' . $name . ' is not registered.');
        }

        return $this->properties[$name];
    }
755093
private static void validate(String name, Collection<Geometry> geometries, int extent) {
        if (name == null) {
            throw new IllegalArgumentException("layer name is null");
        }
        if (geometries == null) {
            throw new IllegalArgumentException("geometry collection is null");
        }
        if (extent <= 0) {
            throw new IllegalArgumentException("extent is less than or equal to 0");
        }
    }
86763
private void defineDesktopPanes(UIDefaults d) {
        d.put("seaGlassDesktopPane", new ColorUIResource(0x556ba6));
        String c = PAINTER_PREFIX + "DesktopPanePainter";

        String p = "DesktopPane";

        d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopPanePainter.Which.BACKGROUND_ENABLED));

        // Initialize DesktopIcon
        p = "DesktopIcon";
        c = PAINTER_PREFIX + "DesktopIconPainter";
        d.put(p + ".contentMargins", new InsetsUIResource(0, 6, 5, 4));
        d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopIconPainter.Which.BACKGROUND_ENABLED));
    }
1248463
def make_palette(source)
      case source
      when :default
        make_const_palette(:category20)
      when Symbol
        make_const_palette(source)
      when Array
        ->(_, index){source[index % source.size]}
      when Proc
        source
      when ->(s){s.respond_to?(:color)}
        ->(word, index){source.color(word, index)}
      else
        fail ArgumentError, "Unknown palette: #{source.inspect}"
      end
    end
752963
public function buildPaletteAndFields ($dc)
	{
		// Build the content block elements palette and fields only when editing a content element (see #5)
		if (\Input::get('act') != 'edit' && \Input::get('act') != 'show' && !isset($_GET['target']))
		{
			return;
		}
		
		$intId = (isset($_GET['target'])) ? explode('.', \Input::get('target'))[2] : $dc->id;
		
		$objContent = \ContentModel::findByPk($intId);
	
		if ($objContent === null)
		{
			return;
		}

		// Get block element
		$objElement = \ElementsModel::findOneByAlias($objContent->type);
			
		if ($objElement === null)
		{
			return;
		}

		// Add default palette (for type selection)
		$GLOBALS['TL_DCA']['tl_content']['palettes'][$objElement->alias] = '{type_legend},type';

		// Add pattern to palette
		$colPattern = \PatternModel::findVisibleByPid($objElement->id);

		if ($colPattern === null)
		{
			return;
		}
		
		$arrData = array();

		$colData = \DataModel::findByPid($intId);
		
		if ($colData !== null)
		{
			foreach ($colData as $objData)
			{
				$arrData[$objData->pattern] = $objData;
			}							
		}
	
		foreach($colPattern as $objPattern)
		{
			// Construct dca for pattern
			$strClass = Agoat\CustomContentElementsBundle\Contao\Pattern::findClass($objPattern->type);
			$bolData = Agoat\CustomContentElementsBundle\Contao\Pattern::hasData($objPattern->type);
				
			if (!class_exists($strClass))
			{
				\System::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
			}
			else
			{
				if ($bolData && !isset($arrData[$objPattern->alias]))
				{
					$arrData[$objPattern->alias] = new \DataModel();
					$arrData[$objPattern->alias]->pid = $objContent->id;
					$arrData[$objPattern->alias]->pattern = $objPattern->alias;
			
					$arrData[$objPattern->alias]->save();
				}
				
				$objPatternClass = new $strClass($objPattern);
				$objPatternClass->pid = $objContent->id;
				$objPatternClass->pattern = $objPattern->alias;
				$objPatternClass->element = $objElement->alias;			
				$objPatternClass->data = $arrData[$objPattern->alias]; // Save data to the DCA		

				$objPatternClass->create();
			}
		}
	}
376492
protected static function generatePalette($table, array $paletteFields = array(), array $standardFields = array())
	{
		$palette = '';

		if ($table === 'tl_module') {
			$palette .= '{title_legend},name';
			if (in_array('headline', $standardFields)) {
				$palette .= ',headline';
			}
			$palette .= ',type';
		}
		else {
			$palette .= '{type_legend},type';
			if ($table === 'tl_content' && in_array('headline', $standardFields)) {
				$palette .= ',headline';
			}
			if (in_array('columns', $standardFields)) {
				$palette .= ';{rs_columns_legend},rs_columns_large,rs_columns_medium,rs_columns_small';
			}
			if (in_array('text', $standardFields)) {
				$palette .= ';{text_legend},text';
			}
		}

		if (
			isset($paletteFields[0])
			&& $paletteFields[0] !== 'rsce_data'
			&& isset($GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'])
			&& $GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'] !== 'rsce_group_start'
			&& $GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'] !== 'rsce_list_start'
		) {
			$palette .= ';{rsce_legend}';
		}

		$palette .= ',' . implode(',', $paletteFields);

		if ($table === 'tl_content' && in_array('image', $standardFields)) {
			$palette .= ';{image_legend},addImage';
		}

		if ($table === 'tl_form_field') {
			$palette .= ';{expert_legend:hide},class';
		}

		$palette .= ';{template_legend:hide},customTpl';

		if ($table !== 'tl_form_field') {

			$palette .= ';{protected_legend:hide},protected;{expert_legend:hide},guests';

			if (in_array('cssID', $standardFields)) {
				$palette .= ',cssID';
			}

		}

		if ($table === 'tl_content') {
			$palette .= ';{invisible_legend:hide},invisible,start,stop';
		}

		return $palette;
	}
109446
<T extends Validatable> void validateCollection(final Collection<T> collection,
                                                  final String name) {
    Iterator<T> iterator = collection.iterator();
    int i = 0;
    while (iterator.hasNext()) {
      try {
        iterator.next().validate();
      } catch (final IllegalArgumentException e) {
        throw new IllegalArgumentException("Invalid " + name + 
            " at index " + i, e);
      }
      i++;
    }
  }
140131
public function addProperty(PropertyInterface $property, PropertyInterface $before = null)
    {
        $hash = \spl_object_hash($property);

        if ($before) {
            $beforeHash = \spl_object_hash($before);

            if (!isset($this->properties[$beforeHash])) {
                throw new DcGeneralInvalidArgumentException(
                    \sprintf(
                        'Property %s not contained in legend - can not add %s after it.',
                        $before->getName(),
                        $property->getName()
                    )
                );
            }

            $hashes   = \array_keys($this->properties);
            $position = \array_search($beforeHash, $hashes);

            $this->properties = \array_merge(
                \array_slice($this->properties, 0, $position),
                [$hash => $property],
                \array_slice($this->properties, $position)
            );

            return $this;
        }

        $this->properties[$hash] = $property;

        return $this;
    }
716586
public function getMatchCount(ModelInterface $model = null, PropertyValueBag $input = null)
    {
        $totalCount = false;

        foreach ($this->conditions as $condition) {
            if (!($condition instanceof PaletteConditionInterface)) {
                throw new DcGeneralRuntimeException('Invalid condition in chain: ' . \get_class($condition));
            }

            $conditionCount = $condition->getMatchCount($model, $input);

            if (false !== $conditionCount) {
                $totalCount += $conditionCount;
            } elseif (static::AND_CONJUNCTION === $this->conjunction) {
                return false;
            }
        }

        return $totalCount;
    }
667511
protected function guardValidEnvironment(ModelIdInterface $modelId)
    {
        if ($this->getEnvironment()->getDataDefinition()->getName() !== $modelId->getDataProviderName()) {
            throw new DcGeneralRuntimeException(
                \sprintf(
                    'Not able to perform action. Environment is not prepared for model "%s"',
                    $modelId->getSerialized()
                )
            );
        }
    }
599435
private void initializeDrawableForDisplay(Drawable d) {
        if (mBlockInvalidateCallback == null) {
            mBlockInvalidateCallback = new BlockInvalidateCallback();
        }
        // Temporary fix for suspending callbacks during initialization. We
        // don't want any of these setters causing an invalidate() since that
        // may call back into DrawableContainer.
        d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
        try {
            if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {
                d.setAlpha(mAlpha);
            }
            if (mDrawableContainerState.mHasColorFilter) {
                // Color filter always overrides tint.
                d.setColorFilter(mDrawableContainerState.mColorFilter);
            } else {
                if (mDrawableContainerState.mHasTintList) {
                    DrawableCompat.setTintList(d, mDrawableContainerState.mTintList);
                }
                if (mDrawableContainerState.mHasTintMode) {
                    DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode);
                }
            }
            d.setVisible(isVisible(), true);
            d.setDither(mDrawableContainerState.mDither);
            d.setState(getState());
            d.setLevel(getLevel());
            d.setBounds(getBounds());
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                d.setLayoutDirection(getLayoutDirection());
            }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);
            }
            final Rect hotspotBounds = mHotspotBounds;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) {
                d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top,
                        hotspotBounds.right, hotspotBounds.bottom);
            }
        } finally {
            d.setCallback(mBlockInvalidateCallback.unwrap());
        }
    }