text:
<?php

class IPF_ORM_Import_Builder
{
    private $_baseClassPrefix = 'Base';
    private $_baseClassesDirectory = IPF_ORM::BASE_CLASSES_DIRECTORY;

    private static function varExport($var)
    {
        $export = var_export($var, true);
        $export = preg_replace('#\s*\(\s*#', '(', $export);
        $export = preg_replace('#[\s,]+\)#', ')', $export);
        $export = preg_replace('#\s+#', ' ', $export);
        return $export;
    }

    private function buildTableDefinition(array $definition)
    {
        if (isset($definition['inheritance']['type']) && ($definition['inheritance']['type'] == 'simple' || $definition['inheritance']['type'] == 'column_aggregation')) {
            return;
        }

        $ret = array(
            '  public static function setTableDefinition(IPF_ORM_Table $table)',
            '  {',
        );

        if (isset($definition['inheritance']['type']) && $definition['inheritance']['type'] == 'concrete')
            $ret[] = '    parent::setTableDefinition($table);';

        if (isset($definition['tableName']) && !empty($definition['tableName']))
            $ret[] = "    ".'$table->setTableName(\''. $definition['tableName'].'\');';

        if (isset($definition['columns']) && is_array($definition['columns']) && !empty($definition['columns']))
            $ret[] = $this->buildColumns($definition['columns']);

        if (isset($definition['indexes']) && is_array($definition['indexes']) && !empty($definition['indexes']))
            foreach ($definition['indexes'] as $indexName => $definitions)
                $ret[] = "    \$table->addIndex('" . $indexName . "', " . self::varExport($definitions) . ');';

        if (isset($definition['attributes']) && is_array($definition['attributes']) && !empty($definition['attributes']))
            $ret[] = $this->buildAttributes($definition['attributes']);

        if (isset($definition['options']) && is_array($definition['options']) && !empty($definition['options']))
            $ret[] = $this->buildOptions($definition['options']);

        if (isset($definition['inheritance']['subclasses']) && !empty($definition['inheritance']['subclasses'])) {
            $ret[] = "    ".'$table->setSubClasses('. self::varExport($definition['inheritance']['subclasses']).');';
        }

        $ret[] = '  }';

        return implode(PHP_EOL, $ret);
    }

    private function buildSetUp(array $definition)
    {
        $ret = array();

        if (isset($definition['relations']) && is_array($definition['relations']) && !empty($definition['relations'])) {
            foreach ($definition['relations'] as $name => $relation) {
                $class = isset($relation['class']) ? $relation['class'] : $name;
                $alias = (isset($relation['alias']) && $relation['alias'] !== $relation['class']) ? $relation['alias'] : '';

                if (!isset($relation['type']))
                    $relation['type'] = IPF_ORM_Relation::ONE;

                if ($relation['type'] === IPF_ORM_Relation::ONE ||
                    $relation['type'] === IPF_ORM_Relation::ONE_COMPOSITE) {
                    $r = "    \$table->hasOne('$class', '$alias'";
                } else {
                    $r = "    \$table->hasMany('$class', '$alias'";
                }

                $a = array();

                if (isset($relation['refClass'])) {
                    $a[] = '\'refClass\' => ' . self::varExport($relation['refClass']);
                }

                if (isset($relation['deferred']) && $relation['deferred']) {
                    $a[] = '\'default\' => ' . self::varExport($relation['deferred']);
                }

                if (isset($relation['local']) && $relation['local']) {
                    $a[] = '\'local\' => ' . self::varExport($relation['local']);
                }

                if (isset($relation['foreign']) && $relation['foreign']) {
                    $a[] = '\'foreign\' => ' . self::varExport($relation['foreign']);
                }

                if (isset($relation['onDelete']) && $relation['onDelete']) {
                    $a[] = '\'onDelete\' => ' . self::varExport($relation['onDelete']);
                }

                if (isset($relation['onUpdate']) && $relation['onUpdate']) {
                    $a[] = '\'onUpdate\' => ' . self::varExport($relation['onUpdate']);
                }

                if (isset($relation['equal']) && $relation['equal']) {
                    $a[] = '\'equal\' => ' . self::varExport($relation['equal']);
                }

                if (isset($relation['owningSide']) && $relation['owningSide']) {
                    $a[] = '\'owningSide\' => ' . self::varExport($relation['owningSide']);
                }

                if (isset($relation['exclude']) && $relation['exclude']) {
                    $a[] = '\'exclude\' => ' . self::varExport($relation['exclude']);
                }

                if (!empty($a))
                    $r .= ', array(' . implode(', ', $a) . ')';

                $ret[] = $r.');';
            }
        }

        if (isset($definition['templates']) && is_array($definition['templates']) && !empty($definition['templates'])) {
            $this->buildTemplates($definition['templates'], $ret);
        }

        if (isset($definition['actAs']) && is_array($definition['actAs']) && !empty($definition['actAs'])) {
            $this->buildActAs($definition['actAs'], $ret);
        }

        if (isset($definition['listeners']) && is_array($definition['listeners']) && !empty($definition['listeners'])) {
            foreach ($definition['listeners'] as $listener) {
                $ret[] = "    \$table->listeners['$listener'] = new $listener;";
            }
        }

        // If the body of the function has contents and we are using inheritance
        // then we need call the parent::setUp() before the body of the function
        // Class table inheritance is the only one we shouldn't call parent::setUp() for
        if (count($ret) && isset($definition['inheritance']['type']) && $definition['inheritance']['type'] != 'class_table') {
            array_unshift($ret, '    parent::setUp($table);');
        }

        // If we have some code for the function then lets define it and return it
        if (count($ret)) {
            array_unshift($ret,
                '  public static function setUp(IPF_ORM_Table $table)',
                '  {'
            );
            $ret[] = '  }';
        }
        return $ret;
    }

    private function buildColumns(array $columns)
    {
        $result = array();
        foreach ($columns as $name => $column) {
            $columnName = isset($column['name']) ? $column['name']:$name;
            $build = "    ".'$table->setColumn(\'' . $columnName . '\', \'' . $column['type'] . '\'';

            if ($column['length']) {
                if (is_numeric($column['length']))
                    $build .= ', ' . $column['length'];
                else
                    $build .= ', array(' . $column['length'] . ')';
            } else {
                $build .= ', null';
            }

            $options = $column;

            // Remove name, alltypes, ntype. They are not needed in options array
            unset($options['name']);
            unset($options['alltypes']);
            unset($options['ntype']);

            // Remove notnull => true if the column is primary
            // Primary columns are implied to be notnull in IPF_ORM
            if (isset($options['primary']) && $options['primary'] == true && (isset($options['notnull']) && $options['notnull'] == true)) {
                unset($options['notnull']);
            }

            // Remove default if the value is 0 and the column is a primary key
            // IPF_ORM defaults to 0 if it is a primary key
            if (isset($options['primary']) && $options['primary'] == true && (isset($options['default']) && $options['default'] == 0)) {
                unset($options['default']);
            }

            // These can be removed if they are empty. They all default to a false/0/null value anyways
            $remove = array('fixed', 'primary', 'notnull', 'autoincrement', 'unsigned');
            foreach ($remove as $key) {
                if (isset($options[$key]) && empty($options[$key])) {
                    unset($options[$key]);
                }
            }

            // Remove null and empty array values
            foreach ($options as $key => $value) {
                if (is_null($value) || (is_array($value) && empty($value))) {
                    unset($options[$key]);
                }
            }

            if (is_array($options) && !empty($options)) {
                $build .= ', ' . self::varExport($options);
            }

            $build .= ');';

            $result[] = $build;
        }

        return implode(PHP_EOL, $result);
    }

