text:
/*	$OpenBSD: db_memrw.c,v 1.3 1997/07/06 08:01:58 downsj Exp $	*/
/*	$NetBSD: db_memrw.c,v 1.5 1997/06/10 18:48:47 veego Exp $	*/

/*-
 * Copyright (c) 1996 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Gordon W. Ross and Jason R. Thorpe.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Interface to the debugger for virtual memory read/write.
 * This file is shared by DDB and KGDB, and must work even
 * when only KGDB is included (thus no db_printf calls).
 *
 * To write in the text segment, we have to first make
 * the page writable, do the write, then restore the PTE.
 * For writes outside the text segment, and all reads,
 * just do the access -- if it causes a fault, the debugger
 * will recover with a longjmp to an appropriate place.
 *
 * ALERT!  If you want to access device registers with a
 * specific size, then the read/write functions have to
 * make sure to do the correct sized pointer access.
 *
 * Modified from sun3 version for hp300 (and probably other m68ks, too)
 * by Jason R. Thorpe <thorpej@NetBSD.ORG>.
 */

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>

#include <vm/vm.h>

#include <machine/pte.h>
#include <machine/db_machdep.h>
#include <machine/cpu.h>
#include <machine/hp300spu.h>

#include <ddb/db_access.h>

static void	db_write_text __P((vm_offset_t, size_t, char *));

/*
 * Read bytes from kernel address space for debugger.
 * This used to check for valid PTEs, but now that
 * traps in DDB work correctly, "Just Do It!"
 */
void
db_read_bytes(addr, size, data)
	vm_offset_t	addr;
	size_t	size;
	char	*data;
{
	char	*src = (char*)addr;

	if (size == 4) {
		*((int*)data) = *((int*)src);
		return;
	}

	if (size == 2) {
		*((short*)data) = *((short*)src);
		return;
	}

	while (size > 0) {
		--size;
		*data++ = *src++;
	}
}

/*
 * Write bytes somewhere in kernel text.
 * Makes text page writable temporarily.
 * We're probably a little to cache-paranoid.
 */
static void
db_write_text(addr, size, data)
	vm_offset_t addr;
	size_t size;
	char *data;
{
	char *dst, *odst;
	pt_entry_t *pte, oldpte, tmppte;
	vm_offset_t pgva;
	int limit;

	if (size == 0)
		return;

	dst = (char *)addr;

	do {
		/*
		 * Get the VA for the page.
		 */
		pgva = m68k_trunc_page((u_long)dst);

		/*
		 * Save this destination address, for TLB
		 * flush.
		 */
		odst = dst;

		/*
		 * Compute number of bytes that can be written
		 * with this mapping and subtract it from the
		 * total size.
		 */
		limit = NBPG - ((u_long)dst & PGOFSET);
		if (limit > size)
			limit = size;
		size -= limit;

#ifdef M68K_MMU_HP
		/*
		 * Flush the supervisor side of the VAC to
		 * prevent a cache hit on the old, read-only PTE.
		 * XXX Is this really necessary, or am I just
		 * paranoid?
		 */
		if (ectype == EC_VIRT)
			DCIS();
#endif

		/*
		 * Make the page writable.  Note the mapping is
		 * cache-inhibited to save hair.
		 */
		pte = kvtopte(pgva);
		oldpte = *pte;

		if ((oldpte & PG_V) == 0) {
			printf(" address %p not a valid page\n", dst);
			return;
		}

		tmppte = (oldpte & ~PG_RO) | PG_RW | PG_CI;
		*pte = tmppte;
		TBIS((vm_offset_t)odst);

		/*
		 * Page is now writable.  Do as much access as we
		 * can in this page.
		 */
		for (; limit > 0; limit--)
			*dst++ = *data++;

		/*
		 * Restore the old PTE.
		 */
		*pte = oldpte;
		TBIS((vm_offset_t)odst);
	} while (size != 0);

	/*
	 * Invalidate the instruction cache so our changes
	 * take effect.
	 */
	ICIA();
}

/*
 * Write bytes to kernel address space for debugger.
 */
extern char	kernel_text[], etext[];
void
db_write_bytes(addr, size, data)
	vm_offset_t	addr;
	size_t	size;
	char	*data;
{
	char	*dst = (char *)addr;

	/* If any part is in kernel text, use db_write_text() */
	if ((dst < etext) && ((dst + size) > kernel_text)) {
		db_write_text(addr, size, data);
		return;
	}

	if (size == 4) {
		*((int*)dst) = *((int*)data);
		return;
	}

	if (size == 2) {
		*((short*)dst) = *((short*)data);
		return;
	}

	while (size > 0) {
		--size;
		*dst++ = *data++;
	}
}


text:
<?php

namespace Heystack\Core\Storage\Backends\SilverStripeOrm;

use Heystack\Core\Exception\ConfigurationException;
use Heystack\Core\DataObjectGenerate\DataObjectGenerator;
use Heystack\Core\Identifier\Identifier;
use Heystack\Core\Identifier\IdentifierInterface;
use Heystack\Core\Storage\BackendInterface;
use Heystack\Core\Storage\Event;
use Heystack\Core\Storage\StorableInterface;
use Heystack\Core\DataObjectSchema\SchemaService;
use Heystack\Core\DataObjectSchema\SchemaInterface;
use Heystack\Core\Traits\HasEventServiceTrait;
use Heystack\Core\Traits\HasSchemaServiceTrait;
use Heystack\Core\Traits\HasGeneratorServiceTrait;
use Heystack\Core\EventDispatcher;

/**
 * Stores StorableInterfaces intro the SilverStripe database
 *
 * @package Heystack\Core\Storage\Backends\SilverStripeOrm
 * @author  Cam Spiers <cameron@heyday.co.nz>
 */
class Backend implements BackendInterface
{
    use HasEventServiceTrait;
    use HasSchemaServiceTrait;
    use HasGeneratorServiceTrait;

    /**
     * The identifier for this backend
     */
    const IDENTIFIER = 'silverstripe_orm';

    /**
     * @var \Heystack\Core\Storage\StorableInterface[]
     */
    private $referenceDataProviders = [];

    /**
     * @param \Heystack\Core\DataObjectGenerate\DataObjectGenerator $generatorService
     * @param \Heystack\Core\DataObjectSchema\SchemaService $schemaService
     * @param \Heystack\Core\EventDispatcher $eventService
     */
    public function __construct(
        DataObjectGenerator $generatorService,
        SchemaService $schemaService,
        EventDispatcher $eventService
    )
    {
        $this->generatorService = $generatorService;
        $this->schemaService = $schemaService;
        $this->eventService = $eventService;
    }

    /**
     * @param \Heystack\Core\Storage\StorableInterface $referenceDataProvider
     * @return void
     */
    public function addReferenceDataProvider(StorableInterface $referenceDataProvider)
    {
        $this->referenceDataProviders[$referenceDataProvider->getStorableIdentifier()] = $referenceDataProvider;
    }

    /**
     * @param \Heystack\Core\Identifier\IdentifierInterface $identifier
     * @return \Heystack\Core\Storage\StorableInterface
     */
    public function getReferenceDataProvider(IdentifierInterface $identifier)
    {
        return $this->referenceDataProviders[$identifier->getFull()];
    }

    /**
     * @param \Heystack\Core\Identifier\IdentifierInterface $referenceDataProviderIdentifier
     * @return bool
     */
    public function hasReferenceDataProvider(IdentifierInterface $referenceDataProviderIdentifier)
    {
        return isset($this->referenceDataProviders[$referenceDataProviderIdentifier->getFull()]);
    }

    /**
     * @return \Heystack\Core\Identifier\Identifier
     */
    public function getIdentifier()
    {
        return new Identifier(self::IDENTIFIER);
    }

    /**
     * @param  \Heystack\Core\Storage\StorableInterface $object
     * @return mixed
     * @throws \Heystack\Core\Exception\ConfigurationException
     */
    public function write(StorableInterface $object)
    {
        $schemaIdentifier = strtolower($object->getSchemaName());

        $storedObject = $this->writeStoredDataObject(
            $this->schemaService->getSchema($schemaIdentifier),
            $object
        );

        $this->eventService->dispatch(
            self::IDENTIFIER . '.' . $object->getStorableIdentifier() . '.stored',
            new Event($storedObject->ID)
        );

        return $storedObject;
    }