    private function buildTemplates(array $templates, array &$build)
    {
        foreach ($templates as $name => $options) {
            if (is_array($options) && !empty($options)) {
                $build[] = "    \$table->addTemplate('$name', " . self::varExport($options) . ");";
            } elseif (isset($templates[0])) {
                $build[] = "    \$table->addTemplate('$options');";
            } else {
                $build[] = "    \$table->addTemplate('$name');";
            }
        }
    }

    private function buildActAs($actAs, array &$build)
    {
        // rewrite special case of actAs: [Behavior] which gave [0] => Behavior
        if (is_array($actAs) && isset($actAs[0]) && !is_array($actAs[0])) {
            $actAs = array_flip($actAs);
        }

        // rewrite special case of actAs: Behavior
        if (!is_array($actAs))
            $actAs = array($actAs => '');

        foreach ($actAs as $template => $options) {
            // find class matching $name
            if (class_exists('IPF_ORM_Template_'.$template, true))
                $classname = 'IPF_ORM_Template_'.$template;
            else
                $classname = $template;

            if (is_array($options))
                $options = self::varExport($options);
            else
                $options = '';

            $build[] = "    \$table->addTemplate(new $classname($options));";
        }
    }

    private function buildAttributes(array $attributes)
    {
        $build = PHP_EOL;
        foreach ($attributes as $key => $value) {

            if (is_bool($value)) {
                $values = $value ? 'true':'false';
            } else {
                if (!is_array($value))
                    $value = array($value);

                $values = '';
                foreach ($value as $attr) {
                    $values .= "IPF_ORM::" . strtoupper($key) . "_" . strtoupper($attr) . ' ^ ';
                }

                // Trim last ^
                $values = substr($values, 0, strlen($values) - 3);
            }

            $build .= "    \$table->setAttribute(IPF_ORM::ATTR_" . strtoupper($key) . ", " . $values . ");" . PHP_EOL;
        }

        return $build;
    }

    private function buildOptions(array $options)
    {
        $build = '';
        foreach ($options as $name => $value) {
            $build .= "    \$table->setOption('$name', " . self::varExport($value) . ");" . PHP_EOL;
        }
        return $build;
    }

    public function buildRecord(array $definition, $targetPath)
    {
        if (!isset($definition['className']))
            throw new IPF_ORM_Exception('Missing class name.');

        $this->writeBaseDefinition($definition, $targetPath);
        $this->writeModelDefinition($definition, $targetPath);
    }

    private function writeBaseDefinition(array $definition, $targetPath)
    {
        $code = array(
            '<?php',
            '',
            '/**',
            ' * This class has been auto-generated by the IPF_ORM Framework.',
            ' * Changes to this file may cause incorrect behavior',
            ' * and will be lost if the code is regenerated.',
            ' */',
            '',
        );

        if (isset($definition['connection']) && $definition['connection']) {
            $code[] = '// Connection Component Binding';
            $code[] = "IPF_ORM_Manager::getInstance()->bindComponent('" . $definition['connectionClassName'] . "', '" . $definition['connection'] . "');";
            $code[] = '';
        }

        $code[] = 'abstract class '.$this->_baseClassPrefix.$definition['className'].' extends IPF_ORM_Record';
        $code[] = '{';
        $code[] = $this->buildTableDefinition($definition);
        $code[] = '';
        $code   = array_merge($code, $this->buildSetUp($definition));
        $code[] = '';
        $code   = array_merge($code, $this->buildShortcuts($definition));
        $code[] = '}';

        $fileName = $this->_baseClassPrefix . $definition['className'] . '.php';
        $writePath = $targetPath . DIRECTORY_SEPARATOR . $this->_baseClassesDirectory;
        IPF_Utils::makeDirectories($writePath);
        $writePath .= DIRECTORY_SEPARATOR . $fileName;

        if (file_put_contents($writePath, implode(PHP_EOL, $code)) === false)
            throw new IPF_ORM_Exception("Couldn't write file " . $writePath);
    }

    private function buildShortcuts(array $definition)
    {
        return array(
            '  public static function table()',
            '  {',
            '    return IPF_ORM::getTable(\''.$definition['className'].'\');',
            '  }',
            '',
            '  public static function query($alias=\'\')',
            '  {',
            '    return IPF_ORM::getTable(\''.$definition['className'].'\')->createQuery($alias);',
            '  }',
        );
    }

    private function writeModelDefinition(array $definition, $targetPath)
    {
        $className = $definition['className'];
        $adminClassName = $className.'Admin';

        $writePath = $targetPath . DIRECTORY_SEPARATOR . $className . '.php';
        if (file_exists($writePath))
            return;

        $code = array(
            '<?php',
            '',
            sprintf('class %s extends %s%s', $className, $this->_baseClassPrefix, $className),
            '{',
            '}',
            '',
            '/*',
            'class '.$adminClassName.' extends IPF_Admin_Model',
            '{',
            '}',
            '',
            'IPF_Admin_Model::register(\''.$className.'\', \''.$adminClassName.'\');',
            '*/',
            '',
        );

        IPF_Utils::makeDirectories($targetPath);
        if (file_put_contents($writePath, implode(PHP_EOL, $code)) === false)
            throw new IPF_ORM_Exception("Couldn't write file " . $writePath);
    }
}


text:
/**
 * Jakarta Bean Validation TCK
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */
package org.hibernate.beanvalidation.tck.tests.xmlconfiguration.constraintdefinition;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import jakarta.validation.ValidationException;

/**
 * Check that a char sequence's length is between min and max.
 *
 * @author Hardy Ferentschik
 */
public class DummyLengthValidator implements ConstraintValidator<Length, CharSequence> {
	private int min;
	private int max;

	@Override
	public void initialize(Length parameters) {
		min = parameters.min();
		max = parameters.max();
		validateParameters();
	}

	@Override
	public boolean isValid(CharSequence value, ConstraintValidatorContext constraintValidatorContext) {
		if ( value == null ) {
			return true;
		}
		int length = value.length();
		return length >= min && length <= max;
	}

	private void validateParameters() {
		if ( min < 0 ) {
			throw new ValidationException( "The min parameter cannot be negative." );
		}
		if ( max < 0 ) {
			throw new ValidationException( "The max paramter cannot be negative." );
		}
		if ( max < min ) {
			throw new ValidationException( "The length cannot be negative." );
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
  <button ng-disabled="submitting" type='button' class="button red-button" ng-click="hide()">Cancel</button>
  <button ng-disabled="submitting" ng-disabled="exercise_type" ng-click="submit()" type="button" class="button green-button two-buttons">
    {{submitting | then:"Saving...":"Confirm"}}
  </button>


text:
/***/
var util = require('util'), events = require('events'), crypto = require('crypto');
var fs = require('fs'), URL = require('url'), path = require('path');

var STATE = {
  CONNECTING: 0,
  OPEN: 1,
  CLOSING: 2,
  CLOSED: 3
};

module.exports = exports = WebSocket;

var EVTS = ['close', '_closing', 'connect', 'error', 'message'], length = EVTS.length;

function WebSocket() {
  var self = this;
  events.EventEmitter.call(self);

  self.readyState = STATE.CONNECTING;

  self.on('error', function(err) {
    self.close(err && err.message);
    if('function' === typeof self.onerror)
      self.onerror(err);
  });

  self.on('close', function() {
    self.readyState = STATE.CLOSED;
    if('function' === typeof self.onclose)
      self.onclose();
  });

  self.on('open', function() {
    self.readyState = STATE.OPEN;
    if('function' === typeof self.onopen)
      self.onopen();
  });

  self.on('message', function() {
    if('function' === typeof self.onmessage)
      self.onmessage();
  });

  self.on('_closing', function(reason) {
    self.readyState = STATE.CLOSING;
    process.nextTick(function() {
      close.call(self, reason);
    });
  });

  self.on('connect', function() {
    self.emit('open');
  });

  var args = arguments;
  process.nextTick(function() {
    handShake.apply(self, args);
  });
}
util.inherits(WebSocket, events.EventEmitter);

function handShake() {
  var self = this;
  var arg0 = arguments[0], arg1 = arguments[1], arg2 = arguments[2], arg3 = arguments[3];

  var Protocol = require('./' + _getProtocol.apply(null, arguments));
  var protocol = self.protocol = new Protocol(arg0, arg1, arg2, arg3);

  var i = length, evts = EVTS;
  for(; i--;)
    _bubbling(evts[i], protocol, self);

  self.on('connect', function(socket) {
    self.secure = !!socket.encrypted;
    var _socket = socket['socket'] || socket;
    _socket.setTimeout(0);
    _socket.setNoDelay(true);
    _socket.setKeepAlive(true, 0);
  });
  protocol.handShake.apply(protocol, arguments);

};

function close(reason) {
  var self = this, protocol = self.protocol;
  self.send = function() {
  };
  protocol.close(reason);
}

WebSocket.prototype.send = function() {
  var protocol = this.protocol;
  protocol.write.apply(protocol, arguments);
};

WebSocket.prototype.close = function(reason) {
  this.emit('_closing');
};

WebSocket.prototype.addEventListener = WebSocket.prototype.addListener;

function _bubbling(evt, from, to) {
  from.on(evt, function() {
    var args = Array.prototype.slice.call(arguments);
    args.unshift(evt);
    to.emit.apply(to, args);
  });
}

function _getProtocol(arg0) {
  // for client
  if('string' === typeof arg0)
    return 'rfc6455';

  var header = arg0['headers'];
  var version = header['sec-websocket-version'];

  if('8' === version)
    return 'draft-10';

  if(header['sec-websocket-key1'] && header['sec-websocket-key2'])
    return 'draft-00';
  // default: rfc6455
  return 'rfc6455';
}


text:
using Microsoft.Azure.Commands.Sql.Database.Cmdlet;
using Microsoft.Azure.Commands.Sql.ServiceTierAdvisor.Cmdlet;
using Microsoft.Azure.Commands.Sql.Test.Utilities;
using Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using System;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.Sql.Test.UnitTests
{
    public class AzureSqlServiceTierAdvisorAttributeTests
    {
        public AzureSqlServiceTierAdvisorAttributeTests(ITestOutputHelper output)
        {
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetAzureSqlDatabaseUpgradeHintAttributes()
        {
            Type type = typeof(GetAzureSqlDatabaseUpgradeHint);
            UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: false);
            UnitTestHelper.CheckConfirmImpact(type, System.Management.Automation.ConfirmImpact.None);

            UnitTestHelper.CheckCmdletParameterAttributes(type, "ServerName", isMandatory: true, valueFromPipelineByName: true);
            UnitTestHelper.CheckCmdletParameterAttributes(type, "DatabaseName", isMandatory: false, valueFromPipelineByName: true);
            UnitTestHelper.CheckCmdletParameterAttributes(type, "ExcludeElasticPoolCandidates", isMandatory: false, valueFromPipelineByName: true);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetAzureSqlServerUpgradeHintAttributes()
        {
            Type type = typeof(GetAzureSqlServerUpgradeHint);
            UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: false);
            UnitTestHelper.CheckConfirmImpact(type, System.Management.Automation.ConfirmImpact.None);

            UnitTestHelper.CheckCmdletParameterAttributes(type, "ServerName", isMandatory: true, valueFromPipelineByName: true);
            UnitTestHelper.CheckCmdletParameterAttributes(type, "ExcludeElasticPools", isMandatory: false, valueFromPipelineByName: true);
        }

        [Fact]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void GetAzureSqlDatabaseExpandedAttributes()
        {
            Type type = typeof(GetAzureSqlDatabaseExpanded);
            UnitTestHelper.CheckCmdletModifiesData(type, supportsShouldProcess: false);
            UnitTestHelper.CheckConfirmImpact(type, System.Management.Automation.ConfirmImpact.None);

            UnitTestHelper.CheckCmdletParameterAttributes(type, "ServerName", isMandatory: true, valueFromPipelineByName: true);
            UnitTestHelper.CheckCmdletParameterAttributes(type, "DatabaseName", isMandatory: false, valueFromPipelineByName: true);
        }
    }
}


text:
import _jsx from "@babel/runtime/helpers/builtin/jsx";
import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import compose from 'recompose/compose';
import withProps from 'recompose/withProps';
import { DragSource } from 'react-dnd';
import DragIcon from "@material-ui/icons/es/DragHandle";
import RemoveIcon from "@material-ui/icons/es/Close";
import { WAITLIST_USER } from '../../constants/DDItemTypes';
import userCardable from '../../utils/userCardable';
import Avatar from '../Avatar';
import Username from '../Username';
import Position from './Position';
var userSource = {
  beginDrag: function beginDrag(props) {
    return {
      user: props.user
    };
  },
  endDrag: function endDrag(props, monitor) {
    var result = monitor.getDropResult();
    var item = monitor.getItem();

    if (item.user && result) {
      props.onMoveUser(result.position);
    }
  }
};

var collect = function collect(connect, monitor) {
  return {
    isDragging: monitor.isDragging(),
    connectDragSource: connect.dragSource(),
    connectDragPreview: connect.dragPreview()
  };
};
/**
 * A Draggable waitlist user row with moderation tools.
 */

var _ref2 =
/*#__PURE__*/
_jsx("div", {
  className: "WaitlistRow-tool WaitlistRow-handle"
}, void 0, _jsx(DragIcon, {}));

var _ref3 =
/*#__PURE__*/
_jsx(RemoveIcon, {});

var ModRowBase = function ModRowBase(_ref) {
  var className = _ref.className,
      position = _ref.position,
      user = _ref.user,
      isDragging = _ref.isDragging,
      connectDragPreview = _ref.connectDragPreview,
      connectDragSource = _ref.connectDragSource,
      onOpenCard = _ref.onOpenCard,
      onRemoveUser = _ref.onRemoveUser;
  return connectDragPreview(_jsx("div", {
    className: cx('UserRow', 'WaitlistRow', 'WaitlistRow--moderate', isDragging && 'is-dragging', className)
  }, void 0, _jsx(Position, {
    position: position + 1
  }), _jsx("button", {
    className: "WaitlistRow-card",
    onClick: onOpenCard
  }, void 0, _jsx(Avatar, {
    className: "UserRow-avatar",
    user: user
  }), _jsx(Username, {
    className: "UserRow-username",
    user: user
  })), _jsx("div", {
    className: "WaitlistRow-tools"
  }, void 0, connectDragSource(_ref2), _jsx("button", {
    className: "WaitlistRow-tool WaitlistRow-remove",
    onClick: onRemoveUser
  }, void 0, _ref3))));
};

ModRowBase.propTypes = process.env.NODE_ENV !== "production" ? {
  className: PropTypes.string,
  position: PropTypes.number.isRequired,
  user: PropTypes.object.isRequired,
  connectDragPreview: PropTypes.func.isRequired,
  connectDragSource: PropTypes.func.isRequired,
  onMoveUser: PropTypes.func.isRequired,
  onRemoveUser: PropTypes.func.isRequired
} : {};
export default compose(DragSource(WAITLIST_USER, userSource, collect), userCardable(), withProps(function (props) {
  return {
    onOpenCard: function onOpenCard(event) {
      event.preventDefault();
      props.openUserCard(props.user);
    }
  };
}))(ModRowBase);
//# sourceMappingURL=ModRowBase.js.map


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Aust. Syst. Bot. 10(5): 766 (1997)

#### Original name
Amanita gracilenta A.E. Wood

### Remarks
null


text:
package com.android.browser;

import android.provider.Browser;
import android.view.LayoutInflater;
import android.view.View;

/* package */ class SelectDialog extends WebDialog {
    private View mCopyButton;
    private View mSelectAllButton;
    private View mShareButton;
    private View mFindButton;

    SelectDialog(BrowserActivity context) {
        super(context);
        LayoutInflater factory = LayoutInflater.from(context);
        factory.inflate(R.layout.browser_select, this);
        addCancel();

        mCopyButton = findViewById(R.id.copy);
        mCopyButton.setOnClickListener(mCopyListener);
        mSelectAllButton = findViewById(R.id.select_all);
        mSelectAllButton.setOnClickListener(mSelectAllListener);
        mShareButton = findViewById(R.id.share);
        mShareButton.setOnClickListener(mShareListener);
        mFindButton = findViewById(R.id.find);
        mFindButton.setOnClickListener(mFindListener);
    }

    private View.OnClickListener mCopyListener = new View.OnClickListener() {
        public void onClick(View v) {
            mWebView.copySelection();
            mBrowserActivity.closeDialogs();
        }
    };

    private View.OnClickListener mSelectAllListener = new View.OnClickListener() {
        public void onClick(View v) {
            mWebView.selectAll();
        }
    };

    private View.OnClickListener mShareListener = new View.OnClickListener() {
        public void onClick(View v) {
            String selection = mWebView.getSelection();
            Browser.sendString(mBrowserActivity, selection);
            mBrowserActivity.closeDialogs();
        }
    };

    private View.OnClickListener mFindListener = new View.OnClickListener() {
        public void onClick(View v) {
            String selection = mWebView.getSelection();
            mBrowserActivity.closeDialogs();
            mBrowserActivity.showFindDialog();
            mBrowserActivity.setFindDialogText(selection);
        }
    };

    /**
     * Called by BrowserActivity.closeDialog.  Start the animation to hide
     * the dialog, and inform the WebView that the dialog is being dismissed.
     */
    @Override
    public void dismiss() {
        super.dismiss();
        mWebView.notifySelectDialogDismissed();
    }

}


text:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace Examples
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = null;
            SolidEdgeFramework.Documents documents = null;
            SolidEdgeDraft.DraftDocument draftDocument = null;
            SolidEdgeDraft.Sheet sheet = null;
            SolidEdgeFrameworkSupport.FeatureControlFrames featureControlFrames = null;
            SolidEdgeFrameworkSupport.FeatureControlFrame featureControlFrame = null;

            try
            {
                // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register();

                // Attempt to connect to a running instance of Solid Edge.
                application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
                documents = application.Documents;
                draftDocument = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument");
                sheet = draftDocument.ActiveSheet;
                featureControlFrames = (SolidEdgeFrameworkSupport.FeatureControlFrames)sheet.FeatureControlFrames;

                featureControlFrame = featureControlFrames.Add(0.1, 0.1, 0);
                featureControlFrame.PrimaryFrame = "%FL%VB0.001%MC%VBA";
                featureControlFrame.AddVertex(0.2, 0.2, 0);

                var document = (SolidEdgeFramework.SolidEdgeDocument)featureControlFrame.Document;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}


text:
(function(CoreWM, Panel, PanelItem, Utils, API, VFS) {
  'use strict';

  /////////////////////////////////////////////////////////////////////////////
  // ITEM
  /////////////////////////////////////////////////////////////////////////////

  /**
   * PanelItem: AppMenu
   */
  var PanelItemAppMenu = function(settings) {
    PanelItem.apply(this, ['PanelItemAppMenu PanelItemFill', 'AppMenu', settings, {}]);
    this.$container = null;
  };

  PanelItemAppMenu.prototype = Object.create(PanelItem.prototype);
  PanelItemAppMenu.Name = 'AppMenu'; // Static name
  PanelItemAppMenu.Description = 'Application Menu'; // Static description
  PanelItemAppMenu.Icon = 'actions/stock_about.png'; // Static icon
  PanelItemAppMenu.HasOptions = false;

  PanelItemAppMenu.prototype.init = function() {
    var self = this;
    var root = PanelItem.prototype.init.apply(this, arguments);
    var wm = OSjs.Core.getWindowManager();

    this.$container = document.createElement('ul');
    root.appendChild(this.$container);

    var sel = document.createElement('li');
    sel.className = 'Button';
    sel.title = API._('LBL_APPLICATIONS');
    sel.innerHTML = '<img alt="" src="' + API.getIcon(wm.getSetting('icon') || 'osjs-white.png') + '" />';

    Utils.$bind(sel, 'click', function(ev) {
      ev.preventDefault();
      ev.stopPropagation();
      OSjs.Applications.CoreWM.showMenu(ev);
    });
    Utils.$bind(sel, 'contextmenu', function(ev) {
      ev.preventDefault();
      ev.stopPropagation();
    });

    this.$container.appendChild(sel);

    return root;
  };

  PanelItemAppMenu.prototype.destroy = function() {
    this.$container = null;
    PanelItem.prototype.destroy.apply(this, arguments);
  };

  /////////////////////////////////////////////////////////////////////////////
  // EXPORTS
  /////////////////////////////////////////////////////////////////////////////

  OSjs.Applications                                    = OSjs.Applications || {};
  OSjs.Applications.CoreWM                             = OSjs.Applications.CoreWM || {};
  OSjs.Applications.CoreWM.PanelItems                  = OSjs.Applications.CoreWM.PanelItems || {};
  OSjs.Applications.CoreWM.PanelItems.AppMenu          = PanelItemAppMenu;

})(OSjs.Applications.CoreWM.Class, OSjs.Applications.CoreWM.Panel, OSjs.Applications.CoreWM.PanelItem, OSjs.Utils, OSjs.API, OSjs.VFS);


text:
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

      <title>Documentation for xcesc - systemManagement.xsd - Element systemManagement</title>
      <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1"/>

         Documentation for xcesc

Element: systemManagement

         [Table of contents]

            Name
            systemManagement

            Type
            Locally-defined complex type

               Nillable

            no

               Abstract

            no

            Documentation
            The root element for this piece of configuration

            <input type="button" id="h-1109675339_logicalDiagram_button" class="control"
                   onclick="switchState('h-1109675339_logicalDiagram'); return false;"
                   style="display: none"/>
            Logical Diagram

            <map name="h-1354660659">
</map>

            <input type="button" id="h-1109675339_xibox_button" class="control"
                   onclick="switchState('h-1109675339_xibox'); return false;"
                   style="display: none"/>
            XML Instance Representation

<mgmt:systemManagement

                projectName="
                     xs:string
                  [1]

'The project name for this XCESC instance'
"

                collection="
                     xs:string
                  [1]

'The collection where the management data (users, groups, registered servers) is going to be stored'
"

                group="
                     xs:string
                  [1]

'The eXist XCESC instance group'
"

                managementDoc="
                     xs:string
                  [1]

'The name of the document where management data (users, groups, registered servers) is being stored'
"

                publicServerName="
                     xs:string
                  [1]

'The public server name for this XCESC installation.'
"

                publicServerPort="
                     xs:anyURI
                  [1]

'The public server port for this XCESC installation.'
"

                publicBasePath="
                     xs:anyURI
                  [1]

'The public base query path for this XCESC installation.'
"

                publicLogicRelURI="
                     xs:string
                  [1]

'The name of the relative URI used for callable external logic in this XCESC installation.'
">

<mgmt:admin

                   user="
                        xs:string
                     [1]

'The eXist XCESC instance superuser'
"

                   password="
                        xs:string
                     [1]

'The eXist XCESC instance superpass'
"

                   mail="
                        xs:string
                     [1]

'The manager e-mail'
"/>  [1]

<mgmt:availableRoles>  [1]

'The list of database available roles'

<mgmt:role

                      name="
                           xs:string
                        [1]

'The role name'
"

                      isSuperUser="
                           xs:boolean
                        [0..1]

'Is a superuser role?'
"

                      description="
                           xs:string
                        [1]

'The description of the role'
"/>  [1..*]

</mgmt:availableRoles>
</mgmt:systemManagement>

            <input type="button" id="h-1109675339_diagram_button" class="control"
                   onclick="switchState('h-1109675339_diagram'); return false;"
                   style="display: none"/>
            Diagram

            <map name="h558738051">
</map>

            <input type="button" id="h-1109675339_scbox_button" class="control"
                   onclick="switchState('h-1109675339_scbox'); return false;"
                   style="display: none"/>
            Schema Component Representation

<xs:element
               name="systemManagement">
<xs:complexType>
<xs:sequence>
<xs:element
                        name="admin" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:attribute
                              name="user" type="

                                    xs:string
                              " use="required"/>

<xs:attribute
                              name="password" type="

                                    xs:string
                              " use="required"/>

<xs:attribute
                              name="mail" type="

                                    xs:string
                              " use="required"/>
</xs:complexType>
</xs:element>

<xs:element
                        name="availableRoles">
<xs:complexType>
<xs:sequence
                              minOccurs="1" maxOccurs="1">
<xs:element
                                 name="role" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute
                                       name="name" type="

                                             xs:string
                                       " use="required"/>

<xs:attribute
                                       name="isSuperUser" type="

                                             xs:boolean
                                       " use="optional" default="false"/>

<xs:attribute
                                       name="description" type="

                                             xs:string
                                       " use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>

<xs:attribute
                     name="projectName" type="

                           xs:string
                     " use="required"/>

<xs:attribute
                     name="collection" type="

                           xs:string
                     " use="required"/>

<xs:attribute
                     name="group" type="

                           xs:string
                     " use="required"/>

<xs:attribute
                     name="managementDoc" type="

                           xs:string
                     " use="required"/>

<xs:attribute
                     name="publicServerName" type="

                           xs:string
                     " use="required"/>

<xs:attribute
                     name="publicServerPort" type="

                           xs:anyURI
                     " use="required"/>

<xs:attribute
                     name="publicBasePath" type="

                           xs:anyURI
                     " use="required"/>

<xs:attribute
                     name="publicLogicRelURI" type="

                           xs:string
                     " use="required"/>
</xs:complexType>
</xs:element>

Generated by <oXygen/> XML Editor using a modified version of xs3p that adds schema diagrams and chunking support. Last modified:


text:
// Generated by LiveScript 1.4.0

(function(){
  Polymer.cs.behaviors.csLabelButton = [
    Polymer.cs.behaviors.label, Polymer.cs.behaviors['this'], Polymer.cs.behaviors.tooltip, {
      hostAttributes: {
        role: 'button'
      },
      properties: {
        first: {
          reflectToAttribute: true,
          type: Boolean
        },
        last: {
          reflectToAttribute: true,
          type: Boolean
        }
      },
      ready: function(){
        var ref$, ref1$;
        if (((ref$ = this.previousElementSibling) != null ? ref$.is : void 8) !== this.is) {
          this.first = true;
        }
        if (((ref1$ = this.nextElementSibling) != null ? ref1$.getAttribute('is') : void 8) !== this.is) {
          return this.last = true;
        }
      }
    }
  ];
}).call(this);


text:
var CaptureEngine = require('../lib/capture-engine');
var config = require('../config');
/**
 * Capture la page demandée/
 * @param  {object} request - La requête HTTP.
 * @param  {object} reply   - La response HTTP.
 * @return {undefined}
 */
function capturePage(request, reply) {
  var criteria = request.payload;
  var url = criteria.url,
    filePath = criteria.filePath;
  CaptureEngine.process(url, filePath, config.user)
    .then(function(data) {
      reply(data);
    }, function(err) {
      reply({
        error: JSON.stringify(err)
      }).code(500);
    });
}

module.exports = {
  method: 'POST',
  path: '/capture',
  config: {
    handler: capturePage
  }
};


text:
package gov.va.contentlib.controllers;

import gov.va.contentlib.content.Content;

import java.util.List;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.actionbarsherlock.internal.widget.IcsLinearLayout;

public class ButtonGridController extends ContentViewControllerBase {

//	Theme buttonTheme;
	ViewGroup grid;
	List<Content> buttons;

	final static int SETUP_BUTTON = 1001;
	final static int FAVORITES_BUTTON = 1002;

	public ButtonGridController(Context ctx) {
		super(ctx);
	}

	class SelectionOverlay extends View {
		Drawable drawable;
		public SelectionOverlay(Context ctx) {
			super(ctx);
			drawable = getContentResources().getDrawable(getResourceAttr(gov.va.daelib.R.attr.contentListChoiceBackgroundIndicator));
		}

		@Override
		protected void drawableStateChanged() {
			super.drawableStateChanged();
			if (drawable != null) {
				int [] state = ((View)getParent()).getDrawableState();
				drawable.setState(state);
			}
			invalidate();
		}

		@Override
		protected void onDraw(Canvas canvas) {
			// TODO Auto-generated method stub
			super.onDraw(canvas);
			//boolean pressed = isPressed();

			//if (!pressed) return;

			int l = getLeft();
			int r = getRight();
			int t = getTop();
			int b = getBottom();

			drawable.setBounds(l,t,r,b);
			drawable.draw(canvas);
		}
	}

	class PictureButton extends ViewGroup {
		ImageView icon;
		TextView label;
		SelectionOverlay overlay;
		Paint selectionOverlay;
		Drawable buttonBackground;
		int paddingLeft, paddingRight;
		int orientation = IcsLinearLayout.HORIZONTAL;

		public PictureButton(Context ctx) {
			super(ctx);
			DisplayMetrics dm = getResources().getDisplayMetrics();
			LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
			icon = new ImageView(ctx);
			icon.setScaleType(ScaleType.CENTER_INSIDE);
			addView(icon,p);
			p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
			label = new TextView(ctx);
			label.setTextAppearance(getContext(), getResourceAttr(android.R.attr.textAppearanceLarge));
//			label.setTextColor(theme.getTextColor());
//			label.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, theme.getFontSize(), dm));
			p.weight = 1;

			overlay = new SelectionOverlay(getContext());
			addView(overlay,new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
			addView(label,p);

			label.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
//			buttonBackground = getContentResources().getDrawable(getResourceAttr(gov.va.daelib.R.attr.contentListChoiceBackgroundIndicator));
//			setBackgroundDrawable(buttonBackground);
			paddingLeft = (int)getDimAttr(gov.va.daelib.R.attr.contentListPreferredItemPaddingLeft);
			paddingRight = (int)getDimAttr(gov.va.daelib.R.attr.contentListPreferredItemPaddingRight);
//			setPadding((int)getDimAttr(gov.va.daelib.R.attr.contentListPreferredItemPaddingLeft), 0, (int)getDimAttr(gov.va.daelib.R.attr.contentListPreferredItemPaddingRight), 0);

//            setBackgroundDrawable(getContentResources().getDrawable(getResourceAttr(gov.va.daelib.R.attr.contentListChoiceBackgroundIndicator)));

/*
			buttonBackground = theme.getBackgroundImage();
			setBackgroundDrawable(buttonBackground);
			Rect padding = new Rect();
			if (buttonBackground.getPadding(padding)) {
				setPadding(
					(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, padding.left, dm),
					(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, padding.top, dm),
					(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, padding.right, dm),
					(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, padding.bottom, dm));
			}
*/
			setClickable(true);
            setFocusable(true);
            setFocusableInTouchMode(false);
		}

        public void setOrientation(int o) {
			orientation = o;
			if (o == IcsLinearLayout.HORIZONTAL) {
				label.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
			} else {
				label.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
			}
		}

		@Override
		protected void drawableStateChanged() {
			super.drawableStateChanged();
            overlay.drawableStateChanged();
			if (buttonBackground != null) {
				boolean pressed = isPressed();
				int [] state = getDrawableState();
//				buttonBackground.setState(state);
//				setPadding((int)getDimAttr(gov.va.daelib.R.attr.contentListPreferredItemPaddingLeft), 0, (int)getDimAttr(gov.va.daelib.R.attr.contentListPreferredItemPaddingRight), 0);
			}
			invalidate();
		}

		@Override
		protected void onLayout(boolean changed, int left, int top, int right, int bottom) {

			int width = right-left-getPaddingLeft()-getPaddingRight()-paddingLeft-paddingRight;
			int height = bottom-top-getPaddingTop()-getPaddingBottom();

			if (orientation == IcsLinearLayout.HORIZONTAL) {
				if ((icon != null) && (icon.getDrawable() != null)) {
					int iwidth = icon.getDrawable().getIntrinsicWidth();
					int iheight = icon.getDrawable().getIntrinsicHeight();
					int w = iwidth;
					int h = iheight;
					if (w > width/2) {
						w = width/2;
						h = w * iheight / iwidth;
					}

					if (h > height) {
						h = height;
						w = h * iwidth / iheight;
					}
					icon.layout(getPaddingLeft()+paddingLeft, getPaddingTop(), w, h);

					int l = getPaddingLeft()+w+paddingLeft;
					int t = getPaddingTop();
					int b = getPaddingTop()+height;
					int r = getPaddingLeft()+width+paddingLeft;
					label.measure(MeasureSpec.makeMeasureSpec(r-l, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(b-t, MeasureSpec.EXACTLY));
					int mheight = label.getMeasuredHeight();
					/*
					if (b-t > mheight) {
						int center = (b-t)/2;
						t = center - mheight/2;
						b = t+mheight;
					}
					 */
					label.layout(l, t, r, b);
				}
			} else {
				int l = getPaddingLeft()+paddingLeft;
				int t = getPaddingTop();
				int b = getPaddingTop()+height;
				int r = getPaddingLeft()+width+paddingLeft;
				label.setPadding(0, 0, 0, 20);
				label.measure(MeasureSpec.makeMeasureSpec(r-l, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(b-t, MeasureSpec.AT_MOST));
				int mheight = label.getMeasuredHeight();

				if ((icon != null) && (icon.getDrawable() != null)) {
					int iwidth = icon.getDrawable().getIntrinsicWidth();
					int iheight = icon.getDrawable().getIntrinsicHeight();
					int w = iwidth;
					int h = iheight;
					if (mheight > height/2) {
						mheight = height/2;
					}
					if (h > height-mheight) {
						h = height-mheight;
						w = h * iwidth / iheight;
					}
					if (w > width) {
						w = width;
						h = w * iheight / iwidth;
					}
					if (h > height*2/3) {
						h = height*2/3;
						w = h * iwidth / iheight;
					}

					t = h+getPaddingTop();
					b = t+mheight;

					int totalHeight = (b-t)+h;
					int offset = (height-totalHeight)/2;

					int imageLeft = getPaddingLeft()+paddingLeft+width/2-w/2;
					icon.layout(imageLeft, getPaddingTop()+offset, imageLeft+w, getPaddingTop()+h+offset);

					t+=offset;
//					b+=offset;
					b = height+getPaddingTop();
					t = b-mheight;
				} else {
					int center = (b-t)/2;
					t = center - mheight/2;
					b = t+mheight;
				}
				label.layout(l, t, r, b);
			}

			overlay.layout(0,0,right-left,bottom-top);
		}

	}

	@Override
	public boolean shouldUseScroller() {
		return false;
	}

	class SimpleGridLayout extends ViewGroup {
		int columns;
		Drawable divider;

		public SimpleGridLayout(Context ctx, int cols) {
			super(ctx);
			columns = cols;
			divider = getContentResources().getDrawable(getResourceAttr(android.R.attr.listDivider));
			setWillNotDraw(false);
            setFocusable(false);
		}

		@Override
		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
			int l = getLeft();
			int r = getRight();
			int t = getTop();
			int b = getBottom();

			int width = r-l;
			int height = b-t;
			int rows = (getChildCount() + columns-1) / columns;
			for (int i=0;i<columns;i++) {
				int left = i * width / columns;
				int right = (i+1) * width / columns;
				int top = t;
				int bottom = b;
				divider.setBounds(left-1,top,left+1,bottom);
				divider.draw(canvas);
			}
			for (int i=0;i<rows;i++) {
				int top = i * height / rows;
				int left = l;
				int right = r;
				divider.setBounds(left,top-1,right,top+1);
				divider.draw(canvas);
			}
		}

		@Override
		protected void onLayout(boolean changed, int l, int t, int r, int b) {
			int width = r-l;
			int height = b-t;
			int rows = (getChildCount() + columns-1) / columns;
			for (int i=0;i<getChildCount();i++) {
				int row = i / columns;
				int col = i % columns;
				int left = col * width / columns;
				int right = (col+1) * width / columns;
				int top = row * height / rows;
				int bottom = (row+1) * height / rows;
				View v = getChildAt(i);
				v.layout(left,top,right,bottom);
			}
		}

        public void init() {
            /*
            for (int i=0;i<getChildCount();i++) {
                int col = i%columns;
                View me = getChildAt(i);
                int upIndex = i - columns;
                int downIndex = i + columns;
                int rightIndex = i + 1;
                int leftIndex = i - 1;
                if (upIndex >= 0) me.setNextFocusUpId(getChildAt(upIndex).getId());
                if (leftIndex >= 0) {
                    me.setNextFocusLeftId(getChildAt(leftIndex).getId());
                    me.setNextFocusForwardId(getChildAt(leftIndex).getId());
                }
                if (downIndex < getChildCount()) me.setNextFocusDownId(getChildAt(downIndex).getId());
                if (rightIndex < getChildCount()) {
                    me.setNextFocusRightId(getChildAt(rightIndex).getId());
                    me.setNext(getChildAt(leftIndex).getId());
                }
            }
            */
        }
	}

	@SuppressLint("NewApi")
	@Override
	public void buildClientViewFromContent() {
		super.buildClientViewFromContent();

//		buttonTheme = getTheme().getSubtheme("button");

		Integer cellsPerRow = getContent().getIntAttribute("buttongrid_cellsPerRow");
		Integer outerMarginX = getContent().getIntAttribute("buttongrid_outerMarginX");
		Integer outerMarginY = getContent().getIntAttribute("buttongrid_outerMarginY");
		Integer cellMarginY = getContent().getIntAttribute("buttongrid_cellMarginX");
		Integer cellMarginX = getContent().getIntAttribute("buttongrid_cellMarginY");

		if (cellMarginX == null) cellMarginX = 3;
		if (cellMarginY == null) cellMarginY = 3;

		String showTitle = content.getStringAttribute("showTitle");
		if ((showTitle != null) && (showTitle.equals("true"))) {
			String title = content.getTitle();
			if (title != null) {
				clientView.addView(makeTitleView(title));
			}
		}

		String mainText = getContent().getMainText();
		if (mainText != null) {
			View wv = makeTextView(mainText);
			clientView.addView(wv);
		}

		if (cellsPerRow > 1) {
			SimpleGridLayout g = new SimpleGridLayout(getContext(), cellsPerRow);
			grid = g;
		} else {
			IcsLinearLayout ll = new IcsLinearLayout(getContext(),null);
			ll.setOrientation(IcsLinearLayout.VERTICAL);
			ll.setShowDividers(IcsLinearLayout.SHOW_DIVIDER_MIDDLE);
			ll.setDividerDrawable(getContentResources().getDrawable(getResourceAttr(android.R.attr.listDivider)));
			ll.setBackgroundColor(0);
			ll.setId(100);

			grid = ll;
		}

		LinearLayout.LayoutParams layout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
		layout.weight = 1;
		grid.setLayoutParams(layout);

		int columns = (cellsPerRow == null) ? 2 : cellsPerRow;
//		grid.setColumns(columns);
		buttons = getContent().getChildren();

		int count = 0;
		for (final Content button : buttons) {
			PictureButton b = new PictureButton(getContext());
			if (cellsPerRow > 1) b.setOrientation(IcsLinearLayout.VERTICAL);
			b.label.setMaxLines(3);
			b.setId(count);
			b.setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					contentSelected(button);
				}
			});
            b.setContentDescription(button.getDisplayName()+" button");
			b.label.setText(button.getDisplayName());
			b.label.setSingleLine(false);
			Drawable image = button.getIcon();
			if (image != null) {
				if (columns == 1) {
					b.icon.setImageDrawable(image);
				} else {
					b.icon.setImageDrawable(image);
				}
			}

			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
			lp.weight = 1;
			lp.gravity = Gravity.CENTER;

			grid.addView(b,lp);
			b.requestLayout();
			count++;
		}

		clientView.addView(grid);
	}
/*
	public void contentSelected(Content c) {
		getNavigator().contentSelected(c);
	}
*/
	/*
	public void handleButtonTap(int id) {
		if (id == SETUP_BUTTON) {
			HomeNavigationController nc = (HomeNavigationController)getNavigator();
			nc.gotoSetup();
			return;
		}

		if (id == FAVORITES_BUTTON) {
			ManageNavigationController nc = (ManageNavigationController)getNavigator();
			nc.gotoFavorites();
			return;
		}

		contentSelected(buttons.get(id));
	}

	@Override
	public void parentActivityPaused()
	{
		TopContentActivity a =(TopContentActivity)getNavigator().getParent();

		if((a != null) && a.fromBackground)
		{
			//we are going into the background,go back
			getNavigator().goBack();
		}
	}
	*/

}


text:
package org.globus.ftp.test;
import org.globus.ftp.PerfMarker;
import org.globus.ftp.exception.PerfMarkerException;

import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
   Test PerfMarker
 **/
public class PerfMarkerTest extends TestCase {

    private static Log logger =
	LogFactory.getLog(PerfMarkerTest.class.getName());

    private static String nl = System.getProperty("line.separator");
    private static String space = " ";

    public static void main(String[] argv) {
	junit.textui.TestRunner.run (suite());
    }

    public static Test suite() {
	return new TestSuite(PerfMarkerTest.class);
    }

    public PerfMarkerTest(String name) {
	super(name);
    }

    /**
       Test interesting cases of perf marker construction with
       invalid argument, and ensure that IllegalAgumentException
       is thrown.
     **/
    public void testConstructorError() {
	//make sure only IllegalArgumentE gets thrown

	/* correct:

	String msg =
	      "Perf Marker" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + " Total Stripe Count: 30" + nl
	    + "112 End" + nl;
	*/

	// no first line
	String msg =
	      " Timestamp: 111222333444.5" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + " Total Stripe Count: 30" + nl
	    + "112 End" + nl;
	assertConstructorError(msg);

	// whole reply instead of just message
	msg = "112-Perf Marker" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + " Total Stripe Count: 30" + nl
	    + "112 End" + nl;
	assertConstructorError(msg);

	// no timestamp
	msg = "Perf Marker" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + " Total Stripe Count: 30" + nl
	    + "112 End" + nl;
	assertConstructorError(msg);

	// 211 message instead of 112
	msg =
	    "Extensions supported:" + nl +
	    " REST STREAM" + nl +
	    " ESTO" + nl +
	    " ERET" + nl +
	    " MDTM" + nl +
	    " SIZE" + nl +
	    " PARALLEL" + nl +
	    " DCAU" + nl +
	    "211 END";
	assertConstructorError(msg);

    }

    /**
       test interesting cases of perf marker construction and examine its
       get() and has() methods.
     **/
    public void testObject()
    throws Exception{
	// simple
	String msg = "Perf Marker" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + " Total Stripe Count: 30" + nl
	    + "112 End" + nl;
	testObject(msg,
			 111222333444.5,
			 true, 5,
			 true, new Long("987654321987654321").longValue(),
			 true, 30);

	// unordered
	msg = "Perf Marker" + nl
	    + " Total Stripe Count: 30" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + "112 End" + nl;
	testObject(msg,
			 111222333444.5,
			 true, 5,
			 true, new Long("987654321987654321").longValue(),
			 true, 30);

	// missing stripe info
	msg = "Perf Marker" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + " Total Stripe Count: 30" + nl
	    + "112 End" + nl;
	testObject(msg,
			 111222333444.5,
			 false, 0,
			 false, 0,
			 true, 30);

	// missing count
	msg = "Perf Marker" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + " Stripe Index: 5" + nl
	    + " Stripe Bytes Transferred: 987654321987654321" + nl
	    + "112 End" + nl;
	testObject(msg,
			 111222333444.5,
			 true, 5,
			 true, new Long("987654321987654321").longValue(),
			 false, 0);

	// missing most info
        msg = "Perf Marker" + nl
	    + " Timestamp: 111222333444.5" + nl
	    + "112 End" + nl;
	testObject(msg,
			 111222333444.5,
			 false, 0,
			 false, 0,
			 false, 0);

	// zero values
	msg = "Perf Marker" + nl
	    + " Timestamp: 0" + nl
	    + " Stripe Index: 0" + nl
	    + " Stripe Bytes Transferred: 0" + nl
	    + " Total Stripe Count: 0" + nl
	    + "112 End" + nl;
	testObject(msg,
			 0,
			 true, 0,
			 true, 0,
			 true, 0);

    }//testObject

    /**
       test perf marker construction and get() and has() methods.
       "in" is constructor parameter, other params describe the
       expected object examination behavior.
     **/
    private void testObject(String in,
				  double ts,
				  boolean hasSI, long si,
				  boolean hasBT, long bt,
				  boolean hasTSC, long tsc)
    throws Exception{
	logger.info("checking object:\n" + in);
	PerfMarker m =
	    new PerfMarker(in);

	// time stamp
	assertTrue(m.getTimeStamp() == ts);

	// stripe index
	assertTrue(m.hasStripeIndex() == hasSI);
	if (m.hasStripeIndex()) {
	    assertTrue(m.getStripeIndex() == si);
	    logger.debug("okay, stripe index matches.");
	}else {
	    boolean threwOk = false;
	    try {
		m.getStripeIndex();
	    } catch (PerfMarkerException e) {
		threwOk = true;
	    }

	    if (! threwOk ) {
		fail("method did not throw an exception when it should have");
	    }
	    logger.debug("okay, throws exception as expected.");
	}

	// stripe bytes transferred
	assertTrue(m.hasStripeBytesTransferred() == hasBT);
	if (hasBT) {
	    assertTrue(m.getStripeBytesTransferred() == bt);
	    logger.debug("okay, stripe bytes transf matches.");
	}else {
	    boolean threwOk = false;
	    try {
		m.getStripeBytesTransferred();
	    } catch (PerfMarkerException e) {
		threwOk = true;
	    }

	    if (! threwOk ) {
		fail("method did not throw an exception when it should have");
	    }
	    logger.debug("okay, throws exception as expected.");
	}

	// total stripe count
	assertTrue(m.hasTotalStripeCount() == hasTSC);
	if (hasTSC) {
	    assertTrue(m.getTotalStripeCount() == tsc);
	    logger.debug("okay, stripe count matches.");
	}else {
	    boolean threwOk = false;
	    try {
		m.getTotalStripeCount();
	    } catch (PerfMarkerException e) {
		threwOk = true;
	    }

	    if (! threwOk ) {
		fail("method did not throw an exception when it should have");
	    }
	    logger.debug("okay, throws exception as expected.");
	}

    }

    /**
       Assume that arg represent an invalid message;
       ensure that constructor throws IllegalArgumentException.
     **/
    private void assertConstructorError(String arg) {
	logger.info("checking bad construction:\n" + arg);
	boolean threwOk = false;
	try {
	    new PerfMarker(arg);
	} catch (IllegalArgumentException e) {
	    threwOk = true;
	}

	if (! threwOk ) {
	    fail("constructor did not throw an exception when it should have");
	}
	logger.debug("okay, throws exception as expected.");
    }

}