    /**
     * @param \Heystack\Core\DataObjectSchema\SchemaInterface $schema
     * @param \Heystack\Core\Storage\StorableInterface $object
     * @return mixed
     * @throws \Heystack\Core\Exception\ConfigurationException
     */
    protected function writeStoredDataObject(
        SchemaInterface $schema,
        StorableInterface $object
    )
    {
        $identifier = $schema->getIdentifier()->getFull();
        $saveable = sprintf('Stored%s', $identifier);
        $storedObject = \Injector::inst()->create($saveable);
        $writeableData = $object->getStorableData();

        foreach ($schema->getFlatStorage() as $key => $value) {

            $reference = $this->generatorService->isReference($value);

            if ($reference) {

                $referenceSchema = $this->schemaService->getSchema($reference);
                $referenceSchemaIdentifier = $referenceSchema->getIdentifier();

                if ($this->hasReferenceDataProvider($referenceSchemaIdentifier)) {

                    $referenceData = $this->getReferenceDataProvider($referenceSchemaIdentifier)->getStorableData();

                    foreach (array_keys($referenceSchema->getFlatStorage()) as $referenceKey) {

                        if (isset($referenceData['flat'][$referenceKey])) {

                            $storedObject->{$key . $referenceKey} = $referenceData['flat'][$referenceKey];

                        } else {

                            throw new ConfigurationException("No data found for key: $key on identifier: $reference");

                        }

                    }

                } else {

                    throw new ConfigurationException(
                        sprintf(
                            'Reference in flat schema didn\'t have an associated data provider for identifier `%s`' .
                            ' available identifiers are `%s`',
                            $referenceSchema->getIdentifier()->getFull(),
                            implode(', ', array_keys($this->referenceDataProviders))
                        )
                    );

                }

            } else {

                if (array_key_exists($key, $writeableData['flat'])) {
                    $value = $writeableData['flat'][$key];

                    $storedObject->$key = $value;

                    if (!is_null($value) && !is_scalar($value)) {
                        throw new ConfigurationException(
                            "Non-scalar value found for key: $key on identifier: " . $object->getStorableIdentifier()
                        );
                    }

                } else {

                    throw new ConfigurationException(
                        "No data found for key: $key on identifier: " . $object->getStorableIdentifier()
                    );

                }

            }

        }

        if (isset($writeableData['parent']) && isset($writeableData['flat']['ParentID'])) {
            $storedObject->ParentID = $writeableData['flat']['ParentID'];
        }

        $storedObject->write();

        return $storedObject;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package br.com.compdevbooks.alphacosmetics.entity.pessoa;

import br.com.compdevbooks.alphacosmetics.dao.mock.cadastro.MockClienteDAO;
import br.com.compdevbooks.alphacosmetics.dao.mock.endereco.MockCidadeDAO;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import br.com.compdevbooks.alphacosmetics.entity.endereco.CidadeEntity;

@Entity
@Table(name = "vendedor")
public class VendedorEntity extends PessoaFisicaEntity {

    @OneToMany(fetch = FetchType.LAZY)
    private Set<CidadeEntity> listaMunicipios;

    @OneToMany(fetch = FetchType.LAZY)
    private Set<ClienteEntity> listaClientes;

    public VendedorEntity() {
        this.listaMunicipios = new HashSet();
        this.listaClientes = new HashSet();
    }

    public VendedorEntity(long id, String nome, String CPF, String RG, Set<CidadeEntity>cidades, Set<ClienteEntity> clientes) {
        super(id, nome, CPF, RG);
        this.listaMunicipios = cidades;
        this.listaClientes = clientes;
    }

    public Set<CidadeEntity> getListaMunicipios() {
        return listaMunicipios;
    }

    public void setListaMunicipios(Set<CidadeEntity> listaMunicipios) {
        this.listaMunicipios = listaMunicipios;
    }

    public Set<ClienteEntity> getListaClientes() {
        return listaClientes;
    }

    public void setListaClientes(Set<ClienteEntity> listaClientes) {
        this.listaClientes = listaClientes;
    }

}


text:
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import permissions
from rest_framework.authtoken.models import Token

class AccessTokenPermission(permissions.BasePermission):
    """
    Custom permission to only allow owners of an object to edit it.
    """
    message = 'Access Token is required'

    def has_permission(self, request, view):
        # Read permissions are allowed to any request,
        # so we'll always allow GET, HEAD or OPTIONS requests.
        access_token = request.GET.get('access_token')
        if access_token:
            try:
                Token.objects.get(key=access_token)
            except ObjectDoesNotExist:
                return False
            return True
        return False


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class error_with_no_option_name</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../program_options/reference.html#header.boost.program_options.errors_hpp" title="Header <boost/program_options/errors.hpp>">
<link rel="prev" href="required_option.html" title="Class required_option">
<link rel="next" href="unknown_option.html" title="Class unknown_option">

Home
Libraries
People
FAQ
More

Class error_with_no_option_name

boost::program_options::error_with_no_option_name

Synopsis

// In header: <boost/program_options/errors.hpp>

class error_with_no_option_name :
  public boost::program_options::error_with_option_name
{
public:
  // construct/copy/destruct
  error_with_no_option_name(const std::string &, const std::string & = "");
  ~error_with_no_option_name();

  // public member functions
  void set_option_name(const std::string &);
};

Description

Base class of unparsable options, when the desired option cannot be identified.

It makes no sense to have an option name, when we can't match an option to the parameter

Having this a part of the error_with_option_name hierachy makes error handling a lot easier, even if the name indicates some sort of conceptual dissonance!

error_with_no_option_name
        public
       construct/copy/destruct

error_with_no_option_name(const std::string & template_,
                          const std::string & original_token = "");

~error_with_no_option_name();

error_with_no_option_name public member functions

void set_option_name(const std::string & option_name);

Does NOT set option name, because no option name makes sense

Copyright © 2002-2004 Vladimir Prus
Distributed under the Boost Software License, Version 1.0.
      (See accompanying file LICENSE_1_0.txt or copy at
      http://www.boost.org/LICENSE_1_0.txt)


text:
<?xml version="1.0"?>
<!--

-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
    <repository class="Mage\Catalog\Test\Repository\CatalogProductConfigurable\ConfigurableOptions">
        <dataset name="default">
                <field name="attributeSet" xsi:type="array">
                    <item name="dataset" xsi:type="string">custom_attribute_set</item>
                </field>
                <field name="attributes_data" xsi:type="array">
                    <item name="attribute_key_0" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">12</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">20</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">18</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                        </item>
                    </item>
                    <item name="attribute_key_1" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">42.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">40.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">48.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                        </item>
                    </item>
                </field>
                <field name="products" xsi:type="array">
                    <item name="attribute_key_0:option_key_0 attribute_key_1:option_key_0" xsi:type="string">catalogProductSimple::default</item>
                    <item name="attribute_key_0:option_key_1 attribute_key_1:option_key_1" xsi:type="string">catalogProductSimple::default</item>
                    <item name="attribute_key_0:option_key_2 attribute_key_1:option_key_2" xsi:type="string">catalogProductSimple::default</item>
                </field>
        </dataset>

        <dataset name="with_filterable_options">
                <field name="attributeSet" xsi:type="array">
                    <item name="dataset" xsi:type="string">with_filterable_options</item>
                </field>
                <field name="attributes_data" xsi:type="array">
                    <item name="attribute_key_0" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">12</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">20</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">18</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                        </item>
                    </item>
                    <item name="attribute_key_1" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">42.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">40.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">48.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                        </item>
                    </item>
                </field>
                <field name="products" xsi:type="array">
                    <item name="attribute_key_0:option_key_0 attribute_key_1:option_key_0" xsi:type="string">catalogProductSimple::default</item>
                    <item name="attribute_key_0:option_key_1 attribute_key_1:option_key_1" xsi:type="string">catalogProductSimple::default</item>
                    <item name="attribute_key_0:option_key_2 attribute_key_1:option_key_2" xsi:type="string">catalogProductSimple::default</item>
                </field>
        </dataset>

        <dataset name="quickCreation">
                <field name="attributes_data" xsi:type="array">
                    <item name="attribute_key_0" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">121.00</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                        </item>
                    </item>
                    <item name="attribute_key_1" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">412.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                        </item>
                    </item>
                </field>
                <field name="products" xsi:type="array">
                    <item name="attribute_key_0:option_key_0 attribute_key_1:option_key_0" xsi:type="string">catalogProductSimple::quickCreation</item>
                </field>
        </dataset>

        <dataset name="createEmpty">
                <field name="attributes_data" xsi:type="array">
                    <item name="attribute_key_0" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">11.00</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                        </item>
                    </item>
                    <item name="attribute_key_1" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">76.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                        </item>
                    </item>
                </field>
                <field name="products" xsi:type="array">
                    <item name="attribute_key_0:option_key_1 attribute_key_1:option_key_1" xsi:type="string">catalogProductSimple::withoutPersist</item>
                </field>
        </dataset>

        <dataset name="copyFromConfigurable">
                <field name="attributes_data" xsi:type="array">
                    <item name="attribute_key_0" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">33.00</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                        </item>
                    </item>
                    <item name="attribute_key_1" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">62.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                        </item>
                    </item>
                </field>
                <field name="products" xsi:type="array">
                    <item name="attribute_key_0:option_key_2 attribute_key_1:option_key_2" xsi:type="string">catalogProductSimple::withoutPersist</item>
                </field>
        </dataset>

        <dataset name="with_out_of_stock_items">
                <field name="attributeSet" xsi:type="array">
                    <item name="dataset" xsi:type="string">custom_attribute_set</item>
                </field>
                <field name="attributes_data" xsi:type="array">
                    <item name="attribute_key_0" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">12</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">20</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">18</item>
                                <item name="price_type" xsi:type="string">Percentage</item>
                            </item>
                        </item>
                    </item>
                    <item name="attribute_key_1" xsi:type="array">
                        <item name="options" xsi:type="array">
                            <item name="option_key_0" xsi:type="array">
                                <item name="price" xsi:type="string">42.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                            <item name="option_key_1" xsi:type="array">
                                <item name="price" xsi:type="string">40.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                            <item name="option_key_2" xsi:type="array">
                                <item name="price" xsi:type="string">48.00</item>
                                <item name="price_type" xsi:type="string">Fixed</item>
                            </item>
                        </item>
                    </item>
                </field>
                <field name="products" xsi:type="array">
                    <item name="attribute_key_0:option_key_0 attribute_key_1:option_key_0" xsi:type="string">catalogProductSimple::out_of_stock</item>
                    <item name="attribute_key_0:option_key_1 attribute_key_1:option_key_1" xsi:type="string">catalogProductSimple::out_of_stock</item>
                    <item name="attribute_key_0:option_key_2 attribute_key_1:option_key_2" xsi:type="string">catalogProductSimple::out_of_stock</item>
                </field>
        </dataset>
    </repository>
</config>


text:
package org.apache.deltaspike.test.core.impl.future;

import org.apache.deltaspike.core.api.config.ConfigResolver;
import org.apache.deltaspike.core.impl.config.PropertiesConfigSource;
import org.apache.deltaspike.core.impl.future.ThreadPoolManager;
import org.apache.deltaspike.core.impl.scope.conversation.ConversationBeanHolder;
import org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessBeanAccessHistory;
import org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessBeanHolder;
import org.apache.deltaspike.core.impl.scope.viewaccess.ViewAccessViewHistory;
import org.apache.deltaspike.core.impl.scope.window.DefaultWindowContextQuotaHandler;
import org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder;
import org.apache.deltaspike.core.impl.scope.window.WindowContextProducer;
import org.apache.deltaspike.core.impl.scope.window.WindowContextQuotaHandlerCache;
import org.apache.deltaspike.core.impl.scope.window.WindowIdHolder;
import org.apache.deltaspike.core.spi.config.ConfigSource;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.inject.Inject;

import java.util.Collections;
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;

import org.apache.deltaspike.test.util.ArchiveUtils;

@RunWith(Arquillian.class)
public class ThreadPoolManagerTest
{
    @Deployment
    public static WebArchive deploy()
    {
        return ShrinkWrap.create(WebArchive.class, "ThreadPoolManagerTest.war")
                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    }

    @Inject
    private ThreadPoolManager manager;

    @Test
    public void defaultPool() throws ExecutionException, InterruptedException
    {
        final ExecutorService auto = manager.find("auto");
        assertEquals(auto, auto);
        assertSame(auto, auto);
        assertEquals(Runtime.getRuntime().availableProcessors(), ThreadPoolExecutor.class.cast(auto).getCorePoolSize());
        assertUsable(auto);
    }

    @Test // this test validates we read the config properly but also it is lazy
    public void configuredPool() throws ExecutionException, InterruptedException
    {
        ConfigResolver.addConfigSources(Collections.<ConfigSource>singletonList(new PropertiesConfigSource(new Properties()
        {{
            setProperty("futurable.pool.custom.coreSize", "5");
        }})
        {
            @Override
            public String getConfigName()
            {
                return "configuredPool";
            }
        }));
        final ExecutorService custom = manager.find("custom");
        assertEquals(custom, custom);
        assertSame(custom, custom);
        assertEquals(5, ThreadPoolExecutor.class.cast(custom).getCorePoolSize());
        assertUsable(custom);
    }

    private void assertUsable(final ExecutorService pool) throws InterruptedException, ExecutionException
    {
        assertEquals("ok", pool.submit(new Callable<String>()
        {
            @Override
            public String call() throws Exception
            {
                return "ok";
            }
        }).get());
    }
}


text:
package org.hugonikanor.imageStitcher.graphics;

import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Frame extends JFrame {
	private static final long serialVersionUID = 3869935805178282387L;

	public Frame( BufferedImage stitchedImage, ActionListener al ) {
		super( "ImageStitcher preview" );
		try {
			UIManager.setLookAndFeel(
					UIManager.getCrossPlatformLookAndFeelClassName());
		} catch( ClassNotFoundException e ) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}

		this.getContentPane().add(
				new JScrollPane(new JLabel(
						new ImageIcon(stitchedImage))),
						BorderLayout.CENTER);

		JPanel confirmPane = new JPanel();
		confirmPane.setLayout( new java.awt.FlowLayout() );

		JButton closeBtn = new JButton("Cancel");
		closeBtn.addActionListener( (e) -> {
			System.exit( 0 );
		});
		confirmPane.add( closeBtn );

		JButton saveBtn = new JButton("Save");
		saveBtn.addActionListener( al );
		confirmPane.add( saveBtn );

		this.getContentPane().add( confirmPane, BorderLayout.SOUTH );

		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.pack();
		this.setVisible(true);
	}
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.wrmsr.wava.java.lang.tree.expression;

import com.google.common.collect.ImmutableList;
import com.wrmsr.wava.java.lang.JTypeSpecifier;

import javax.annotation.concurrent.Immutable;

import java.util.List;
import java.util.Objects;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

@Immutable
public final class JNewArray
        extends JExpression
{
    private final JTypeSpecifier type;
    private final Optional<List<JExpression>> items;

    public JNewArray(JTypeSpecifier type, Optional<List<JExpression>> items)
    {
        this.type = requireNonNull(type);
        this.items = requireNonNull(items).map(ImmutableList::copyOf);
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        JNewArray jNewArray = (JNewArray) o;
        return Objects.equals(type, jNewArray.type) &&
                Objects.equals(items, jNewArray.items);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(type, items);
    }

    public JTypeSpecifier getType()
    {
        return type;
    }

    public Optional<List<JExpression>> getItems()
    {
        return items;
    }

    @Override
    public <C, R> R accept(JExpressionVisitor<C, R> visitor, C context)
    {
        return visitor.visitJNewArray(this, context);
    }
}


text:
SpecBegin(NAMapView)

describe(@"init", ^{

    __block NAMapView *mapView = nil;

    beforeEach(^{
        mapView = [[NAMapView alloc] init];
    });

    it(@"creates an instance", ^{
        expect(mapView).toNot.beNil();
        expect(mapView).to.beKindOf([NAMapView class]);
    });

    it(@"asserts on zoomRelativePoint: with a zero content size", ^{
        expect(^{[mapView zoomRelativePoint:CGPointZero];}).to.raise(@"NSInternalInconsistencyException");
    });
});

SpecEnd


text:
import * as THREE from "three";

import {Camera} from "../Geo";
import {RenderMode} from "../Render";

export class RenderCamera {
    public alpha: number;
    public zoom: number;
    public currentAspect: number;
    public currentPano: boolean;
    public previousAspect: number;
    public previousPano: boolean;
    public renderMode: RenderMode;

    private _camera: Camera;
    private _perspective: THREE.PerspectiveCamera;

    private _frameId: number;

    private _changed: boolean;
    private _changedForFrame: number;

    constructor(perspectiveCameraAspect: number, renderMode: RenderMode) {
        this.alpha = -1;
        this.zoom = 0;

        this._frameId = -1;

        this._changed = false;
        this._changedForFrame = -1;

        this.currentAspect = 1;
        this.currentPano = false;
        this.previousAspect = 1;
        this.previousPano = false;

        this.renderMode = renderMode;

        this._camera = new Camera();
        this._perspective = new THREE.PerspectiveCamera(
            50,
            perspectiveCameraAspect,
            0.4,
            10000);
    }

    public get perspective(): THREE.PerspectiveCamera {
        return this._perspective;
    }

    public get camera(): Camera {
        return this._camera;
    }

    public get changed(): boolean {
        return this.frameId === this._changedForFrame;
    }

    public get frameId(): number {
        return this._frameId;
    }

    public set frameId(value: number) {
        this._frameId = value;

        if (this._changed) {
            this._changed = false;
            this._changedForFrame = value;
        }
    }

    public updateProjection(): void {
        let currentAspect: number = this._getAspect(
            this.currentAspect,
            this.currentPano,
            this.perspective.aspect);

        let previousAspect: number = this._getAspect(
            this.previousAspect,
            this.previousPano,
            this.perspective.aspect);

        let aspect: number = (1 - this.alpha) * previousAspect + this.alpha * currentAspect;

        let verticalFov: number = this._getVerticalFov(aspect, this._camera.focal, this.zoom);

        this._perspective.fov = verticalFov;
        this._perspective.updateProjectionMatrix();

        this._changed = true;
    }

    public updatePerspective(camera: Camera): void {
        this._perspective.up.copy(camera.up);
        this._perspective.position.copy(camera.position);
        this._perspective.lookAt(camera.lookat);

        this._changed = true;
    }

    private _getVerticalFov(aspect: number, focal: number, zoom: number): number {
        return 2 * Math.atan(0.5 / (Math.pow(2, zoom) * aspect * focal)) * 180 / Math.PI;
    }

    private _getAspect(
        nodeAspect: number,
        pano: boolean,
        perspectiveCameraAspect: number): number {

        if (pano) {
            return 1;
        }

        let coeff: number = Math.max(1, 1 / nodeAspect);

        let usePerspective: boolean = this.renderMode === RenderMode.Letterbox ?
            nodeAspect > perspectiveCameraAspect :
            nodeAspect < perspectiveCameraAspect;

        let aspect: number = usePerspective ?
            coeff * perspectiveCameraAspect :
            coeff * nodeAspect;

        return aspect;
    }
}

export default RenderCamera;


text:
function formatDate(date){
  var dd = ("0" + date.getDate()).slice(-2),
      mm = ("0" + (date.getMonth() + 1)).slice(-2),
      yyyy = date.getFullYear();

  return (yyyy + '-' + mm + '-' + dd);
}

function splitDate(date){
  var dateIsNegative = false;

  if(date[0] === '-') {
    date = date.replace('-', '');
    dateIsNegative = true;
  }

  var dateNums = date.split('-');

  if(dateIsNegative){ dateNums[0] = '-' + dateNums[0]; }

  return dateNums;
}

function changeDateYear(date, amount){
  if(typeof date === 'string') { date = new Date(date) }

  date.setFullYear(date.getFullYear() + amount);
  return formatDate(date);
}

function differenceInYearsBetween(today, pastDate){
  var todayNums = splitDate(today),
    pastDateNums = splitDate(pastDate),
    difference;

  today = moment([todayNums[0], parseInt(todayNums[1], 10) - 1, todayNums[2]]);
  pastDate = moment([pastDateNums[0], parseInt(pastDateNums[1], 10) - 1, pastDateNums[2]]);
  difference = moment.range(pastDate, today).diff('years');

  if(pastDate.year() < 0 && today.year() > 0) { difference--; }

  return difference;
}


text:
class SshToggle : public ToggleControl {
  Q_OBJECT

public:
  SshToggle() : ToggleControl(tr("Enable SSH"), "", "", Hardware::get_ssh_enabled()) {
    QObject::connect(this, &SshToggle::toggleFlipped, [=](bool state) {
      Hardware::set_ssh_enabled(state);
    });
  }
};

// SSH key management widget
class SshControl : public ButtonControl {
  Q_OBJECT

public:
  SshControl();

private:
  Params params;

  void refresh();
  void getUserKeys(const QString &username);
};


text:
// This code is auto-generated, do not modify
using Ds3.Models;
using System;
using System.Net;

namespace Ds3.Calls
{
    public class AbortMultiPartUploadRequest : Ds3Request
    {

        public string BucketName { get; private set; }

        public string ObjectName { get; private set; }

        public string UploadId { get; private set; }

        public AbortMultiPartUploadRequest(string bucketName, string objectName, Guid uploadId)
        {
            this.BucketName = bucketName;
            this.ObjectName = objectName;
            this.UploadId = uploadId.ToString();

            this.QueryParams.Add("upload_id", uploadId.ToString());

        }

        public AbortMultiPartUploadRequest(string bucketName, string objectName, string uploadId)
        {
            this.BucketName = bucketName;
            this.ObjectName = objectName;
            this.UploadId = uploadId;

            this.QueryParams.Add("upload_id", uploadId);

        }

        internal override HttpVerb Verb
        {
            get
            {
                return HttpVerb.DELETE;
            }
        }

        internal override string Path
        {
            get
            {
                return "/" + BucketName + "/" + ObjectName;
            }
        }
    }
}


text:
<!doctype html>
<meta charset="utf-8">
<title>Reference: 'font-synthesis:none' with a font that support small-caps</title>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">

Test passes if there are four check marks (✓), and zero crosses (✗).

CCC C


text:
    #pragma implementation "prefs.h"
#endif

//----------------------------------------------------------------------------------------
// Standard wxWindows headers
//----------------------------------------------------------------------------------------

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

// For all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers)
#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

//----------------------------------------------------------------------------------------
// Header of this .cpp file
//----------------------------------------------------------------------------------------
#include "prefs.h"

//----------------------------------------------------------------------------------------
// Remaining headers
// ---------------------------------------------------------------------------------------

#include "app.h"
#include "frame.h"
#include "main.h"
#include "calls.h"

//----------------------------------------------------------------------------------------
// Event table: connect the events to the handler functions to process them
//----------------------------------------------------------------------------------------
BEGIN_EVENT_TABLE(PrefsDialog, wxDialog)
    EVT_BUTTON  ( XRCID("BrowseRingTone"),   PrefsDialog::OnBrowse)
    EVT_BUTTON  ( XRCID("BrowseIntercom"),   PrefsDialog::OnBrowse)
    EVT_BUTTON  ( XRCID("BrowseRingBack"),   PrefsDialog::OnBrowse)
    EVT_BUTTON  ( XRCID("PreviewRingTone"),  PrefsDialog::OnPreviewRingTone)
    EVT_BUTTON  ( XRCID("PreviewIntercom"),  PrefsDialog::OnPreviewIntercom)
    EVT_BUTTON  ( XRCID("PreviewRingBack"),  PrefsDialog::OnPreviewRingBack)
    EVT_TEXT    ( XRCID("RingBack"),         PrefsDialog::OnAudioDirty)
    EVT_TEXT    ( XRCID("RingTone"),         PrefsDialog::OnAudioDirty)
    EVT_TEXT    ( XRCID("Intercom"),         PrefsDialog::OnAudioDirty)
    EVT_BUTTON  ( XRCID("SaveAudio"),        PrefsDialog::OnSaveAudio)
    EVT_BUTTON  ( XRCID("ApplyAudio"),       PrefsDialog::OnApplyAudio)
	EVT_BUTTON  ( XRCID("CancelAudio"),      PrefsDialog::OnCancel)

    EVT_BUTTON  ( XRCID("SaveCallerID"),     PrefsDialog::OnSaveCallerID)
    EVT_BUTTON  ( XRCID("ApplyCallerID"),    PrefsDialog::OnApplyCallerID)
	EVT_BUTTON  ( XRCID("CancelCallerID"),   PrefsDialog::OnCancel)
    EVT_TEXT    ( XRCID("Name"),             PrefsDialog::OnCallerIDDirty)
    EVT_TEXT    ( XRCID("Number"),           PrefsDialog::OnCallerIDDirty)

    EVT_BUTTON  ( XRCID("SaveMisc"),         PrefsDialog::OnSaveMisc)
    EVT_BUTTON  ( XRCID("ApplyMisc"),        PrefsDialog::OnApplyMisc)
	EVT_BUTTON  ( XRCID("CancelMisc"),       PrefsDialog::OnCancel)
    EVT_TEXT    ( XRCID("UseSkin"),          PrefsDialog::OnMiscDirty)
    EVT_CHOICE  ( XRCID("DefaultAccount"),   PrefsDialog::OnMiscDirty)
    EVT_TEXT    ( XRCID("IntercomPass"),     PrefsDialog::OnMiscDirty)
	EVT_TEXT    ( XRCID("HelpURL"),          PrefsDialog::OnMiscDirty)
    EVT_SPINCTRL( XRCID("nCalls"),           PrefsDialog::OnMiscDirtySpinEvent)
	EVT_SPINCTRL( XRCID("DebugLevel"),       PrefsDialog::OnMiscDirtySpinEvent)

    EVT_BUTTON  ( XRCID("SaveFilters"),      PrefsDialog::OnSaveFilters)
    EVT_BUTTON  ( XRCID("ApplyFilters"),     PrefsDialog::OnApplyFilters)
	EVT_BUTTON  ( XRCID("CancelFilters"),    PrefsDialog::OnCancel)
    EVT_CHECKBOX( XRCID("AGC"),              PrefsDialog::OnFiltersDirty)
    EVT_CHECKBOX( XRCID("AAGC"),             PrefsDialog::OnFiltersDirty)
    EVT_CHECKBOX( XRCID("CN"),               PrefsDialog::OnFiltersDirty)
    EVT_CHECKBOX( XRCID("NoiseReduce"),      PrefsDialog::OnFiltersDirty)
    EVT_CHECKBOX( XRCID("EchoCancel"),       PrefsDialog::OnFiltersDirty)

    EVT_BUTTON  ( XRCID("SaveCodecs"),       PrefsDialog::OnSaveCodecs)
    EVT_BUTTON  ( XRCID("ApplyCodecs"),      PrefsDialog::OnApplyCodecs)
	EVT_BUTTON  ( XRCID("CancelCodecs"),     PrefsDialog::OnCancel)

    EVT_CHECKBOX( XRCID("AllowuLaw"),        PrefsDialog::OnCodecAllow)
    EVT_CHECKBOX( XRCID("AllowaLaw"),        PrefsDialog::OnCodecAllow)
    EVT_CHECKBOX( XRCID("AllowGSM"),         PrefsDialog::OnCodecAllow)
    EVT_CHECKBOX( XRCID("AllowSpeex"),       PrefsDialog::OnCodecAllow)
    EVT_CHECKBOX( XRCID("AllowiLBC"),        PrefsDialog::OnCodecAllow)

    EVT_RADIOBUTTON(XRCID("PreferuLaw"),     PrefsDialog::OnCodecPrefer)
    EVT_RADIOBUTTON(XRCID("PreferaLaw"),     PrefsDialog::OnCodecPrefer)
    EVT_RADIOBUTTON(XRCID("PreferGSM"),      PrefsDialog::OnCodecPrefer)
    EVT_RADIOBUTTON(XRCID("PreferSpeex"),    PrefsDialog::OnCodecPrefer)
    EVT_RADIOBUTTON(XRCID("PreferiLBC"),     PrefsDialog::OnCodecPrefer)

    EVT_CHECKBOX( XRCID("SPXTune"),          PrefsDialog::OnSpeexTune)
    EVT_CHECKBOX( XRCID("SPXEnhance"),       PrefsDialog::OnSpeexTune)
    EVT_SPINCTRL( XRCID("SPXQuality"),       PrefsDialog::OnSpeexTuneSpinEvent)
    EVT_SPINCTRL( XRCID("SPXBitrate"),       PrefsDialog::OnSpeexTuneSpinEvent)
    EVT_SPINCTRL( XRCID("SPXABR"),           PrefsDialog::OnSpeexTuneSpinEvent)
    EVT_CHECKBOX( XRCID("SPXVBR"),           PrefsDialog::OnSpeexTune)
    EVT_SPINCTRL( XRCID("SPXComplexity"),    PrefsDialog::OnSpeexTuneSpinEvent)

	EVT_SPINCTRL( XRCID("IaxPttType"),       PrefsDialog::OnIax2DirtySpinEvent)
	EVT_SPINCTRL( XRCID("Iax2Port"),         PrefsDialog::OnIax2DirtySpinEvent)
	EVT_BUTTON  ( XRCID("SaveIax2"),       	 PrefsDialog::OnSaveIax2)
	EVT_BUTTON  ( XRCID("CancelIax2"),     	 PrefsDialog::OnCancel)

	EVT_TEXT    ( XRCID("StartupLinks"),     PrefsDialog::OnLinksDirty)
	EVT_TEXT    ( XRCID("PermaLinks"),       PrefsDialog::OnLinksDirty)
	EVT_BUTTON  ( XRCID("SaveLinks"),        PrefsDialog::OnSaveLinks)
	EVT_BUTTON  ( XRCID("CancelLinks"),      PrefsDialog::OnCancel)

END_EVENT_TABLE()

//----------------------------------------------------------------------------------------
// Public methods
//----------------------------------------------------------------------------------------

PrefsDialog::PrefsDialog(wxWindow* parent)
{
    wxConfig *config = theApp::getConfig();
    long      dummy;
    bool      bCont;
    wxString  str;

    wxXmlResource::Get()->LoadDialog(this, parent, wxT("Prefs"));

    // Reach in for our controls

    RingBack       = XRCCTRL(*this, "RingBack",       wxTextCtrl);
    RingTone       = XRCCTRL(*this, "RingTone",       wxTextCtrl);
    Intercom       = XRCCTRL(*this, "Intercom",       wxTextCtrl);
    SaveAudio      = XRCCTRL(*this, "SaveAudio",      wxButton);
    ApplyAudio     = XRCCTRL(*this, "ApplyAudio",     wxButton);
    CancelAudio    = XRCCTRL(*this, "CancelAudio",    wxButton);

    Name           = XRCCTRL(*this, "Name",           wxTextCtrl);
    Number         = XRCCTRL(*this, "Number",         wxTextCtrl);
    SaveCallerID   = XRCCTRL(*this, "SaveCallerID",   wxButton);
    ApplyCallerID  = XRCCTRL(*this, "ApplyCallerID",  wxButton);
    CancelCallerID = XRCCTRL(*this, "CancelCallerID", wxButton);

    UseSkin        = XRCCTRL(*this, "UseSkin",        wxComboBox);
    DefaultAccount = XRCCTRL(*this, "DefaultAccount", wxChoice);
    IntercomPass   = XRCCTRL(*this, "IntercomPass",   wxTextCtrl);
	HelpURL        = XRCCTRL(*this, "HelpURL",        wxTextCtrl);
    nCalls         = XRCCTRL(*this, "nCalls",         wxSpinCtrl);
	DebugLevel     = XRCCTRL(*this, "DebugLevel",     wxSpinCtrl);
    SaveMisc       = XRCCTRL(*this, "SaveMisc",       wxButton);
    ApplyMisc      = XRCCTRL(*this, "ApplyMisc",      wxButton);
    CancelMisc     = XRCCTRL(*this, "CancelMisc",     wxButton);

    AGC            = XRCCTRL(*this, "AGC",            wxCheckBox);
    AAGC           = XRCCTRL(*this, "AAGC",           wxCheckBox);
    CN             = XRCCTRL(*this, "CN",             wxCheckBox);
    NoiseReduce    = XRCCTRL(*this, "NoiseReduce",    wxCheckBox);
    EchoCancel     = XRCCTRL(*this, "EchoCancel",     wxCheckBox);
    SaveFilters    = XRCCTRL(*this, "SaveFilters",    wxButton);
    ApplyFilters   = XRCCTRL(*this, "ApplyFilters",   wxButton);
    CancelFilters  = XRCCTRL(*this, "CancelFilters",  wxButton);

    AllowuLaw      = XRCCTRL(*this, "AllowuLaw",      wxCheckBox);
    AllowaLaw      = XRCCTRL(*this, "AllowaLaw",      wxCheckBox);
    AllowGSM       = XRCCTRL(*this, "AllowGSM",       wxCheckBox);
    AllowSpeex     = XRCCTRL(*this, "AllowSpeex",     wxCheckBox);
    AllowiLBC      = XRCCTRL(*this, "AllowiLBC",      wxCheckBox);

    PreferuLaw     = XRCCTRL(*this, "PreferuLaw",     wxRadioButton);
    PreferaLaw     = XRCCTRL(*this, "PreferaLaw",     wxRadioButton);
    PreferGSM      = XRCCTRL(*this, "PreferGSM",      wxRadioButton);
    PreferSpeex    = XRCCTRL(*this, "PreferSpeex",    wxRadioButton);
    PreferiLBC     = XRCCTRL(*this, "PreferiLBC",     wxRadioButton);

    SPXTune        = XRCCTRL(*this, "SPXTune",        wxCheckBox);
    SPXEnhance     = XRCCTRL(*this, "SPXEnhance",     wxCheckBox);
    SPXQuality     = XRCCTRL(*this, "SPXQuality",     wxSpinCtrl);
    SPXBitrate     = XRCCTRL(*this, "SPXBitrate",     wxSpinCtrl);
    SPXABR         = XRCCTRL(*this, "SPXABR",         wxSpinCtrl);
    SPXVBR         = XRCCTRL(*this, "SPXVBR",         wxCheckBox);
    SPXComplexity  = XRCCTRL(*this, "SPXComplexity",  wxSpinCtrl);

    SaveCodecs     = XRCCTRL(*this, "SaveCodecs",     wxButton);
    ApplyCodecs    = XRCCTRL(*this, "ApplyCodecs",    wxButton);
    CancelCodecs   = XRCCTRL(*this, "CancelCodecs",   wxButton);

	IaxPttType	   = XRCCTRL(*this, "IaxPttType",     wxSpinCtrl);
	Iax2Port	   = XRCCTRL(*this, "Iax2Port",       wxSpinCtrl);
    SaveIax2       = XRCCTRL(*this, "SaveIax2",       wxButton);
    CancelIax2     = XRCCTRL(*this, "CancelIax2",     wxButton);

	StartupLinks   = XRCCTRL(*this, "StartupLinks",   wxTextCtrl);
	PermaLinks	   = XRCCTRL(*this, "PermaLinks",     wxTextCtrl);
    SaveLinks      = XRCCTRL(*this, "SaveLinks",       wxButton);
    CancelLinks    = XRCCTRL(*this, "CancelLinks",     wxButton);

    config->SetPath(_T("/Prefs"));

	StartupLinks->SetValue(config->Read(_T("/Prefs/StartupLinks"), _T("")));
	PermaLinks->SetValue(config->Read(_T("/Prefs/PermaLinks"), _T("")));
	PermaLinks->Disable();

    RingTone->SetValue(wxGetApp().IncomingRingName);
    RingBack->SetValue(wxGetApp().RingBackToneName);
    Intercom->SetValue(wxGetApp().IntercomToneName);

    Name->SetValue(wxGetApp().Name);
    Number->SetValue(wxGetApp().Number);

    UseSkin->Append(_T("default"));
    UseSkin->Append(_T("compact"));
    UseSkin->Append(_T("logo"));
    UseSkin->Append(_T("micro"));
    UseSkin->SetValue(config->Read(_T("UseSkin"), _T("default")));

    config->SetPath(_T("/Prefs"));
	Iax2Port->SetValue(config->Read(_T("Iax2Port"), 4569l));
	IaxPttType->SetValue(config->Read(_T("IaxPttType"), 0l));

    config->SetPath(_T("/Accounts"));
    bCont = config->GetFirstGroup(str, dummy);
    while ( bCont ) {
        DefaultAccount->Append(str);
        bCont = config->GetNextGroup(str, dummy);
    }
    dummy = DefaultAccount->FindString(config->Read(_T("/Prefs/DefaultAccount"), _T("")));
    if(dummy <= 0)
        dummy = 0;
    DefaultAccount->SetSelection(dummy);

    IntercomPass->SetValue(config->Read(_T("/Prefs/IntercomPass"), _T("")));
	HelpURL->SetValue(config->Read(_T("/Prefs/HelpURL"), _T("")));
    nCalls->SetValue(wxGetApp().nCalls);

	DebugLevel->SetValue(wxGetApp().theFrame->DebugLevel);

    AGC->SetValue(wxGetApp().theFrame->AGC);
    AAGC->SetValue(wxGetApp().theFrame->AAGC);
    CN->SetValue(wxGetApp().theFrame->CN);
    NoiseReduce->SetValue(wxGetApp().theFrame->NoiseReduce);
    EchoCancel->SetValue(wxGetApp().theFrame->EchoCancel);

    AllowuLaw->SetValue( wxGetApp().theFrame->AllowuLawVal);
    AllowaLaw->SetValue( wxGetApp().theFrame->AllowaLawVal);
    AllowGSM->SetValue(  wxGetApp().theFrame->AllowGSMVal);
    AllowSpeex->SetValue(wxGetApp().theFrame->AllowSpeexVal);
    AllowiLBC->SetValue( wxGetApp().theFrame->AllowiLBCVal);

    // Our local copy, because we may play with it and not Apply it
    LocalPreferredBitmap = wxGetApp().theFrame->PreferredBitmap;

    if(LocalPreferredBitmap == IAXC_FORMAT_ILBC)
        PreferiLBC->SetValue(TRUE);

    if(LocalPreferredBitmap == IAXC_FORMAT_SPEEX)
        PreferSpeex->SetValue(TRUE);

    if(LocalPreferredBitmap == IAXC_FORMAT_GSM)
        PreferGSM->SetValue(TRUE);

    if(LocalPreferredBitmap == IAXC_FORMAT_ALAW)
        PreferaLaw->SetValue(TRUE);

    if(LocalPreferredBitmap == IAXC_FORMAT_ULAW)
        PreferuLaw->SetValue(TRUE);

    // XRCed won't let us set minimum less than 0
    SPXQuality->SetRange(-1,10);
    SPXBitrate->SetRange(-1,32);

    SPXTune->SetValue(       wxGetApp().theFrame->SPXTuneVal);
    SPXEnhance->SetValue(    wxGetApp().theFrame->SPXEnhanceVal);
    SPXQuality->SetValue(    wxGetApp().theFrame->SPXQualityVal);
    SPXBitrate->SetValue(    wxGetApp().theFrame->SPXBitrateVal);
    SPXABR->SetValue(        wxGetApp().theFrame->SPXABRVal);
    SPXVBR->SetValue(        wxGetApp().theFrame->SPXVBRVal);
    SPXComplexity->SetValue( wxGetApp().theFrame->SPXComplexityVal);

    if(wxGetApp().theFrame->SPXTuneVal) {
        SPXEnhance->Enable();
        SPXQuality->Enable();
        SPXBitrate->Enable();
        SPXABR->Enable();
        SPXVBR->Enable();
        SPXComplexity->Enable();
    } else {
        SPXEnhance->Disable();
        SPXQuality->Disable();
        SPXBitrate->Disable();
        SPXABR->Disable();
        SPXVBR->Disable();
        SPXComplexity->Disable();
    }

    delete config;

    //Populating wxTextCtrls makes EVT_TEXT, just as if user did it

    SaveAudio->Disable();
    ApplyAudio->Disable();
    CancelAudio->SetLabel(_T("Done"));

    SaveCallerID->Disable();
    ApplyCallerID->Disable();
    CancelCallerID->SetLabel(_T("Done"));

    SaveMisc->Disable();
    ApplyMisc->Disable();
    CancelMisc->SetLabel(_T("Done"));
}

//----------------------------------------------------------------------------------------
// Private methods
//----------------------------------------------------------------------------------------

void PrefsDialog::OnPreviewRingTone(wxCommandEvent &event)
{
    // We only want to preview a single ring
    wxGetApp().IncomingRing.LoadTone(RingTone->GetValue(), 0);
    wxGetApp().IncomingRing.Start(1);
    wxGetApp().IncomingRing.LoadTone(RingTone->GetValue(), 10);
}

void PrefsDialog::OnPreviewRingBack(wxCommandEvent &event)
{
    wxGetApp().RingbackTone.LoadTone(RingBack->GetValue(), 0);
    wxGetApp().RingbackTone.Start(1);
    wxGetApp().RingbackTone.LoadTone(RingBack->GetValue(), 10);
}

void PrefsDialog::OnPreviewIntercom(wxCommandEvent &event)
{
    wxGetApp().IntercomTone.LoadTone(Intercom->GetValue(), 0);
    wxGetApp().IntercomTone.Start(1);
    wxGetApp().IntercomTone.LoadTone(Intercom->GetValue(), 1);
}

void PrefsDialog::OnBrowse(wxCommandEvent &event)
{
    wxString dirHome;
    wxGetHomeDir(&dirHome);

    wxFileDialog where(NULL, _("Raw sound file"), dirHome, _T(""), _T("*.*"), wxOPEN );
    where.ShowModal();

    if(event.GetId() == XRCID("BrowseRingBack"))
        RingBack->SetValue(where.GetPath());

    if(event.GetId() == XRCID("BrowseRingTone"))
        RingTone->SetValue(where.GetPath());

    if(event.GetId() == XRCID("BrowseIntercom"))
        Intercom->SetValue(where.GetPath());

}

void SetCallerID(wxString name, wxString number)
{
    iaxc_set_callerid((char *) name.c_str(),
                      (char *) number.c_str());
}

void PrefsDialog::OnSaveAudio(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Prefs"));

    config->Write(_T("RingTone"),   RingTone->GetValue());
    config->Write(_T("RingBack"),   RingBack->GetValue());
    config->Write(_T("Intercom"),   Intercom->GetValue());

    delete config;
    SaveAudio->Disable();
    OnApplyAudio(event);
}

void PrefsDialog::OnApplyAudio(wxCommandEvent &event)
{
    wxGetApp().IncomingRingName = RingTone->GetValue();
    wxGetApp().RingBackToneName = RingBack->GetValue();
    wxGetApp().IntercomToneName = Intercom->GetValue();

    wxGetApp().IncomingRing.LoadTone(RingTone->GetValue(), 10);
    wxGetApp().RingbackTone.LoadTone(RingBack->GetValue(), 10);
    wxGetApp().IntercomTone.LoadTone(Intercom->GetValue(),  1);

    ApplyAudio->Disable();
    CancelAudio->SetLabel(_T("Done"));
}

void PrefsDialog::OnSaveCallerID(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Prefs"));

    config->Write(_T("Name"),       Name->GetValue());
    config->Write(_T("Number"),     Number->GetValue());

    delete config;
    SaveCallerID->Disable();
    OnApplyCallerID(event);
}

void PrefsDialog::OnApplyCallerID(wxCommandEvent &event)
{
    wxGetApp().Name   = Name->GetValue();
    wxGetApp().Number = Number->GetValue();
    SetCallerID(wxGetApp().Name, wxGetApp().Number);

    ApplyCallerID->Disable();
    CancelCallerID->SetLabel(_T("Done"));
}

void PrefsDialog::OnSaveMisc(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Prefs"));

    config->Write(_T("UseSkin"),        UseSkin->GetValue());
    config->Write(_T("DefaultAccount"), DefaultAccount->GetStringSelection());
    config->Write(_T("IntercomPass"),   IntercomPass->GetValue());
	config->Write(_T("HelpURL"),        HelpURL->GetValue());
    config->Write(_T("nCalls"),         nCalls->GetValue());
	config->Write(_T("DebugLevel"),     DebugLevel->GetValue());

    delete config;
    SaveMisc->Disable();
    OnApplyMisc(event);
}

void PrefsDialog::OnApplyMisc(wxCommandEvent &event)
{
    // Update the Default Account on the main panel, if there is one
    wxGetApp().DefaultAccount = DefaultAccount->GetStringSelection();
    wxGetApp().theFrame->ShowDirectoryControls();

    wxGetApp().theFrame->IntercomPass = IntercomPass->GetValue();
	wxGetApp().HelpURL      		  = HelpURL->GetValue();
    wxGetApp().nCalls                 = nCalls->GetValue();
	wxGetApp().theFrame->DebugLevel   = DebugLevel->GetValue();

    wxGetApp().theFrame->RePanel(UseSkin->GetValue());

    ApplyMisc->Disable();
    CancelMisc->SetLabel(_T("Done"));
}

void PrefsDialog::OnDoneMisc(wxCommandEvent &event)
{
	Close(TRUE);
}

void PrefsDialog::OnCancel(wxCommandEvent &event)
{
	Close(TRUE);
}

void PrefsDialog::OnSaveFilters(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Prefs"));

    config->Write(_T("AGC"),            AGC->GetValue());
    config->Write(_T("AAGC"),           AAGC->GetValue());
    config->Write(_T("CN"),             CN->GetValue());
    config->Write(_T("NoiseReduce"),    NoiseReduce->GetValue());
    config->Write(_T("EchoCancel"),     EchoCancel->GetValue());

    delete config;
    SaveFilters->Disable();
    OnApplyFilters(event);
}

void PrefsDialog::OnApplyFilters(wxCommandEvent &event)
{
    wxGetApp().theFrame->AGC         = AGC->GetValue();
    wxGetApp().theFrame->AAGC        = AAGC->GetValue();
    wxGetApp().theFrame->CN          = CN->GetValue();
    wxGetApp().theFrame->NoiseReduce = NoiseReduce->GetValue();
    wxGetApp().theFrame->EchoCancel  = EchoCancel->GetValue();

    wxGetApp().theFrame->ApplyFilters();

    ApplyFilters->Disable();
    CancelFilters->SetLabel(_T("Done"));
}

void PrefsDialog::OnCodecPrefer(wxCommandEvent &event)
{
    if(PreferiLBC->GetValue())
        LocalPreferredBitmap = IAXC_FORMAT_ILBC;

    if(PreferGSM->GetValue())
        LocalPreferredBitmap = IAXC_FORMAT_GSM;

    if(PreferSpeex->GetValue())
        LocalPreferredBitmap = IAXC_FORMAT_SPEEX;

    if(PreferuLaw->GetValue())
        LocalPreferredBitmap = IAXC_FORMAT_ULAW;

    if(PreferaLaw->GetValue())
        LocalPreferredBitmap = IAXC_FORMAT_ALAW;

    OnCodecAllow(event);
}

void PrefsDialog::OnCodecAllow(wxCommandEvent &event)
{
    // If a codec is preferred, then it must be allowed
    if(PreferiLBC->GetValue())
        AllowiLBC->SetValue(TRUE);

    if(PreferGSM->GetValue())
        AllowGSM->SetValue(TRUE);

    if(PreferSpeex->GetValue())
        AllowSpeex->SetValue(TRUE);

    if(PreferuLaw->GetValue())
        AllowuLaw->SetValue(TRUE);

    if(PreferaLaw->GetValue())
        AllowaLaw->SetValue(TRUE);

    ApplyCodecs->Enable();
    SaveCodecs->Enable();
    CancelCodecs->SetLabel(_T("Cancel"));
}

void PrefsDialog::OnSpeexTuneSpinEvent(wxSpinEvent &event)
{
    OnSpeexTune(*((wxCommandEvent *) &event));
}

void PrefsDialog::OnSpeexTune(wxCommandEvent &event)
{
    wxGetApp().theFrame->SPXTuneVal = SPXTune->GetValue();

    if(wxGetApp().theFrame->SPXTuneVal) {
        SPXEnhance->Enable();
        SPXQuality->Enable();
        SPXBitrate->Enable();
        SPXABR->Enable();
        SPXVBR->Enable();
        SPXComplexity->Enable();
    } else {
        SPXEnhance->Disable();
        SPXQuality->Disable();
        SPXBitrate->Disable();
        SPXABR->Disable();
        SPXVBR->Disable();
        SPXComplexity->Disable();
    }
    // Not sure if there's anything different to do here
    OnCodecAllow(event);
}

void PrefsDialog::OnIax2DirtySpinEvent(wxSpinEvent &event)
{
    OnIax2Dirty(*((wxCommandEvent *) &event));
}

void PrefsDialog::OnIax2Dirty(wxCommandEvent &event)
{
    SaveIax2->Enable();
    CancelIax2->SetLabel(_T("Cancel"));
}

void PrefsDialog::OnSaveIax2(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Prefs"));
	config->Write(_T("Iax2Port"),      Iax2Port->GetValue());
	config->Write(_T("IaxPttType"),    IaxPttType->GetValue());
	SaveIax2->Disable();
	CancelIax2->SetLabel(_T("Done"));
}

void PrefsDialog::OnLinksDirty(wxCommandEvent &event)
{
	SaveLinks->Enable();
}

void PrefsDialog::OnSaveLinks(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Prefs"));
	config->Write(_T("StartupLinks"),StartupLinks->GetValue());
	config->Write(_T("PermaLinks"),PermaLinks->GetValue());
	SaveLinks->Disable();
	CancelLinks->SetLabel(_T("Done"));
}

void PrefsDialog::OnSaveCodecs(wxCommandEvent &event)
{
    wxConfig *config = theApp::getConfig();
    config->SetPath(_T("/Codecs"));

    config->Write(_T("AllowuLaw"),       AllowuLaw->GetValue());
    config->Write(_T("AllowaLaw"),       AllowaLaw->GetValue());
    config->Write(_T("AllowGSM"),        AllowGSM->GetValue());
    config->Write(_T("AllowSpeex"),      AllowSpeex->GetValue());
    config->Write(_T("AllowiLBC"),       AllowiLBC->GetValue());
    config->Write(_T("Preferred"),       LocalPreferredBitmap);

    config->SetPath(_T("/Codecs/SpeexTune"));

    config->Write(_T("SPXTune"),         SPXTune->GetValue());
    config->Write(_T("SPXEnhance"),      SPXEnhance->GetValue());
    config->Write(_T("SPXQuality"),      SPXQuality->GetValue());
    config->Write(_T("SPXBitrate"),      SPXBitrate->GetValue());
    config->Write(_T("SPXABR"),          SPXABR->GetValue());
    config->Write(_T("SPXVBR"),          SPXVBR->GetValue());
    config->Write(_T("SPXComplexity"),   SPXComplexity->GetValue());

    delete config;
    SaveCodecs->Disable();
    OnApplyCodecs(event);
}

void PrefsDialog::OnApplyCodecs(wxCommandEvent &event)
{
    wxGetApp().theFrame->AllowuLawVal     = AllowuLaw->GetValue();
    wxGetApp().theFrame->AllowaLawVal     = AllowaLaw->GetValue();
    wxGetApp().theFrame->AllowGSMVal      = AllowGSM->GetValue();
    wxGetApp().theFrame->AllowSpeexVal    = AllowSpeex->GetValue();
    wxGetApp().theFrame->AllowiLBCVal     = AllowiLBC->GetValue();

    wxGetApp().theFrame->PreferredBitmap  = LocalPreferredBitmap;

    wxGetApp().theFrame->SPXTuneVal       = SPXTune->GetValue();
    wxGetApp().theFrame->SPXEnhanceVal    = SPXEnhance->GetValue();
    wxGetApp().theFrame->SPXQualityVal    = SPXQuality->GetValue();
    wxGetApp().theFrame->SPXBitrateVal    = SPXBitrate->GetValue();
    wxGetApp().theFrame->SPXABRVal        = SPXABR->GetValue();
    wxGetApp().theFrame->SPXVBRVal        = SPXVBR->GetValue();
    wxGetApp().theFrame->SPXComplexityVal = SPXComplexity->GetValue();

    wxGetApp().theFrame->ApplyCodecs();

    ApplyCodecs->Disable();
    CancelCodecs->SetLabel(_T("Done"));
}

void PrefsDialog::OnAudioDirty(wxCommandEvent &event)
{
    ApplyAudio->Enable();
    SaveAudio->Enable();
    CancelAudio->SetLabel(_T("Cancel"));
}

void PrefsDialog::OnCallerIDDirty(wxCommandEvent &event)
{
    ApplyCallerID->Enable();
    SaveCallerID->Enable();
    CancelCallerID->SetLabel(_T("Cancel"));
}

void PrefsDialog::OnMiscDirtySpinEvent(wxSpinEvent &event)
{
    OnMiscDirty(*((wxCommandEvent *) &event));
}

void PrefsDialog::OnMiscDirty(wxCommandEvent &event)
{
    ApplyMisc->Enable();
    SaveMisc->Enable();
    CancelMisc->SetLabel(_T("Cancel"));
}

void PrefsDialog::OnFiltersDirty(wxCommandEvent &event)
{
    ApplyFilters->Enable();
    SaveFilters->Enable();
    CancelFilters->SetLabel(_T("Cancel"));
}


text:
The `AlertList` component will render an array of `alerts` into one of the corners of the page. It takes the following `props`:

---

#### `alerts`

These are the alerts that the component should render. It expects an object with fields `id` & `message` with an optional `type` & `headline`.

Hint: if you don't have anything good to make an `id` out of, try using: `new Date()).getTime()`

If no `headline` is specified, only the message will show up in the alert.

The supported values for `type` are one of _info_, _warning_, _danger_, or _success_. If no `type` is specified, it is assumed to be _info_.

The `message` can be plain text or any arbitrary React component. Please note though that although the `message` can accept arbitrary content, the height animation on the alerts is static and based on the assumption that the content won't exceed `20em` vertically. You probably want to avoid putting anything that long in an alert which overlaps your UI anyway as opposed to linking to more detail.

---

#### `position`

The corner in which alerts appear. One of _top-right_ (default), _top-left_, _bottom-right_, _bottom-left_.

---

#### `timeout`

An optional timeout (in milliseconds) before alerts are automatically dismissed. If not specified, an alert will not be dismissed until the user dismisses it. If a timeout is specified but no `onDismiss` function, it is equivalent to specifying no timeout. There is no timeout by default.

---

#### `onDismiss`

When a user clicks the × icon to dismiss the alert, this function will be called. The function is optional. If no `onDismiss` function is specified, the component will not render a close button for the alert and it will be undismissable by the user. The dismiss function will receive the `alert` that was dismissed as its sole argument.

---

#### `showIcon`

A boolean value which indicates whether or not the alert type icon should be rendered. It is `true` by default.

---

#### `dismissTitle`

The title text for the dismiss-alert button. By default, it is _Dismiss_.

---

### `Alert` Props

An `Alert` component by itself will render an alert inline. It takes the following `props`:

#### `type`

An optional type for the alert. The supported values for `type` are one of _info_, _warning_, _danger_, or _success_. If no `type` is specified, it is assumed to be _info_.

---

#### `headline`

An optional larger headline text to show in the alert. If no `headline` is specified, only the child content will show up in the alert.

---

#### `onDismiss`

When a user clicks the × icon to dismiss the alert, this function will be called. The function is optional. If no `onDismiss` function is specified, the component will not render a close button for the alert and it will be undismissable by the user. The `onDismiss` function is called with no arguments.

---

#### `showIcon`

A boolean value which indicates whether or not the alert type icon should be rendered. It is `true` by default.

---

#### `dismissTitle`

The title text for the dismiss-alert button. By default, it is _Dismiss_.

---

#### `timeout`

An optional timeout (in milliseconds) before this alert will be automatically dismissed. If not specified, an alert will not be dismissed until the user dismisses it. If a timeout is specified but no `onDismiss` function, it is equivalent to specifying no timeout. There is no timeout by default.

---

#### `classes`

JSS style overrides for the component. The following classes can be overridden:

* `alert`: CSS class applied to the root `div` of the `Alert`
* `info`: CSS class applied to the root `div` for `info` alerts
* `success`: CSS class applied to the root `div` for `success` alerts
* `warning`: CSS class applied to the root `div` for `warning` alerts
* `danger`: CSS class applied to the root `div` for `danger` alerts
* `dismissable`: CSS class applied to the root `div` for alerts that can be dismissed
* `close`: CSS class applied to the _dismiss_ button
* `icon`: CSS class applied to the alert type icon
* `msgContainer`: CSS class applied to the container holding the headline and message
* `headline`: CSS class applied to the headline element (if provided)
* `body`: CSS class applied to the message element itself

See the _Themed Alert_ example above.

---

### `AlertContainer` Props

The `AlertContainer` will render it's child `Alert`s in one of the corners of the page. It takes the following `props`:

---

#### `position`

The corner in which alerts appear. One of _top-right_ (default), _top-left_, _bottom-right_, _bottom-left_.


text:
<TITLE>Review for Bicentennial Man (1999)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Bicentennial Man (1999)

reviewed by
Bob Bloom

 Bicentennial Man (1999) 1 1/2 stars out of 4. Starring Robin Williams, Sam
Neill, Embeth Davidtz, Oliver Platt and Hallie Kate Eisenberg. Directed by
Chris Columbus.

 It is in the nature of our species to continually try to better ourselves,
to evolve.

 And you can't fault a person for doing what comes naturally.

 So, I really can't be upset with Robin Williams who seems to have turned
his back on comedy to strive to become an Actor.

 After all, we all want to improve, to continually grow ...
Ah, the hell with it. Who am I kidding? Just call me a selfish s.o.b. I
want my old Robin Williams back, the one who kept me laughing for nearly
two hours in concert back in Columbus, Ohio, about 17 years ago, the Robin
Williams from "Good Morning Vietnam" and "Aladdin."

 I want the spontaneous Robin Williams who appears on talk shows or
performs during Comic Relief.

 This new Robin Williams is creepy. Worse, he's kind of dull and boring.
I'm tired of this touchy-feely guy who began emerging in "Good Will
Hunting" and has invaded my multiplex in "Patch Adams," "When Dreams May
Come," "Jakob the Liar" and now "Bicentennial Man."

 He has become the cliche of the comedian wanting to play Hamlet.

 Maybe this is what attracted him to "Bicentennial Man," an artificial
weeper that is overly schmaltzy and ponderous.

 In the movie, based on a short story by science fiction legend Isaac
Asimov, which was later expanded into the novel, "The Positronic Man," by
Robert Silverberg, Williams plays Andrew, a robot who continually strives
for humanity.
How anyone can see this as an improvement is beyond me, but after all, it
is science fiction.

 We first meet Andrew at the home of Sir (Sam Neill), his wife, Ma'am
(Wendy Crewson) and their daughters, Miss (Undze Letherman) and Little Miss
(Pepsi spokeskid Hallie Kate Eisenberg, who already is beginning to wear
out her welcome).

 At first considered merely a "household appliance," Sir sees a creative
spark in Andrew and encourages him to continue his explorations.

 As the decades pass - the movie covers 200 years - Andrew continues to
grow and evolve.

 But then he falls in love with Portia, the great-granddaughter of Sir and
the granddaughter of Little Miss.

 Both Little Miss as an adult (as well as an old woman) and Portia are
played by Embeth Davidtz, best remembered as Ralph Fiennes Jewish maid in
"Schindler's List."

 So, more than halfway through the movie, directed by Chris Columbus, who
has done better work, we are now involved in a robot/girl love story and
all the cliches that entails.

 The real stars of "Bicentennial Man" are the makeup and special effects
people who created Williams' robot look. Unfortunately, later in the movie
he is given a human face that looks like an old, tired Robin Williams.

 People are going to flock to "Bicentennial Man" no matter what I or any
other critic says. It's inoffensive and the kids will like it, though the
younger ones may become restless because of it's nearly
two-hour-and-20-minute running time.

 But it is a rather weak movie, rife in self-important sounding dialogue
and situations that don't ring true.

 I just wish Robin Williams would quit wasting his time and devolve. Who
says moving forward is always progress?

 Bob Bloom is the film critic at the Journal and Courier in Lafayette,IN.
He can be reached by e-mail at bloom@journal-courier.com or at
cbloom@iquest.net

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
#include <Core/TGA.h>
#include <MenuScreens/WidgetFactory.h>

namespace ChronoRage
{

class AutoCenteredPanel : public GUI::Widget
{
public:
    AutoCenteredPanel(const Ptr<Renderer::IRenderer> & pRenderer,
                      int32 width, int32 height) : _pRenderer(pRenderer), _width(width), _height(height)
    {
        pack();
    }

    virtual void update(double elapsed)
    {
        pack();
        GUI::Widget::update(elapsed);
    }

    virtual void pack()
    {
        Ptr<Renderer::IRenderView> pView = _pRenderer->getDefaultView();
        setSize(Core::Vector2f(float(_width), float(_height)));

        int32 xpos = (pView->getWidth() - _width) / 2;
        int32 ypos = (pView->getHeight() - _height) / 2;

        setPosition(Core::Vector2f(float(xpos), float(ypos)));
    }

    virtual void startAsDialog()
    {
        pack();
    }

protected:
    Ptr<Renderer::IRenderer> _pRenderer;
    int32                    _width;
    int32                    _height;
};

WidgetFactory::WidgetFactory(   const Ptr<GUI::Manager> & pGUI,
                                const Ptr<Window::InputManager> & pInput,
                                const Ptr<Core::Dictionary> & pDico,
                                const Ptr<SoundLibrary> & pSoundLibrary)
:   _pGUI(pGUI),
    _pInput(pInput),
    _pDico(pDico),
    _pSoundLibrary(pSoundLibrary)
{
    _defaultFontName = L"Lucida Console";

    _pKeyNav = Ptr<KeyNav>(new KeyNav(pInput));
    pGUI->getKeyNavigation()->pCtrl = _pKeyNav;

    {
        const Renderer::PictureInfos & pic = _pGUI->getResPool()->getPicture(L"/ChronoRageData/GUI/menu-button.tga");
        _mediumLabelSize.x = float(pic.width);
        _mediumLabelSize.y = float(pic.height);
    }
    {
        const Renderer::PictureInfos & pic = _pGUI->getResPool()->getPicture(L"/ChronoRageData/GUI/menu-little-button.tga");
        _smallLabelSize.x = float(pic.width);
        _smallLabelSize.y = float(pic.height);
    }

    _screenFixedWidth = 1024;
    _screenFixedHeight = 768;

    _mediumTextSize = 18;
    _smallTextSize = 10;

    _smallHintSize = Core::Vector2f(256, 48);
    _smallHintTextSize = 10;
}

void WidgetFactory::setCursor(ECursor cursor)
{
    switch(cursor)
    {
    case CURSOR_ARROW:
        _pGUI->setCursor(_pCursorArrow, 2, 2);
        break;
    }
}

void WidgetFactory::setStyle(const Ptr<GUI::Button> & pButton, const String & text, int32 size, const String & picName)
{
    GUI::ButtonStyle bs;
    bs.text     = text;
    bs.fontName = _defaultFontName;
    bs.fontSize = size;
    bs.bold     = true;
    bs.italic   = false;
    bs.shadow   = true;

    GUI::ButtonState bss;
    bss.picName   = picName;
    bss.picColor  = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    bss.textColor = Core::Vector4f(0.4f, 0.9f, 1.0f, 1.0f);
    bss.posDelta  = Core::Vector2f(1.0f, 1.0f);
    bs.state[GUI::BS_PUSHED] = bss;

    bss.posDelta  = Core::Vector2f(0.0f, 0.0f);
    bss.textColor = Core::Vector4f(0.4f, 0.9f, 1.0f, 1.0f);
    bs.state[GUI::BS_MOUSE_OVER] = bss;

    bss.textColor = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    bss.picColor = Core::Vector4f(0.8f, 0.8f, 0.8f, 1.0f);
    bs.state[GUI::BS_DEFAULT] = bss;

    bss.picColor = Core::Vector4f(0.4f, 0.4f, 0.4f, 1.0f);
    bss.textColor = Core::Vector4f(0.4f, 0.4f, 0.4f, 1.0f);
    bs.state[GUI::BS_DISABLED] = bss;

    bss.picColor = Core::Vector4f(0.6f, 0.6f, 0.6f, 1.0f);
    bss.textColor = Core::Vector4f(0.6f, 0.6f, 0.6f, 1.0f);
    bs.state[GUI::BS_DISABLED_MOUSE_OVER] = bss;

    pButton->setDictionary(_pDico);
    pButton->setStyle(bs);
}

Ptr<GUI::Label> WidgetFactory::createMediumLabel(const String & text, int32 x, int32 y)
{
    Ptr<GUI::Label> pLabel(new GUI::Label(_pGUI->getResPool(), _pGUI->getHUD()));
    pLabel->setDictionary(_pDico);
    pLabel->setText(text);
    pLabel->setSize(_mediumLabelSize);
    pLabel->setFontName(_defaultFontName);
    pLabel->setFontSize(_mediumTextSize);
    pLabel->setVLayout(GUI::VL_CENTER);
    pLabel->setPosition(Core::Vector2f(float(x), float(y)));

    return pLabel;
}

Ptr<GUI::RichTextLabel> WidgetFactory::createRichTextLabel(const String & text, int32 x, int32 y)
{
    Ptr<GUI::RichTextLabel> pLabel(new GUI::RichTextLabel(_pGUI->getResPool(), _pGUI->getHUD()));
    pLabel->setDictionary(_pDico);
    pLabel->setSize(_mediumLabelSize);
    pLabel->setFontName(_defaultFontName);
    pLabel->setFontSize(_mediumTextSize);
    pLabel->setPosition(Core::Vector2f(float(x), float(y)));

    pLabel->setText(text);

    return pLabel;
}

Ptr<GUI::RichTextLabel> WidgetFactory::createRichTextHint(const String & text, int32 x, int32 y)
{
    Ptr<GUI::RichTextLabel> pLabel(new GUI::RichTextLabel(_pGUI->getResPool(), _pGUI->getHUD()));
    pLabel->setDictionary(_pDico);
    pLabel->setSize(_smallHintSize);
    pLabel->setFontName(_defaultFontName);
    pLabel->setFontSize(_smallHintTextSize);
    pLabel->setPosition(Core::Vector2f(float(x), float(y)));
    pLabel->setOwnColor(Core::Vector4f(0.7f, 0.7f, 0.7f, 1.0f));

    pLabel->setText(text);

    return pLabel;
}

Ptr<GUI::Widget> WidgetFactory::createDialogBase()
{
    return Ptr<GUI::Widget>(new AutoCenteredPanel(_pGUI->getRenderer(), _screenFixedWidth, _screenFixedHeight));
}

void WidgetFactory::bottomScreen(const Ptr<GUI::Widget> & pWidget)
{
    int32 xpos = (_screenFixedWidth - int32(pWidget->getSize().x)) / 2;
    int32 ypos = 3*(_screenFixedHeight - int32(pWidget->getSize().y)) / 4;

    pWidget->setPosition(Core::Vector2f(float(xpos), float(ypos)));
}

void WidgetFactory::centerScreen(const Ptr<GUI::Widget> & pWidget)
{
    int32 xpos = (_screenFixedWidth - int32(pWidget->getSize().x)) / 2;
    int32 ypos = (_screenFixedHeight - int32(pWidget->getSize().y)) / 2;

    pWidget->setPosition(Core::Vector2f(float(xpos), float(ypos)));
}

Ptr<GUI::Picture> WidgetFactory::createMediumPanel(bool centered)
{
    Ptr<GUI::Picture> pResult(createMediumPanel(0, 0));
    if(centered)
        centerScreen(pResult);
    return pResult;
}

Ptr<GUI::Picture> WidgetFactory::createThinPanel(bool centered)
{
    Ptr<GUI::Picture> pResult(createThinPanel(0, 0));
    if(centered)
        centerScreen(pResult);
    return pResult;
}

Ptr<GUI::Picture> WidgetFactory::createLargePanel(bool centered)
{
    Ptr<GUI::Picture> pResult(createLargePanel(0, 0));
    if(centered)
        centerScreen(pResult);
    return pResult;
}

Ptr<GUI::Picture> WidgetFactory::createPicture(const String & name, int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(name);
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<GUI::Picture> WidgetFactory::createThinPanel(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/little-menu-border.tga");
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<GUI::Picture> WidgetFactory::createMediumPanel(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/menu-border.tga");
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<GUI::Picture> WidgetFactory::createLargePanel(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/menu-border-big.tga");
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<GUI::Picture> WidgetFactory::createThinBand(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/little-band.tga");
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<GUI::Picture> WidgetFactory::createMediumBand(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/band.tga");
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<GUI::Picture> WidgetFactory::createLargeBand(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/large-band.tga");
    pPicture->setPosition(Core::Vector2f(float(x), float(y)));
    return pPicture;
}

Ptr<TextEdit> WidgetFactory::createMediumTextEdit(int32 x, int32 y)
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    pPicture->setPicture(L"/ChronoRageData/GUI/textedit-medium.tga");

    Ptr<GUI::TextEdit> pTextEdit(new GUI::TextEdit(_pGUI->getResPool(), _pGUI->getHUD(), _pInput, _pGUI->getFocus()));

    static const float padding = 5.0f;

    float xsize = pPicture->getSize().x - 2.0f * padding;
    float ysize = pPicture->getSize().y;

    pTextEdit->setSize(Core::Vector2f(xsize, ysize));
    pTextEdit->setVLayout(GUI::VL_CENTER);
    pTextEdit->setPosition(Core::Vector2f(padding, 0.0f));
    pTextEdit->setFontName(_defaultFontName);
    pTextEdit->setFontSize(_mediumTextSize);

    pPicture->addChild(pTextEdit);

    Ptr<TextEdit> pResult(new TextEdit(pTextEdit, pPicture));
    pResult->setPosition(Core::Vector2f(float(x), float(y)));

    return pResult;
}

Ptr<CRButton> WidgetFactory::createSmallButton(const String & text, int32 x, int32 y)
{
    Ptr<CRButton> pButton(new CRButton(_pGUI->getResPool(), _pGUI->getHUD(), _pInput, _pSoundLibrary));
    pButton->setSize(Core::Vector2f(100.0f, 40.0f));
    setStyle(pButton, text, _mediumTextSize, L"/ChronoRageData/GUI/menu-little-button.tga");
    pButton->setPosition(Core::Vector2f(float(x), float(y)));
    pButton->setKeyNavigation(_pGUI->getKeyNavigation());
    return pButton;
}

Ptr<CRButton> WidgetFactory::createMediumButton(const String & text, int32 x, int32 y)
{
    Ptr<CRButton> pButton(new CRButton(_pGUI->getResPool(), _pGUI->getHUD(), _pInput, _pSoundLibrary));
    pButton->setSize(Core::Vector2f(400.0f, 40.0f));
    setStyle(pButton, text, _mediumTextSize, L"/ChronoRageData/GUI/menu-button.tga");
    pButton->setPosition(Core::Vector2f(float(x), float(y)));
    pButton->setKeyNavigation(_pGUI->getKeyNavigation());
    return pButton;
}

Ptr<GUI::Picture> WidgetFactory::createMessageBoxMedium()
{
    Ptr<GUI::Picture> pPicture(new GUI::Picture(_pGUI->getResPool(), _pGUI->getHUD()));
    //pPicture->setPicture(L"/HOO/GUI/Widgets/messagebox-medium.tga");
    centerScreen(pPicture);
    return pPicture;
}

Ptr<CRCheckBox> WidgetFactory::createCheckBox(const String & text, int32 x, int32 y)
{
    Ptr<CRCheckBox> pCheckBox(new CRCheckBox(_pGUI->getResPool(), _pGUI->getHUD(), _pInput, _pSoundLibrary));

    GUI::CheckBoxStyle style;
    style.text          = text;
    style.picChecked    = L"/ChronoRageData/GUI/checkbox-on.tga";
    style.picUnchecked  = L"/ChronoRageData/GUI/checkbox-off.tga";
    style.fontName      = _defaultFontName;
    style.fontSize      = _mediumTextSize;
    style.padding       = 10.0f;
    style.bold          = false;
    style.italic        = false;
    style.shadow        = true;

    GUI::CheckBoxState cbs;
    cbs.picColor  = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    cbs.textColor = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    cbs.posDelta  = Core::Vector2f(1.0f, 1.0f);

    style.state[GUI::CBS_PUSHED] = cbs;

    cbs.posDelta  = Core::Vector2f(0.0f, 0.0f);
    style.state[GUI::CBS_MOUSE_OVER] = cbs;

    cbs.picColor  = Core::Vector4f(0.8f, 0.8f, 0.8f, 1.0f);
    style.state[GUI::CBS_DEFAULT] = cbs;

    cbs.picColor  = Core::Vector4f(0.4f, 0.4f, 0.4f, 1.0f);
    style.state[GUI::CBS_DISABLED] = cbs;

    pCheckBox->setDictionary(_pDico);
    pCheckBox->setStyle(style);
    pCheckBox->setPosition(Core::Vector2f(float(x), float(y)));
    pCheckBox->setKeyNavigation(_pGUI->getKeyNavigation());

    return pCheckBox;
}

Ptr<CRComboBox> WidgetFactory::createComboBox(const Core::List<String> & items, int32 x, int32 y)
{
    Ptr<CRComboBox> pCombo = Ptr<CRComboBox>(new CRComboBox(_pGUI->getResPool(), _pGUI->getHUD(), _pInput, _pGUI, _pSoundLibrary));

    GUI::ButtonStyle bs;
    bs.text = L"";
    bs.fontName = _defaultFontName;
    bs.fontSize = _smallTextSize;
    bs.bold = false;
    bs.italic = false;
    bs.shadow = true;

    GUI::ButtonState bss;
    bss.picName   = L"/ChronoRageData/GUI/combo-button.tga";
    bss.picColor  = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    bss.textColor = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    bss.posDelta  = Core::Vector2f(2.0f, 2.0f);

    bs.state[GUI::BS_PUSHED] = bss;

    bss.posDelta  = Core::Vector2f(0.0f, 0.0f);
    bs.state[GUI::BS_MOUSE_OVER] = bss;

    bss.picColor = Core::Vector4f(0.8f, 0.8f, 0.8f, 1.0f);
    bs.state[GUI::BS_DEFAULT] = bss;

    bss.picColor = Core::Vector4f(0.4f, 0.4f, 0.4f, 1.0f);
    bss.textColor = Core::Vector4f(0.8f, 0.8f, 0.8f, 1.0f);
    bs.state[GUI::BS_DISABLED] = bss;

    pCombo->setStyle(bs);
    pCombo->setItems(items);
    pCombo->setPosition(Core::Vector2f(float(x), float(y)));
    pCombo->setPadding(2.0f);
    pCombo->setMaxLines(5);

    bs.state[GUI::BS_DISABLED].picName = bs.state[GUI::BS_PUSHED].picName = bs.state[GUI::BS_MOUSE_OVER].picName = bs.state[GUI::BS_DEFAULT].picName = L"/ChronoRageData/GUI/combo-item.tga";
    pCombo->setItemsStyle(bs);
    pCombo->setKeyNavigation(_pGUI->getKeyNavigation());

    return pCombo;
}

Ptr<CRComboBox> WidgetFactory::createLargeComboBox(const Core::List<String> & items, int32 x, int32 y)
{
    Ptr<CRComboBox> pCombo = Ptr<CRComboBox>(new CRComboBox(_pGUI->getResPool(), _pGUI->getHUD(), _pInput, _pGUI, _pSoundLibrary));

    GUI::ButtonStyle bs;
    bs.text = L"";
    bs.fontName = _defaultFontName;
    bs.fontSize = _smallTextSize;
    bs.bold = false;
    bs.italic = false;
    bs.shadow = true;

    GUI::ButtonState bss;
    bss.picName   = L"/ChronoRageData/GUI/large-combo-button.tga";
    bss.picColor  = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    bss.textColor = Core::Vector4f(1.0f, 1.0f, 1.0f, 1.0f);
    bss.posDelta  = Core::Vector2f(2.0f, 2.0f);

    bs.state[GUI::BS_PUSHED] = bss;

    bss.posDelta  = Core::Vector2f(0.0f, 0.0f);
    bs.state[GUI::BS_MOUSE_OVER] = bss;

    bss.picColor = Core::Vector4f(0.8f, 0.8f, 0.8f, 1.0f);
    bs.state[GUI::BS_DEFAULT] = bss;

    bss.picColor = Core::Vector4f(0.4f, 0.4f, 0.4f, 1.0f);
    bss.textColor = Core::Vector4f(0.8f, 0.8f, 0.8f, 1.0f);
    bs.state[GUI::BS_DISABLED] = bss;

    pCombo->setStyle(bs);
    pCombo->setItems(items);
    pCombo->setPosition(Core::Vector2f(float(x), float(y)));
    pCombo->setPadding(2.0f);
    pCombo->setMaxLines(5);

    bs.state[GUI::BS_DISABLED].picName = bs.state[GUI::BS_PUSHED].picName = bs.state[GUI::BS_MOUSE_OVER].picName = bs.state[GUI::BS_DEFAULT].picName = L"/ChronoRageData/GUI/large-combo-item.tga";
    pCombo->setItemsStyle(bs);
    pCombo->setKeyNavigation(_pGUI->getKeyNavigation());

    return pCombo;
}

Ptr<GUI::HScrollBar> WidgetFactory::createHScrollBar(int32 x, int32 y)
{
    Ptr<GUI::HScrollBar> pHScroll = Ptr<GUI::HScrollBar>(new GUI::HScrollBar(_pGUI->getResPool(), _pGUI->getHUD(), _pGUI->getInput()));
    pHScroll->setBarPicture(L"/ChronoRageData/GUI/hscroll-cursor.tga");
    pHScroll->setBackgroundPicture(L"/ChronoRageData/GUI/hscroll-bar.tga");
    pHScroll->setSize(Core::Vector2f(200.0f, 21.0f));
    pHScroll->setPosition(Core::Vector2f(float(x), float(y)));
    pHScroll->setBackgroundColor(Core::Vector4f(0.0f, 0.0f, 0.0f, 0.5f));
    pHScroll->setBarColor(Core::Vector4f(1.0f, 1.0f, 1.0f, 0.5f));
    pHScroll->setRange(0, 200, 12); // 200 = size bar, 21 = size cursor
    pHScroll->setKeyNavigation(_pGUI->getKeyNavigation());

    return pHScroll;
}

}//namespace ChronoRage


text:
title: AesiLaunchConfigurationDelegate.<init> - aesi-eclipse
---

[aesi-eclipse](../../index.html) / [com.virtlink.aesi.eclipse.launching](../index.html) / [AesiLaunchConfigurationDelegate](index.html) / [<init>](.)

# <init>

`AesiLaunchConfigurationDelegate()`

The launch configuration delegate.


text:
package org.squonk.core;

import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.dataformat.JsonLibrary;
import org.squonk.core.service.metrics.TokensPostgresClient;
import org.squonk.jobdef.StepsCellExecutorJobDefinition;
import org.squonk.mqueue.MessageQueueCredentials;
import org.squonk.util.ExecutionStats;
import org.squonk.util.StatsRecorder;

import java.util.Map;
import java.util.logging.Logger;

import static org.squonk.mqueue.MessageQueueCredentials.MQUEUE_JOB_METRICS_EXCHANGE_NAME;
import static org.squonk.mqueue.MessageQueueCredentials.MQUEUE_JOB_METRICS_EXCHANGE_PARAMS;

/**
 * Created by timbo on 23/06/16.
 */
public class MetricsRouteBuilder extends RouteBuilder {

    private static final Logger LOG = Logger.getLogger(MetricsRouteBuilder.class.getName());

    private final MessageQueueCredentials rabbitmqCredentials = new MessageQueueCredentials();
    private final TokensPostgresClient client = new TokensPostgresClient();

    @Override
    public void configure() throws Exception {

        String mqueue = rabbitmqCredentials.generateUrl(MQUEUE_JOB_METRICS_EXCHANGE_NAME, MQUEUE_JOB_METRICS_EXCHANGE_PARAMS) +
                "&routingKey=tokens.#&concurrentConsumers=5";

        // TODO - handle exceptions

        LOG.info("Starting to consume from " + mqueue);
        from(mqueue)
                .log("consumed message ${body}")
                .unmarshal().json(JsonLibrary.Jackson, ExecutionStats.class)
                .log("TOKENS: ${body}")
                .bean(client, "saveExecutionStats");

    }
}


text:
@font-face {
  font-family: "StatsFont";
  src: url("http://cdn.clappr.io/bemtv/latest/assets/visitor.eot");
  src: url("http://cdn.clappr.io/bemtv/latest/assets/visitor.eot?#iefix") format("embedded-opentype"),
       url("http://cdn.clappr.io/bemtv/latest/assets/visitor.ttf") format("truetype"),
       url("http://cdn.clappr.io/bemtv/latest/assets/visitor.svg#player") format("svg");
}

.p2phlsstats[data-p2phlsstats] {
  font-family: "StatsFont";
  position: absolute;
  text-align: left;
  z-index: 3001;
  top: 20px;
  left: 20px;
  font-smooth: never;
  -webkit-font-smoothing : none;
  background-color: rgba(0,0,0,0.7);
  color: rgb(255,255,255);
  border-radius: 3px;
  width: 155px;
  height: 203px;
  padding-top: 11px;
  font-size: 10px;
  padding-left: 5px;
}

.p2phlsstats[data-p2phlsstats] p {
  color: white;
  text-align: center;
  margin-bottom: 5px;
}

.p2phlsstats[data-p2phlsstats] span {
  color: white;
  display: block;
  text-align: left;
  margin-bottom: 3px;
  line-height: 1em;
}

.p2phlsstats[data-p2phlsstats] span.stats-status {
  display: inline;
}


text:
// ReSharper disable All

namespace OpenTl.Schema.Help
{
    using System;
	using System.Collections;

	using OpenTl.Schema;

    public interface IAppUpdate : IObject
    {

    }
}


text:
module ReleaseNotes
  class JenkinsProject

    attr_accessor :name, :url, :start_git_sha1, :end_git_sha1, :git_repos

    def initialize(name, project_url, jenkins_data)
      @name = name
      @url = project_url
      @jenkins_data_source = Jenkins.new()
    end

    def fetch(start_build_no, end_build_no)
      start_data = @jenkins_data_source.fetch_project_data(@url, start_build_no)
      end_data = @jenkins_data_source.fetch_project_data(@url, end_build_no)

      start_revision = start_data["actions"]["lastBuiltRevision"]
      end_revision = end_data["actions"]["lastBuiltRevision"]

      @start_git_sha1 = start_revision["SHA1"]
      @end_git_sha1 = end_revision["SHA1"]

      @git_repos = start_data["actions"]["remoteUrls"]
    end
  end
end