answer stringlengths 15 1.25M |
|---|
#ifndef <API key>
#define <API key>
#include "fonts-tdf.h"
/* Font data for Liberation Sans 16ptb */
extern const font_info_t <API key>;
#endif |
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl\nsINetworkPredictor.idl
*/
#ifndef <API key>
#define <API key>
#ifndef <API key>
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIURI; /* forward declaration */
class nsILoadContext; /* forward declaration */
class <API key>; /* forward declaration */
typedef uint32_t <API key>;
typedef uint32_t <API key>;
/* starting interface: nsINetworkPredictor */
#define <API key> "<API key>"
#define <API key> \
{0xacc88e7c, 0x3f39, 0x42c7, \
{ 0xac, 0x31, 0x63, 0x77, 0xc2, 0xc3, 0xd7, 0x3e }}
class NS_NO_VTABLE nsINetworkPredictor : public nsISupports {
public:
<API key>(<API key>)
enum {
PREDICT_LINK = 0U,
PREDICT_LOAD = 1U,
PREDICT_STARTUP = 2U
};
/* void predict (in nsIURI targetURI, in nsIURI sourceURI, in <API key> reason, in nsILoadContext loadContext, in <API key> verifier); */
NS_IMETHOD Predict(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext, <API key> *verifier) = 0;
enum {
LEARN_LOAD_TOPLEVEL = 0U,
<API key> = 1U,
LEARN_LOAD_REDIRECT = 2U,
LEARN_STARTUP = 3U
};
/* void learn (in nsIURI targetURI, in nsIURI sourceURI, in <API key> reason, in nsILoadContext loadContext); */
NS_IMETHOD Learn(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext) = 0;
/* void reset (); */
NS_IMETHOD Reset(void) = 0;
};
<API key>(nsINetworkPredictor, <API key>)
/* Use this macro when declaring classes that implement this interface. */
#define <API key> \
NS_IMETHOD Predict(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext, <API key> *verifier) override; \
NS_IMETHOD Learn(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext) override; \
NS_IMETHOD Reset(void) override;
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define <API key>(_to) \
NS_IMETHOD Predict(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext, <API key> *verifier) override { return _to Predict(targetURI, sourceURI, reason, loadContext, verifier); } \
NS_IMETHOD Learn(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext) override { return _to Learn(targetURI, sourceURI, reason, loadContext); } \
NS_IMETHOD Reset(void) override { return _to Reset(); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define <API key>(_to) \
NS_IMETHOD Predict(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext, <API key> *verifier) override { return !_to ? <API key> : _to->Predict(targetURI, sourceURI, reason, loadContext, verifier); } \
NS_IMETHOD Learn(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext) override { return !_to ? <API key> : _to->Learn(targetURI, sourceURI, reason, loadContext); } \
NS_IMETHOD Reset(void) override { return !_to ? <API key> : _to->Reset(); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsNetworkPredictor : public nsINetworkPredictor
{
public:
NS_DECL_ISUPPORTS
<API key>
nsNetworkPredictor();
private:
~nsNetworkPredictor();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS(nsNetworkPredictor, nsINetworkPredictor)
nsNetworkPredictor::nsNetworkPredictor()
{
/* member initializers and constructor code */
}
nsNetworkPredictor::~nsNetworkPredictor()
{
/* destructor code */
}
/* void predict (in nsIURI targetURI, in nsIURI sourceURI, in <API key> reason, in nsILoadContext loadContext, in <API key> verifier); */
NS_IMETHODIMP nsNetworkPredictor::Predict(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext, <API key> *verifier)
{
return <API key>;
}
/* void learn (in nsIURI targetURI, in nsIURI sourceURI, in <API key> reason, in nsILoadContext loadContext); */
NS_IMETHODIMP nsNetworkPredictor::Learn(nsIURI *targetURI, nsIURI *sourceURI, <API key> reason, nsILoadContext *loadContext)
{
return <API key>;
}
/* void reset (); */
NS_IMETHODIMP nsNetworkPredictor::Reset()
{
return <API key>;
}
/* End of implementation class template. */
#endif
// Wrapper functions to make use of the predictor easier and less invasive
class nsIChannel;
class nsIDocument;
class nsILoadContext;
class nsILoadGroup;
class <API key>;
namespace mozilla {
namespace net {
nsresult PredictorPredict(nsIURI *targetURI,
nsIURI *sourceURI,
<API key> reason,
nsILoadContext *loadContext,
<API key> *verifier);
nsresult PredictorLearn(nsIURI *targetURI,
nsIURI *sourceURI,
<API key> reason,
nsILoadContext *loadContext);
nsresult PredictorLearn(nsIURI *targetURI,
nsIURI *sourceURI,
<API key> reason,
nsILoadGroup *loadGroup);
nsresult PredictorLearn(nsIURI *targetURI,
nsIURI *sourceURI,
<API key> reason,
nsIDocument *document);
nsresult <API key>(nsIURI *targetURI,
nsIChannel *channel,
nsILoadContext *loadContext);
} // mozilla::net
} // mozilla
#endif /* <API key> */ |
# AUTOGENERATED FILE
FROM balenalib/<API key>:35-build
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
RUN dnf install -y \
python3-pip \
python3-dbus \
&& dnf clean all
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install -U --no-cache-dir --ignore-installed pip setuptools \
&& pip3 install --no-cache-dir virtualenv
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'As of January 1st, 2020, Python 2 was end-of-life, we will change the latest tag for Balenalib Python base image to Python 3.x and drop support for Python 2 soon. So after 1st July, 2020, all the balenalib Python latest tag will point to the latest Python 3 version and no changes, or fixes will be made to balenalib Python 2 base image. If you are using Python 2 for your application, please upgrade to Python 3 before 1st July.' > /.balena/messages/<API key>
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/<SHA1-like>/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https:
RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh |
# AUTOGENERATED FILE
FROM balenalib/<API key>:3.12-build
# remove several traces of python
RUN apk del python*
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
# point Python at a system-provided certificate database. Otherwise, we might hit <API key>.
ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
ENV PYTHON_VERSION 3.9.7
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.2.4
ENV SETUPTOOLS_VERSION 58.0.0
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.<API key>.3.tar.gz" \
&& echo "<SHA256-like> Python-$PYTHON_VERSION.<API key>.3.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.<API key>.3.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.<API key>.3.tar.gz" \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/<SHA1-like>/get-pip.py" \
&& echo "<SHA256-like> get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.18
# install dbus-python dependencies
RUN apk add --no-cache \
dbus-dev \
dbus-glib-dev
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/<SHA1-like>/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https:
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh |
# angularJS 12
:
: 2016-01-18
## Working with Forms
- Angular JS Form .
- Form .
form.html
<!DOCTYPE html>
<html ng-app="exampleApp">
<head>
<title>Forms</title>
<script src="angular.js"></script>
<link href="bootstrap.css" rel="stylesheet" />
<link href="bootstrap-theme.css" rel="stylesheet" />
<script>
angular.module("exampleApp", [])
.controller("defaultCtrl", function ($scope) {
$scope.todos = [
{ action: "Get groceries", complete: false },
{ action: "Call plumber", complete: false },
{ action: "Buy running shoes", complete: true },
{ action: "Buy flowers", complete: false },
{ action: "Call family", complete: false }];
});
</script>
</head>
<body>
<div id="todoPanel" class="panel" ng-controller="defaultCtrl">
<h3 class="panel-header">
To Do List
<span class="label label-info">
{{(todos | filter: {complete: 'false'}).length}}
</span>
</h3>
<table class="table">
<thead>
<tr><th>#</th><th>Action</th><th>Done</th></tr>
</thead>
<tr ng-repeat="item in todos">
<td>{{$index + 1}}</td>
<td>{{item.action}}</td>
<td>{{item.complete}}</td>
</tr>
</table>
</div>
</body>
</html>
[](http://codepen.io/anon/pen/JGmwqN?editors=100)
1. ng-model directive
- item complete
:
<td>
<input type="checkbox" ng-model="item.complete">
</td>
:
[](http://codepen.io/skypentum/pen/ZQXgmE?editors=100)
2. model
- newTodo ng-model
- addNewItem
<script>
:
<input id="actionText" class="form-control" ng-model="newTodo.action">
:
<select id="actionLocation" class="form-control" ng-model="newTodo.location">
<option>Home</option>
<option>Office</option>
<option>Mall</option>
</select>
:
$scope.addNewItem = function (newItem) {
$scope.todos.push({
action: newItem.action + " (" + newItem.location + ")",
complete: false
});
};
:
<script>
[](http://codepen.io/anon/pen/xZymeg?editors=100)
- : model ,
Form
- ,
1. Form
- form name="myForm" novalidate ng-submit="addUser(newUser)"
- novalidate ng-submit
<html ng-app="exampleApp">
<head>
<title>Forms</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<script>
angular.module("exampleApp", [])
.controller("defaultCtrl", function ($scope) {
$scope.addUser = function (userDetails) {
$scope.message = userDetails.name + " (" + userDetails.email + ") (" + userDetails.agreed + ")";
}
$scope.message = "Ready";
});
</script>
</head>
<body>
<div id="todoPanel" class="panel" ng-controller="defaultCtrl">
<form name="myForm" novalidate ng-submit="addUser(newUser)">
<div class="well">
<div class="form-group">
<label>Name:</label>
<input name="userName" type="text" class="form-control"
required ng-model="newUser.name">
</div>
<div class="form-group">
<label>Email:</label>
<input name="userEmail" type="email" class="form-control"
required ng-model="newUser.email">
</div>
<div class="checkbox">
<label>
<input name="agreed" type="checkbox"
ng-model="newUser.agreed" required>
I agree to the terms and conditions
</label>
</div>
<button type="submit" class="btn btn-primary btn-block"
ng-disabled="myForm.$invalid">
OK
</button>
</div>
<div class="well">
Message: {{message}}
<div>
Valid: {{myForm.$valid}}
</div>
</div>
</form>
</div>
</body>
</html>
[](http://codepen.io/anon/pen/LGgqYz?editors=100)
2. validation Form Element (css )
-
$pristine - / true
$dirty - / true
$valid - / true
$invalid - / true
$error -
-
[](http://codepen.io/skypentum/pen/jWaLBv?editors=100)
-
[](http://codepen.io/anon/pen/QyZYNL?editors=100)
Form
1. input
ng-model -
ng-change -
ng-minlength -
ng-maxlength -
ng-pattern -
ng-required - required
[](http://codepen.io/skypentum/pen/LGOjjN?editors=100)
2.Checkbox
ng-model -
ng-change -
ng-true-value -
ng-false-value -
[](http://codepen.io/skypentum/pen/bEYrrM?editors=100)
3.Text Area
- input
[](http://codepen.io/skypentum/pen/rxYzzE?editors=100)
4.Select
ng-required - required
ng-options -
[](http://codepen.io/anon/pen/gPBqgq?editors=100)
- value option .
[](http://codepen.io/anon/pen/GoYzrP?editors=100) |
package io.adok.common.entities;
import io.adok.common.dao.DaoSession;
import de.greenrobot.dao.DaoException;
import io.adok.common.dao.ChallengeDao;
// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS
// KEEP INCLUDES - put your custom includes here
import io.adok.android.pojo.Challenge;
// KEEP INCLUDES END
/**
* Entity mapped to table Challenge.
*/
public class ChallengeEntity {
private Long localId;
private Long serverId;
private String objectId;
/** Not-null value. */
private String title;
private String description;
private String picture;
private java.util.Date start;
private java.util.Date end;
private Long userId;
/** Used to resolve relations */
private transient DaoSession daoSession;
/** Used for active entity operations. */
private transient ChallengeDao myDao;
// KEEP FIELDS - put your custom fields here
// KEEP FIELDS END
public ChallengeEntity() {
}
public ChallengeEntity(Long localId) {
this.localId = localId;
}
public ChallengeEntity(Long localId, Long serverId, String objectId, String title, String description, String picture, java.util.Date start, java.util.Date end, Long userId) {
this.localId = localId;
this.serverId = serverId;
this.objectId = objectId;
this.title = title;
this.description = description;
this.picture = picture;
this.start = start;
this.end = end;
this.userId = userId;
}
/** called by internal mechanisms, do not call yourself. */
public void __setDaoSession(DaoSession daoSession) {
this.daoSession = daoSession;
myDao = daoSession != null ? daoSession.getChallengeDao() : null;
}
public Long getLocalId() {
return localId;
}
public void setLocalId(Long localId) {
this.localId = localId;
}
public Long getServerId() {
return serverId;
}
public void setServerId(Long serverId) {
this.serverId = serverId;
}
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
/** Not-null value. */
public String getTitle() {
return title;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public java.util.Date getStart() {
return start;
}
public void setStart(java.util.Date start) {
this.start = start;
}
public java.util.Date getEnd() {
return end;
}
public void setEnd(java.util.Date end) {
this.end = end;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
/** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
public void delete() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.delete(this);
}
/** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
public void update() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.update(this);
}
/** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
public void refresh() {
if (myDao == null) {
throw new DaoException("Entity is detached from DAO context");
}
myDao.refresh(this);
}
// KEEP METHODS - put your custom methods here
public ChallengeEntity(Challenge challengeItem, Long userId) {
this(
null,
(long) challengeItem.getId().hashCode(),
challengeItem.getId(),
challengeItem.getTitle(),
challengeItem.getDesc(),
challengeItem.getPicture().length() == 0 ? null : challengeItem.getPicture(),
challengeItem.getStart(),
challengeItem.getEnd(),
userId);
}
public void updateNotNull(ChallengeEntity other) {
if (this == other) {
return;//both came from db, no need to run this.
}
if (other.localId != null) {
this.localId = other.localId;
}
if (other.serverId != null) {
this.serverId = other.serverId;
}
if (other.objectId != null) {
this.objectId = other.objectId;
}
if (other.title != null) {
this.title = other.title;
}
if (other.description != null) {
this.description = other.description;
}
if (other.picture != null) {
this.picture = other.picture;
}
if (other.start != null) {
this.start = other.start;
}
if (other.end != null) {
this.end = other.end;
}
if (other.userId != null) {
this.userId = other.userId;
}
}
// KEEP METHODS END
} |
using <API key>.Models;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Validation;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
namespace <API key>.Areas.Nutritious.Controllers
{
public class <API key> : Controller
{
string preAuthStatus = null;
DateTime? preCheckerDT = null;
string preCheckerID = null;
private <API key> db = new <API key>();
private UserManager<ApplicationUser> userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new <API key>()));
// GET: Nutritious/Ingredients
public ActionResult getResult(int? nhomthucpham, string tenthucpham = null)
{
var foodType = db.DD_NhomThucPham.Where(c => c.Record_Status == "1" && c.Auth_Status == "A")
.OrderBy(q => q.TenNhomThucPham).ToList();
ViewBag.nhomthucpham = new SelectList(foodType, "NhomThucPhamID", "TenNhomThucPham", nhomthucpham);
int NhomThucPhamID = nhomthucpham.GetValueOrDefault();
Debug.WriteLine(NhomThucPhamID);
IQueryable<DD_ThucPham> RESULTS = db.DD_ThucPham
.Where(c => (tenthucpham == null || c.TenThucPham.Contains(tenthucpham))
&& (!nhomthucpham.HasValue || c.NhomThucPhamID == NhomThucPhamID)
&& c.Record_Status == "1")
.OrderBy(s => s.NhomThucPhamID)
.ThenBy(s => s.TenThucPham)
.Include(s => s.NhomThucPham);
return View(RESULTS.ToList());
}
public ActionResult Index(int? nhomthucpham, string tenthucpham = null)
{
return getResult(nhomthucpham, tenthucpham);
}
[HttpPost]
[<API key>]
public ActionResult Index(int? id, string AUTH_STATUS, int? nhomthucpham, string tenthucpham = null)
{
if (id == null)
{
return new <API key>(HttpStatusCode.BadRequest);
}
DD_ThucPham dD_ThucPham = db.DD_ThucPham.Find(id);
if (dD_ThucPham == null)
{
return HttpNotFound();
}
if (ModelState.IsValid)
{
db.Entry(dD_ThucPham).State = EntityState.Modified;
dD_ThucPham.Auth_Status = AUTH_STATUS;
dD_ThucPham.Checker_ID = userManager.FindById(User.Identity.GetUserId()).Id;
dD_ThucPham.Approve_DT = DateTime.Now;
db.SaveChanges();
}
return getResult(nhomthucpham, tenthucpham);
}
// GET: Nutritious/Ingredients/Details/5
public ActionResult Details(int? id)
{
if (id == null)
{
return new <API key>(HttpStatusCode.BadRequest);
}
DD_ThucPham a = db.DD_ThucPham.Find(id);
if (a == null)
{
return HttpNotFound();
}
var content = (from p in db.DD_NhomThucPham where p.NhomThucPhamID == a.NhomThucPhamID
select p.TenNhomThucPham).FirstOrDefault();
ViewBag.Text = content;
return View(a);
}
public ActionResult Create()
{
return View();
}
// POST: Kindergarten/StudentOverview/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
[HttpPost]
[<API key>]
public ActionResult Create(DD_ThucPham DD_ThucPhamModel, HttpPostedFileBase file)
{
try
{
if (ModelState.IsValid)
{
DD_ThucPhamModel.Record_Status = "1";
DD_ThucPhamModel.Maker_ID = userManager.FindById(User.Identity.GetUserId()).Id;
DD_ThucPhamModel.Create_DT = DateTime.Now;
DD_ThucPhamModel.Auth_Status = "U";
DD_ThucPhamModel.Checker_ID = null;
DD_ThucPhamModel.Approve_DT = DateTime.Now;
db.DD_ThucPham.Add(DD_ThucPhamModel);
db.SaveChanges();
return RedirectToAction("Index");
}
}
catch (<API key> dbEx)
{
foreach (var validationErrors in dbEx.<API key>)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}", validationError.
PropertyName, validationError.ErrorMessage);
}
}
}
return View(DD_ThucPhamModel);
}
// GET: Kindergarten/StudentOverview/Edit/5
public ActionResult Edit(int? id)
{
if (id == null)
{
return new <API key>(HttpStatusCode.BadRequest);
}
DD_ThucPham a = db.DD_ThucPham.Find(id);
if (a == null)
{
return HttpNotFound();
}
preAuthStatus = a.Auth_Status;
preCheckerDT = a.Approve_DT;
preCheckerID = a.Checker_ID;
//db.SaveChanges();
return View(a);
}
// POST: Kindergarten/StudentOverview/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
[HttpPost]
[<API key>]
public ActionResult Edit(DD_ThucPham thucpham)
{
if (ModelState.IsValid)
{
db.Entry(thucpham).State = EntityState.Modified;
thucpham.Create_DT = DateTime.Now;
thucpham.Create_DT = DateTime.Now;
thucpham.Maker_ID = userManager.FindById(User.Identity.GetUserId()).Id;
thucpham.Auth_Status = preAuthStatus;
thucpham.Checker_ID = preCheckerID;
thucpham.Approve_DT = preCheckerDT;
thucpham.Record_Status = "1";
db.SaveChanges();
return RedirectToAction("Index");
}
return View(thucpham);
}
// GET: Kindergarten/StudentOverview/Delete/5
public ActionResult Delete(int? id)
{
if (id == null)
{
return new <API key>(HttpStatusCode.BadRequest);
}
DD_ThucPham a = db.DD_ThucPham.Find(id);
if (a == null)
{
return HttpNotFound();
}
var content = (from p in db.DD_NhomThucPham
where p.NhomThucPhamID == a.NhomThucPhamID
select p.TenNhomThucPham).FirstOrDefault();
ViewBag.Text = content;
return View(a);
}
// POST: Kindergarten/StudentOverview/Delete/5
[HttpPost, ActionName("Delete")]
[<API key>]
public ActionResult DeleteConfirmed(int id)
{
DD_ThucPham dD_ThucPham = db.DD_ThucPham.Find(id);
if (dD_ThucPham.Auth_Status.Equals("U"))
db.DD_ThucPham.Remove(dD_ThucPham);
else
dD_ThucPham.Record_Status = "0";
db.SaveChanges();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
}
} |
package com.intellij.openapi.wm.impl;
import com.intellij.diagnostic.IdeMessagePanel;
import com.intellij.icons.AllIcons;
import com.intellij.ide.<API key>;
import com.intellij.ide.DataManager;
import com.intellij.ide.impl.ProjectUtil;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.impl.IdeNotificationArea;
import com.intellij.openapi.MnemonicHelper;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
import com.intellij.openapi.actionSystem.impl.MouseGestureManager;
import com.intellij.openapi.application.*;
import com.intellij.openapi.application.ex.<API key>;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.impl.ShadowPainter;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.<API key>;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.IdeFrameEx;
import com.intellij.openapi.wm.ex.<API key>;
import com.intellij.openapi.wm.ex.StatusBarEx;
import com.intellij.openapi.wm.impl.status.*;
import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeFrame;
import com.intellij.ui.*;
import com.intellij.ui.mac.<API key>;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.accessibility.<API key>;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.io.PowerSupplyKit;
import javax.accessibility.AccessibleContext;
import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.lang.reflect.Field;
/**
* @author Anton Katilin
* @author Vladimir Kondratyev
*/
public class IdeFrameImpl extends JFrame implements IdeFrameEx, <API key>, DataProvider {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.wm.impl.IdeFrameImpl");
public static final Key<Boolean> <API key> = Key.create("should.open.in.full.screen");
private static boolean ourUpdatingTitle;
private String myTitle;
private String myFileTitle;
private File myCurrentFile;
private Project myProject;
private IdeRootPane myRootPane;
private BalloonLayout myBalloonLayout;
private IdeFrameDecorator myFrameDecorator;
private boolean myRestoreFullScreen;
public IdeFrameImpl(ActionManagerEx actionManager, DataManager dataManager, Application application) {
super(<API key>.getInstance().getFullProductName());
myRootPane = createRootPane(actionManager, dataManager, application);
setRootPane(myRootPane);
setBackground(UIUtil.getPanelBackground());
AppUIUtil.updateWindowIcon(this);
Dimension size = ScreenUtil.getMainScreenBounds().getSize();
size.width = Math.min(1400, size.width - 20);
size.height= Math.min(1000, size.height - 40);
setSize(size);
<API key>(null);
<API key> <API key> = new <API key>();
<API key>(<API key>);
setupCloseAction();
MnemonicHelper.init(this);
myBalloonLayout = new BalloonLayoutImpl(myRootPane, JBUI.insets(8));
// to show window thumbnail under Macs
if (SystemInfo.isMac) setIconImage(null);
MouseGestureManager.getInstance().add(this);
myFrameDecorator = IdeFrameDecorator.decorate(this);
IdeMenuBar.<API key>(this);
// UIUtil.<API key>();
}
@Override
public void addNotify() {
super.addNotify();
PowerSupplyKit.checkPowerSupply();
}
protected IdeRootPane createRootPane(ActionManagerEx actionManager, DataManager dataManager, Application application) {
return new IdeRootPane(actionManager, dataManager, application, this);
}
@NotNull
@Override
public Insets getInsets() {
return SystemInfo.isMac && isInFullScreen() ? JBUI.emptyInsets() : super.getInsets();
}
@Override
public JComponent getComponent() {
return getRootPane();
}
@Nullable
public static Window getActiveFrame() {
for (Frame frame : getFrames()) {
if (frame.isActive()) return frame;
}
return null;
}
@Override
@SuppressWarnings({"SSBasedInspection", "deprecation"})
public void show() {
super.show();
SwingUtilities.invokeLater(() -> <API key>(true));
}
/**
* This is overridden to get rid of strange Alloy LaF customization of frames. For unknown reason it sets the maxBounds rectangle
* and it does it plain wrong. Setting bounds to {@code null} means default value should be taken from the underlying OS.
*/
@Override
public synchronized void setMaximizedBounds(Rectangle bounds) {
super.setMaximizedBounds(null);
}
private void setupCloseAction() {
<API key>(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(
new WindowAdapter() {
@Override
public void windowClosing(@NotNull final WindowEvent e) {
if (isTemporaryDisposed())
return;
final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (openProjects.length > 1 || openProjects.length == 1 && SystemInfo.isMacSystemMenu) {
if (myProject != null && myProject.isOpen()) {
ProjectUtil.closeAndDispose(myProject);
}
ApplicationManager.getApplication().getMessageBus().syncPublisher(<API key>.TOPIC).projectFrameClosed();
WelcomeFrame.<API key>();
}
else {
<API key>.getApplicationEx().exit();
}
}
}
);
}
@Override
public StatusBar getStatusBar() {
return myRootPane == null ? null : myRootPane.getStatusBar();
}
@Override
public void setTitle(final String title) {
if (ourUpdatingTitle) {
super.setTitle(title);
}
else {
myTitle = title;
}
updateTitle();
}
@Override
public void setFrameTitle(String text) {
super.setTitle(text);
}
@Override
public void setFileTitle(@Nullable String fileTitle, @Nullable File file) {
myFileTitle = fileTitle;
myCurrentFile = file;
updateTitle();
}
@Override
public <API key> getNorthExtension(String key) {
return myRootPane.findByName(key);
}
private void updateTitle() {
updateTitle(this, myTitle, myFileTitle, myCurrentFile);
}
public static void updateTitle(@NotNull JFrame frame, @Nullable String title, @Nullable String fileTitle, @Nullable File currentFile) {
if (ourUpdatingTitle) return;
try {
ourUpdatingTitle = true;
frame.getRootPane().putClientProperty("Window.documentFile", currentFile);
Builder builder = new Builder().append(title).append(fileTitle);
if (Boolean.getBoolean("ide.ui.version.in.title")) {
builder = builder.append(<API key>.getInstance().getFullProductName() + ' ' + ApplicationInfo.getInstance().getFullVersion());
}
else if (!SystemInfo.isMac || builder.isEmpty()) {
builder = builder.append(<API key>.getInstance().getFullProductName());
}
frame.setTitle(builder.toString());
}
finally {
ourUpdatingTitle = false;
}
}
public void updateView() {
((IdeRootPane)getRootPane()).updateToolbar();
((IdeRootPane)getRootPane()).<API key>();
((IdeRootPane)getRootPane()).<API key>();
}
@Override
public AccessibleContext <API key>() {
return accessibleContext;
}
private static final class Builder {
private final StringBuilder sb = new StringBuilder();
public Builder append(@Nullable String s) {
if (!StringUtil.isEmptyOrSpaces(s)) {
if (sb.length() > 0) sb.append(" - ");
sb.append(s);
}
return this;
}
public boolean isEmpty() {
return sb.length() == 0;
}
@Override
public String toString() {
return sb.toString();
}
}
@Override
public Object getData(final String dataId) {
if (CommonDataKeys.PROJECT.is(dataId)) {
if (myProject != null) {
return myProject.isInitialized() ? myProject : null;
}
}
if (IdeFrame.KEY.getName().equals(dataId)) {
return this;
}
return null;
}
public void setProject(@Nullable Project project) {
if (myProject == project) {
return;
}
myProject = project;
if (project != null) {
if (WindowManager.getInstance().<API key>()) {
myRestoreFullScreen = <API key>.get(project) == Boolean.TRUE ||
ProjectFrameBounds.getInstance(project).isInFullScreen();
if (!myRestoreFullScreen && PropertiesComponent.getInstance(project).getBoolean("FullScreen")) {
myRestoreFullScreen = true;
PropertiesComponent.getInstance(project).unsetValue("FullScreen");
}
}
if (myRootPane != null) {
myRootPane.<API key>(project);
StatusBar statusBar = myRootPane.getStatusBar();
if (statusBar != null) {
project.getMessageBus().connect().subscribe(StatusBar.Info.TOPIC, statusBar);
}
}
<API key>(myProject);
}
else {
if (myRootPane != null) { //already disposed
myRootPane.<API key>();
}
FocusTrackback.release(this);
}
if (myRestoreFullScreen && isVisible()) {
toggleFullScreen(true);
myRestoreFullScreen = false;
}
}
@SuppressWarnings("SSBasedInspection")
@Override
public void setVisible(boolean b) {
super.setVisible(b);
if (b && myRestoreFullScreen) {
SwingUtilities.invokeLater(() -> {
toggleFullScreen(true);
if (SystemInfo.isMacOSLion) {
setBounds(ScreenUtil.getScreenRectangle(getLocationOnScreen()));
}
myRestoreFullScreen = false;
});
}
}
private void <API key>(@NotNull final Project project) {
final StatusBar statusBar = getStatusBar();
final PositionPanel positionPanel = new PositionPanel(project);
statusBar.addWidget(positionPanel, "before " + IdeMessagePanel.FATAL_ERROR);
final IdeNotificationArea notificationArea = new IdeNotificationArea();
statusBar.addWidget(notificationArea, "before " + IdeMessagePanel.FATAL_ERROR);
final EncodingPanel encodingPanel = new EncodingPanel(project);
statusBar.addWidget(encodingPanel, "after Position");
final LineSeparatorPanel lineSeparatorPanel = new LineSeparatorPanel(project);
statusBar.addWidget(lineSeparatorPanel, "before " + encodingPanel.ID());
final <API key> <API key> = new <API key>(project);
final <API key> <API key> = new <API key>(project);
statusBar.addWidget(<API key>, "after Encoding");
statusBar.addWidget(<API key>, "after InsertOverwrite");
Disposer.register(project, () -> {
statusBar.removeWidget(encodingPanel.ID());
statusBar.removeWidget(lineSeparatorPanel.ID());
statusBar.removeWidget(positionPanel.ID());
statusBar.removeWidget(notificationArea.ID());
statusBar.removeWidget(<API key>.ID());
statusBar.removeWidget(<API key>.ID());
//noinspection deprecation
((StatusBarEx)statusBar).<API key>();
});
}
@Override
public Project getProject() {
return myProject;
}
@Override
public void dispose() {
if (SystemInfo.isMac && isInFullScreen()) {
((<API key>)myFrameDecorator).toggleFullScreenNow();
}
if (isTemporaryDisposed()) {
super.dispose();
return;
}
MouseGestureManager.getInstance().remove(this);
if (myBalloonLayout != null) {
((BalloonLayoutImpl)myBalloonLayout).dispose();
myBalloonLayout = null;
}
// clear both our and swing hard refs
if (myRootPane != null) {
if (ApplicationManager.getApplication().isUnitTestMode()) {
myRootPane.removeNotify();
}
myRootPane = null;
setRootPane(new JRootPane());
}
if (myFrameDecorator != null) {
Disposer.dispose(myFrameDecorator);
myFrameDecorator = null;
}
FocusTrackback.release(this);
super.dispose();
}
private boolean isTemporaryDisposed() {
return myRootPane != null && myRootPane.getClientProperty(ScreenUtil.DISPOSE_TEMPORARY) != null;
}
public void <API key>() {
if (myProject != null) {
doLayout();
}
}
private static final ShadowPainter ourShadowPainter = new ShadowPainter(AllIcons.Windows.Shadow.Top,
AllIcons.Windows.Shadow.TopRight,
AllIcons.Windows.Shadow.Right,
AllIcons.Windows.Shadow.BottomRight,
AllIcons.Windows.Shadow.Bottom,
AllIcons.Windows.Shadow.BottomLeft,
AllIcons.Windows.Shadow.Left,
AllIcons.Windows.Shadow.TopLeft);
@Override
public void paint(@NotNull Graphics g) {
UISettings.setupAntialiasing(g);
//noinspection Since15
super.paint(g);
if (IdeRootPane.isFrameDecorated() && !isInFullScreen()) {
final BufferedImage shadow = ourShadowPainter.createShadow(getRootPane(), getWidth(), getHeight());
g.drawImage(shadow, 0, 0, null);
}
}
@Override
public Color getBackground() {
return IdeRootPane.isFrameDecorated() ? Gray.x00.withAlpha(0) : super.getBackground();
}
@Override
public void doLayout() {
super.doLayout();
if (!isInFullScreen() && IdeRootPane.isFrameDecorated()) {
final int leftSide = AllIcons.Windows.Shadow.Left.getIconWidth();
final int rightSide = AllIcons.Windows.Shadow.Right.getIconWidth();
final int top = AllIcons.Windows.Shadow.Top.getIconHeight();
final int bottom = AllIcons.Windows.Shadow.Bottom.getIconHeight();
getRootPane().setBounds(leftSide, top, getWidth() - leftSide - rightSide, getHeight() - top - bottom);
}
}
@Override
public Rectangle <API key>() {
final Rectangle b = getBounds();
b.x += 100;
b.width -= 200;
b.y += 100;
b.height -= 200;
return b;
}
@Override
public final BalloonLayout getBalloonLayout() {
return myBalloonLayout;
}
@Override
public boolean isInFullScreen() {
return myFrameDecorator != null && myFrameDecorator.isInFullScreen();
}
@NotNull
@Override
public ActionCallback toggleFullScreen(boolean state) {
if (<API key>(state)) return ActionCallback.DONE;
if (myFrameDecorator != null) {
return myFrameDecorator.toggleFullScreen(state);
}
return ActionCallback.DONE;
}
private boolean <API key>(final boolean state) {
if (SystemInfo.isMac) {
try {
Field modalBlockerField = Window.class.getDeclaredField("modalBlocker");
modalBlockerField.setAccessible(true);
final Window modalBlocker = (Window)modalBlockerField.get(this);
if (modalBlocker != null) {
ApplicationManager.getApplication().invokeLater(() -> toggleFullScreen(state), ModalityState.NON_MODAL);
return true;
}
}
catch (<API key> | <API key> e) {
LOG.error(e);
}
}
return false;
}
@Override
public AccessibleContext <API key>() {
if (accessibleContext == null) {
accessibleContext = new <API key>();
}
return accessibleContext;
}
protected class <API key> extends AccessibleJFrame {
@Override
public String getAccessibleName() {
final StringBuilder builder = new StringBuilder();
if (myProject != null) {
builder.append(myProject.getName());
builder.append(" - ");
}
builder.append(<API key>.getInstance().getFullProductName());
return builder.toString();
}
}
} |
package Tools;
import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.List;
import GameSubstance.EnemyBullet;
import GameSubstance.Explode;
public class GameBox {
public static int GAME_WIDTH=800;
public static int GAME_HEIGHT=600;
public static Font f1=new Font("ºÚÌå",3,20);
public static Toolkit tk = Toolkit.getDefaultToolkit();
public static Image backgroundimage=tk.createImage("images\\±³¾°.jpg");
public static Image plane=tk.createImage("images\\ÎÒ·½·É»ú.gif");
public static int PLANE_WIDTH=30;
public static int PLANE_HEIGHT=30;
public static Image Explode1=tk.createImage("images/±¬Õ¨.gif");
public static int EXPLODE1_WIDTH=30;
public static int EXPLODE1_HEIGHT=30;
public static Image bullet=tk.createImage("images\\×Óµ¯.gif");
public static int BULLET_WIDTH=18;
public static int BULLET_HEIGHT=35;
public static Image enemy1=tk.createImage("images\\µÐ»ú1.gif");
public static Image enemy2=tk.createImage("images\\µÐ»ú2.gif");
public static int ENEMY_WIDTH=30;
public static int ENEMY_HEIGHT=30;
public static Image enemybullet=tk.createImage("images\\·ßŵÄ×Óµ¯.gif");
public static int ENEMYBULLET_WIDTH=15;
public static int ENEMYBULLET_HEIGHT=30;
} |
# Find and Replace
FIND-AND-REPLACE directive performs basic text transformation of column values that are of type string to find
and replace using 'sed' like expressions.
## Syntax
find-and-replace <column> <sed-script>
## Usage Notes
It's a column oriented text processor that operates on a single value in the given column.
The ```sed-script``` is applied on each text to transform the data.
Following is a typical example on how the SED directive is used
find-and-replace <column> s/regex/replacement/g
Application of this directive will replace the value of the column that matches the ```regex```
with the ```replacement```
The s stands for substitute, while the g stands for global, which means that all matching occurrences
in the line would be replaced. The regular expression (i.e. pattern) to be searched is placed after
the first delimiting symbol (slash here) and the replacement follows the second symbol. Slash (/)
is the conventional symbol, originating in the character for "search".
For example, to replace all occurance of 'hello' to 'world' in the column 'message':
find-and-replace message s/hello/world/g
The character after the s is the delimiter. It is conventionally a slash. If you want to change a pathname
that contains a slash - say /usr/local/bin to /common/bin - you could use the backslash to quote the slash:
find-and-replace 's/\/usr\/local\/bin/\/common\/bin/' <old >new
## Example
Let's following is the record
{
"body" : "one two three four five six seven eight"
}
applying following CUT directive
find-and-replace body s/one/ONE/g
find-and-replace body s/two/2/g
would result in record as show below
{
"body" : "One 2 three four five six seven eight",
} |
package glplus
import (
"fmt"
"runtime"
"strings"
)
// GPProgram ...
type GPProgram struct {
prog *Program
uniforms map[string]*UniformLocation
attribs []string
hash string
}
// DeleteProgram ...
func (p *GPProgram) DeleteProgram() {
if cache := sProgCache[p.hash]; cache != nil {
if cache.Decr() {
//fmt.Printf("Delete %s\n", p.hash)
cache.Delete()
}
}
}
// GetProgramInfoLog ...
func (p *GPProgram) GetProgramInfoLog() string {
return Gl.GetProgramInfoLog(p.prog)
}
// ValidateProgram ...
func (p *GPProgram) ValidateProgram() error {
Gl.ValidateProgram(p.prog)
if !Gl.<API key>(p.prog, Gl.VALIDATE_STATUS) {
return fmt.Errorf("Failed to validate the program!\n%s", p.GetProgramInfoLog())
}
return nil
}
// GetUniformLocation ...
func (p *GPProgram) GetUniformLocation(s string) *UniformLocation {
var res *UniformLocation
var ok bool
if res, ok = p.uniforms[s]; ok {
return res
}
res = Gl.GetUniformLocation(p.prog, s)
p.uniforms[s] = res
return res
}
// GetAttribLocation ...
func (p *GPProgram) GetAttribLocation(s string) int {
return Gl.GetAttribLocation(p.prog, s)
}
// UseProgram ...
func (p *GPProgram) UseProgram() {
Gl.UseProgram(p.prog)
}
// UnuseProgram ...
func (p *GPProgram) UnuseProgram() {
Gl.UseProgram(nil)
}
// Material ...
func (p *GPProgram) Material(m *Material) {
toSlice4 := func(in []float32) (res [4]float32) {
return [4]float32{in[0], in[1], in[2], in[3]}
}
p.ProgramUniform4fv("ambient", toSlice4(m.Ambient))
p.ProgramUniform1f("shininess", m.Shininess)
p.ProgramUniform4fv("specular", toSlice4(m.Specular))
p.ProgramUniform4fv("diffuse", toSlice4(m.Diffuse))
}
// ProgramUniform1f ...
func (p *GPProgram) ProgramUniform1f(uniform string, value float32) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.Uniform1f(uniformloc, value)
}
// ProgramUniform2f ...
func (p *GPProgram) ProgramUniform2f(uniform string, v0 float32, v1 float32) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.Uniform2f(uniformloc, v0, v1)
}
// ProgramUniform4fv ...
func (p *GPProgram) ProgramUniform4fv(uniform string, value [4]float32) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.Uniform4f(uniformloc, value[0], value[1], value[2], value[3])
}
// ProgramUniform3fv ...
func (p *GPProgram) ProgramUniform3fv(uniform string, value [3]float32) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.Uniform3f(uniformloc, value[0], value[1], value[2])
}
// ProgramUniform1i ...
func (p *GPProgram) ProgramUniform1i(uniform string, value int) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.Uniform1i(uniformloc, value)
}
// <API key> ...
func (p *GPProgram) <API key>(uniform string, matrix [16]float32) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.UniformMatrix4fv(uniformloc, false, matrix[:])
}
// <API key> ...
func (p *GPProgram) <API key>(uniform string, matrix [9]float32) {
var uniformloc = p.GetUniformLocation(uniform)
Gl.UniformMatrix3fv(uniformloc, false, matrix[:])
}
// GetShaderInfoLog ...
func GetShaderInfoLog(shader *Shader) string {
return Gl.GetShaderInfoLog(shader)
}
// ShaderSource ...
func ShaderSource(shader *Shader, src string) {
Gl.ShaderSource(shader, src)
}
// LoadShaderProgram ... loads shader objects and then attaches them to a program
func LoadShaderProgram(vertShader string, fragShader string, attribs []string) (*GPProgram, error) {
// query program cache
if sProgCache == nil {
sProgCache = make(map[string]*ProgramCache)
}
hash := getMD5Hash(vertShader, fragShader)
if cache := sProgCache[hash]; cache != nil {
cache.Incr()
//fmt.Printf("Hit %s\n", cache.program.hash)
return cache.program, nil
}
// create the program
var prog = Gl.CreateProgram()
var p = &GPProgram{
prog: prog,
uniforms: make(map[string]*UniformLocation),
attribs: attribs,
hash: hash,
}
if runtime.GOARCH == "js" || runtime.GOOS == "android" {
vertShader = strings.Replace(vertShader, "#version 330\n", "precision highp float;\n", -1)
vertShader = strings.Replace(vertShader, "ATTRIBUTE", "attribute", -1)
vertShader = strings.Replace(vertShader, "VARYINGOUT", "varying", -1)
vertShader = strings.Replace(vertShader, "TEXTURE2D", "texture2D", -1)
} else {
vertShader = strings.Replace(vertShader, "ATTRIBUTE", "in", -1)
vertShader = strings.Replace(vertShader, "VARYINGOUT", "out", -1)
vertShader = strings.Replace(vertShader, "TEXTURE2D", "texture", -1)
}
if runtime.GOARCH == "js" || runtime.GOOS == "android" {
fragShader = strings.Replace(fragShader, "#version 330\n", "precision highp float;\n", -1)
fragShader = strings.Replace(fragShader, "VARYINGIN", "varying", -1)
fragShader = strings.Replace(fragShader, "COLOROUT", "", -1)
fragShader = strings.Replace(fragShader, "FRAGCOLOR", "gl_FragColor", -1)
fragShader = strings.Replace(fragShader, "TEXTURE2D", "texture2D", -1)
} else {
fragShader = strings.Replace(fragShader, "ATTRIBUTE", "attribute", -1)
fragShader = strings.Replace(fragShader, "VARYINGIN", "in", -1)
fragShader = strings.Replace(fragShader, "COLOROUT", "out vec4 colourOut;", -1)
fragShader = strings.Replace(fragShader, "FRAGCOLOR", "colourOut", -1)
fragShader = strings.Replace(fragShader, "TEXTURE2D", "texture", -1)
}
// create the vertex shader
var vs = Gl.CreateShader(Gl.VERTEX_SHADER)
ShaderSource(vs, vertShader)
Gl.CompileShader(vs)
if !Gl.GetShaderiv(vs, Gl.COMPILE_STATUS) {
fmt.Println(vertShader)
return nil, fmt.Errorf("Failed to compile the vertex shader!\n%s", GetShaderInfoLog(vs))
}
// create the fragment shader
var fs = Gl.CreateShader(Gl.FRAGMENT_SHADER)
ShaderSource(fs, fragShader)
Gl.CompileShader(fs)
if !Gl.GetShaderiv(fs, Gl.COMPILE_STATUS) {
fmt.Println(fragShader)
return nil, fmt.Errorf("Failed to compile the fragment shader!\n%s", GetShaderInfoLog(fs))
}
// attach the shaders to the program and link
Gl.AttachShader(prog, vs)
Gl.AttachShader(prog, fs)
Gl.LinkProgram(prog)
if !Gl.<API key>(p.prog, Gl.LINK_STATUS) {
return nil, fmt.Errorf("Failed to link the program!\n%s", p.GetProgramInfoLog())
}
// at this point the shaders can be deleted
Gl.DeleteShader(vs)
Gl.DeleteShader(fs)
// insert in prog cache
sProgCache[hash] = &ProgramCache{
<API key>: NewReferenceCount(),
program: p,
}
//fmt.Printf("Create %s\n", p.hash)
return p, nil
}
// GetAttribs ...
func (p *GPProgram) GetAttribs() (attribs map[string]int) {
attribs = make(map[string]int)
for _, attr := range p.attribs {
attribs[attr] = Gl.GetAttribLocation(p.prog, attr)
}
return attribs
} |
package com.pxh.cook.app.bean;
import java.util.List;
public class <API key> extends ShowApiBaseBean {
/**
* showapi_res_body : {"message":"ok","ret_code":0,"results":[{"street_id":"<API key>","uid":"<API key>","detail":1,"location":{"lng":116.406602,"lat":39.907327},"address":"44(,),300","name":"()","telephone":"010-65241042"}],"status":0}
*/
private ShowapiResBodyBean showapi_res_body;
public ShowapiResBodyBean getShowapi_res_body() {
return showapi_res_body;
}
public void setShowapi_res_body(ShowapiResBodyBean showapi_res_body) {
this.showapi_res_body = showapi_res_body;
}
public static class ShowapiResBodyBean {
/**
* message : ok
* ret_code : 0
* results : [{"street_id":"<API key>","uid":"<API key>","detail":1,"location":{"lng":116.406602,"lat":39.907327},"address":"44(,),300","name":"()","telephone":"010-65241042"}]
* status : 0
*/
private String message;
private int ret_code;
private int status;
private List<ResultsBean> results;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getRet_code() {
return ret_code;
}
public void setRet_code(int ret_code) {
this.ret_code = ret_code;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public List<ResultsBean> getResults() {
return results;
}
public void setResults(List<ResultsBean> results) {
this.results = results;
}
public static class ResultsBean {
/**
* street_id : <API key>
* uid : <API key>
* detail : 1
* location : {"lng":116.406602,"lat":39.907327}
* address : 44(,),300
* name : ()
* telephone : 010-65241042
*/
private String street_id;
private String uid;
private int detail;
private LocationBean location;
private String address;
private String name;
private String telephone;
public String getStreet_id() {
return street_id;
}
public void setStreet_id(String street_id) {
this.street_id = street_id;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public int getDetail() {
return detail;
}
public void setDetail(int detail) {
this.detail = detail;
}
public LocationBean getLocation() {
return location;
}
public void setLocation(LocationBean location) {
this.location = location;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public static class LocationBean {
/**
* lng : 116.406602
* lat : 39.907327
*/
private double lng;
private double lat;
public double getLng() {
return lng;
}
public void setLng(double lng) {
this.lng = lng;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
}
}
}
} |
move_value() {
local sender=$1
local receiver=$2
local value=$3
local peers="$4"
echo "---> Move $value from account $sender to account $receiver"
invokeChaincode "$(get_token Jim org1)" businesschannel exp02 "$peers" invoke "[\"$sender\",\"$receiver\",\"$value\"]"
}
scenario() {
echo "---> request_token"
request_token Jim org1
# request_token Barry org2 # fails now
echo "---> query channels"
queryChannels peer0.org1.example.com $(get_token Jim org1)
echo "---> get Installed Chaincode info"
<API key> businesschannel peer0.org1.example.com $(get_token Jim org1) | tee /tmp/installedcc
echo "---> query variable a in chaincode exp02"
queryChaincode businesschannel "${PEER}" "$(get_token Jim org1)" exp02 a
echo "---> query variable b in chaincode exp02"
queryChaincode businesschannel "${PEER}" "$(get_token Jim org1)" exp02 b
if [ "$<API key>" = true ] ; then
move_value b a 13 "\"peer0.org1.example.com\""
else
move_value a b 17 "[\"peer0.org1.example.com\"]"
fi
echo "---> query variable a in chaincode exp02"
queryChaincode businesschannel "${PEER}" "$(get_token Jim org1)" exp02 a
echo "---> query variable b in chaincode exp02"
queryChaincode businesschannel "${PEER}" "$(get_token Jim org1)" exp02 b
}
# TODO: need proper check to decide that service discovery really works
log_check() {
if grep -q "\[ERROR\]" $LOGDIR/$TESTCASE/app.log ; then
local lines=$(grep "\[ERROR\]" $LOGDIR/$TESTCASE/app.log | wc -l)
echo "app.log has $lines ERROR log events"
return 1
fi
} |
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_252) on Fri Aug 20 17:47:57 BST 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30.<API key> (PSI :: JAMI - Java framework for molecular interactions 3.2.12 API)</title>
<meta name="date" content="2021-08-20">
<link rel="stylesheet" type="text/css" href="../../../../../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30.<API key> (PSI :: JAMI - Java framework for molecular interactions 3.2.12 API)";
}
}
catch(err) {
}
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/<API key>.html" title="class in psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../../../../index.html?psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/class-use/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<h2 title="Uses of Class psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30.<API key>" class="title">Uses of Class<br>psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30.<API key></h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/<API key>.html" title="class in psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30"><API key></a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30">psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30">
</a>
<h3>Uses of <a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/<API key>.html" title="class in psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30"><API key></a> in <a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/extended/xml30/package-summary.html">psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/<API key>.html" title="class in psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30"><API key></a> in <a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/extended/xml30/package-summary.html">psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/extended/xml30/<API key>.html" title="class in psidev.psi.mi.jami.xml.io.writer.elements.impl.extended.xml30"><API key></a></span></code>
<div class="block">Xml 30 writer for preassembly</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../../../../psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/<API key>.html" title="class in psidev.psi.mi.jami.xml.io.writer.elements.impl.xml30">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../../../../index.html?psidev/psi/mi/jami/xml/io/writer/elements/impl/xml30/class-use/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<a name="skip.navbar.bottom">
</a></div>
<p class="legalCopy"><small>Copyright &
</body>
</html> |
package com.lenox.beyondj.services;
import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import com.lenox.beyond.<API key>;
import com.lenox.beyond.LaunchUtil;
import com.lenox.beyond.configuration.Config;
import com.lenox.beyond.launch.*;
import com.lenox.beyond.util.MimeMappingsParser;
import com.lenox.beyondj.actor.<API key>;
import com.lenox.beyondj.actor.system.*;
import com.lenox.beyondj.actor.system.model.<API key>;
import com.lenox.beyondj.actor.system.model.BundleRequestType;
import com.lenox.beyondj.actor.system.model.SystemLaunchMessage;
import com.lenox.beyondj.extension.SpringNameExtension;
import com.lenox.beyondj.extension.SpringTypeExtension;
import com.lenox.common.util.IpAddresssUtil;
import com.lenox.configuration.<API key>;
import com.lenox.platform.DeploymentType;
import com.thoughtworks.xstream.XStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.core.io.ClassPathResource;
import java.io.File;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Scope("singleton")
public class <API key> implements <API key> {
public static final String NUM_INSTANCES = "numInstances";
public static final String APPLICATION_OPTIONS = "applicationOptions";
public static final String APPLICATION_PACKAGE = "applicationPackage";
private ActorSystem system;
private ActorRef supervisor;
private SpringNameExtension springNameExtension;
private SpringTypeExtension springTypeExtension;
private ActorRef postLaunchActor;
private ActorRef portMasterActor;
private ActorRef systemGatewayActor;
private ActorRef <API key>;
private <API key> <API key>;
public void setSystem(ActorSystem system) {
this.system = system;
}
public void setSupervisor(ActorRef supervisor) {
this.supervisor = supervisor;
}
public void <API key>(SpringNameExtension springNameExtension) {
this.springNameExtension = springNameExtension;
}
public void <API key>(SpringTypeExtension springTypeExtension) {
this.springTypeExtension = springTypeExtension;
}
private boolean isJarLaunch(Class<?> <API key>) {
ProtectionDomain protectionDomain = <API key>.getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
if (codeSource.toString().indexOf(".jar!") != -1) {
return true;
}
return false;
}
public static String baseLocation(Class<?> <API key>) {
ProtectionDomain protectionDomain = <API key>.getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
if (LOG.isDebugEnabled()) LOG.debug("codeSource =" + codeSource.toString());
if (codeSource.toString().indexOf(".jar!") != -1) {
return "";
}
String location = codeSource.getLocation().toString();
int index = location.indexOf("/");
int index2 = location.indexOf("/repo/com/lenox/platform/beyondj-core");
if (index < 0) {
throw new RuntimeException("Could not determine beginning base location of launch");
}
if (index < 0 || index2 < 0) {
if (location.contains("target/classes/")) {
index2 = location.lastIndexOf("/"); //e.g. file:/Users/curr_user/workspace/lenox/beyondj/beyondj-core/target/classes/
if (index < 0 || index2 < 0) {
throw new RuntimeException("Could not determine base location of launch");
}
return location.substring(index, index2 + 1);
}
}
return location.substring(index, index2) + File.separator;
}
public int launchApplications(Class<?> <API key>, List<String> files, String locationInCluster) throws Exception {
Validate.notNull(system, "actor system must not be null");
MimeMappingsParser mappingsParser = new MimeMappingsParser(
new ClassPathResource(<API key>.MIME_MAPPINGS_XML).getInputStream());
List<ApplicationOptions> allOptions = new ArrayList<>();
Map<String, String> <API key> = mappingsParser.getMimeMappings();
String configDirStr = null;
boolean isJarLaunch = isJarLaunch(<API key>);
String dir = null;
if (isJarLaunch) {
Config config = (Config) <API key>.<API key>().getBean(<API key>.CONFIG);
dir = LaunchUtil.<API key>(config);
configDirStr = dir + File.separator + "launchers" + File.separator + "config";
} else {
configDirStr = "conf";
}
File temp = new File(configDirStr);
if (!temp.exists() || !temp.isDirectory()) {
configDirStr = new File(".").getCanonicalPath() + "/beyondj-core/src/main/resources" + File.separator + "launchers" + File.separator + "config";
;
}
int numLaunched = 0;
String baseLocation = baseLocation(<API key>);
if (!baseLocation.contains("target/classes/")) {
ProtectionDomain protectionDomain = <API key>.getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
if (codeSource.toString().indexOf(".jar!") < 0) {
baseLocation = baseLocation.substring(baseLocation.indexOf("/"), baseLocation.lastIndexOf("/")) + File.separator + "conf";
}
}
if (files != null) {
if (LOG.isDebugEnabled()) LOG.debug("Found {} application(s) to launch. These are: ", files.size());
for (String str : files) {
if (LOG.isDebugEnabled()) LOG.debug(str);
}
if (configDirStr == null) {
configDirStr = new java.io.File(".").getCanonicalPath() + "/target/classes";
}
for (String fileName : files) {
String filePath = configDirStr + File.separator + fileName;
List<String> lines = null;
try {
File f = new File(filePath);
if (f.exists() && f.isDirectory()) {
if (LOG.isDebugEnabled())
LOG.debug("Skipping directory {} as we only want to readt files in dir", filePath);
continue;
}
lines = FileUtils.readLines(f);
} catch (Exception e) {
LOG.error("Error reading config file " + filePath, e);
throw new RuntimeException(e);
}
StringBuilder builder = new StringBuilder();
for (String line : lines) {
builder.append(line);
}
XStream xstream = new XStream();
xstream.alias(APPLICATION_OPTIONS, ApplicationOptions.class);
xstream.alias(APPLICATION_PACKAGE, ApplicationPackage.class);
xstream.<API key>(ApplicationPackage.class, "<API key>");
xstream.alias("friendlyName", java.lang.String.class);
xstream.alias("deploymentFile", java.lang.String.class);
xstream.alias("jarFile", java.lang.String.class);
xstream.alias("deploymentType", java.lang.String.class);
xstream.alias("downloadOptions", DownloadOptions.class);
xstream.alias("systemGateway", java.lang.Boolean.class);
xstream.alias("contextPath", java.lang.String.class);
xstream.alias("extraClassPath", java.lang.String.class);
xstream.alias("dependenciesDir", java.lang.String.class);
xstream.alias("bundleId", java.lang.String.class);
xstream.alias("version", java.lang.String.class);
xstream.alias("failureActionOption", FailureActionOption.class);
xstream.alias("printClassPath", java.lang.Boolean.class);
xstream.alias("enableAutoScaler", java.lang.Boolean.class);
xstream.alias("numInstances", java.lang.Integer.class);
xstream.alias("healthCheckInterval", java.lang.Integer.class);
xstream.alias("<API key>", java.lang.Integer.class);
xstream.alias("<API key>", TimeUnit.class);
xstream.alias("<API key>", TimeUnit.class);
xstream.alias("<API key>", java.lang.Boolean.class);
xstream.alias("enableProfiling", java.lang.Boolean.class);
xstream.alias("enableMetrics", java.lang.Boolean.class);
xstream.alias("jvmArgs", java.lang.String.class);
xstream.alias("<API key>", java.lang.Boolean.class);
xstream.alias("<API key>", java.lang.String.class);
xstream.alias("iconBase64", java.lang.String.class);
xstream.alias("war", java.lang.String.class);
xstream.alias("port", java.lang.Integer.class);
xstream.alias("httpsPort", java.lang.Integer.class);
xstream.alias("warLocation", java.lang.String.class);
xstream.alias("description", java.lang.String.class);
xstream.alias("locationInCluster", java.lang.String.class);
xstream.alias("<API key>", java.lang.Integer.class);
xstream.alias("requireAllPorts", java.lang.Boolean.class);
xstream.alias("loadBalancerDefType", LoadBalancerDefType.class);
xstream.alias("jarFile", java.lang.String.class);
xstream.alias("configFiles", java.lang.String.class);
xstream.alias("minThreads", java.lang.Integer.class);
xstream.alias("maxThreads", java.lang.Integer.class);
xstream.alias("maxQueueSize", java.lang.Integer.class);
xstream.alias("startCommand", java.lang.String.class);
xstream.alias("stopCommand", java.lang.String.class);
xstream.alias("statusCommand", java.lang.String.class);
xstream.alias("consoleEditable", java.lang.Boolean.class);
xstream.alias("supervisorId", java.lang.String.class);
xstream.alias("scriptFile", java.lang.String.class);
xstream.alias("deployedBy", java.lang.String.class);
xstream.alias("deploymentType", DeploymentType.class);
xstream.alias("deploymentFile", java.lang.String.class);
xstream.alias("sessionTimeout", java.lang.Integer.class);
xstream.alias("<API key>", java.lang.Integer.class);
xstream.alias("<API key>", java.lang.Integer.class);
xstream.alias("<API key>", java.lang.Integer.class);
xstream.alias("scalerInterval", java.lang.Long.class);
xstream.alias("scalerIntervalUnit", TimeUnit.class);
xstream.alias("numInstances", java.lang.Integer.class);
xstream.alias("maxInstances", java.lang.Integer.class);
xstream.alias("<API key>", java.lang.Boolean.class);
xstream.alias("registerJspServlet", java.lang.Boolean.class);
xstream.alias("requiresSSL", java.lang.Boolean.class);
xstream.alias("<API key>", java.lang.Boolean.class);
xstream.alias("healthCheckUrl", java.lang.String.class);
xstream.alias("jmxPort", java.lang.Integer.class);
xstream.alias("jmxDomain", java.lang.String.class);
xstream.alias("enableProfiling", java.lang.Boolean.class);
xstream.alias("enableJolokia", java.lang.Boolean.class);
xstream.alias("enableJmxConnector", java.lang.Boolean.class);
xstream.alias("jolokiaOptions", java.lang.String.class);
xstream.alias("requiresWar", java.lang.Boolean.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("<API key>", TimeUnit.class);
xstream.alias("<API key>", TimeUnit.class);
xstream.alias("systemGateway", java.lang.Boolean.class);
xstream.alias("metricsGateway", java.lang.Boolean.class);
xstream.alias("enableHealthCheck", java.lang.Boolean.class);
xstream.alias("<API key>", java.lang.String.class);
xstream.alias("<API key>", java.lang.String.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("id", UUID.class);
xstream.alias("documentRoot", java.lang.String.class);
xstream.alias("keyStoreAlias", java.lang.String.class);
xstream.alias("keyStorePassword", java.lang.String.class);
xstream.alias("keyStoreFile", java.lang.String.class);
xstream.alias("enableManualScaling", java.lang.Boolean.class);
xstream.alias("deploymentId", UUID.class);
xstream.alias("keyManagerPassword", java.lang.String.class);
xstream.alias("mimeMappings", java.util.HashMap.class);
xstream.alias("errorPages", java.util.ArrayList.class);
xstream.alias("welcomeFiles", java.util.ArrayList.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("<API key>", TimeUnit.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("delayedStartValue", java.lang.Long.class);
xstream.alias("delayedStartUnit", TimeUnit.class);
xstream.alias("<API key>", java.lang.Long.class);
xstream.alias("containerType", ContainerType.class);
xstream.alias("<API key>", java.lang.String.class);
xstream.alias("fullUrl", java.lang.String.class);
ApplicationOptions options = null;
try {
options = (ApplicationOptions) xstream.fromXML(builder.toString());
allOptions.add(options);
}catch(ClassCastException cce){
ApplicationPackage applicationPackage = (ApplicationPackage) xstream.fromXML(builder.toString());
List<ApplicationOptions>optionsList = applicationPackage.<API key>();
for(ApplicationOptions applicationOptions : optionsList){
allOptions.add(applicationOptions);
}
}
}
if (postLaunchActor == null) {
postLaunchActor = system.actorOf(springTypeExtension.props(<API key>.class));
}
if (portMasterActor == null) {
portMasterActor = system.actorOf(springTypeExtension.props(PortMasterActor.class));
}
if (systemGatewayActor == null) {
systemGatewayActor = system.actorOf(springTypeExtension.props(SystemGatewayActor.class));
}
if (<API key> == null) {
<API key> = system.actorOf(springTypeExtension.props(<API key>.class));
}
if (<API key> == null) {
<API key> = (<API key>)
<API key>.<API key>().getBean(<API key>.<API key>);
}
<API key>.<API key>(postLaunchActor);
<API key>.setPortMasterActor(portMasterActor);
<API key>.<API key>(systemGatewayActor);
<API key>.<API key>(<API key>);
SystemLaunchMessage message = new SystemLaunchMessage();
int size = 0;
Set<String> missingFiles = new HashSet<>();
Collections.sort(allOptions);
//provide a manual override for the number of instances to be launched, across the board
String numInstancesStr = System.getProperty(NUM_INSTANCES);
int numInstances = 0;
if (numInstancesStr != null && numInstancesStr.trim().length() > 0) {
numInstances = Integer.valueOf(numInstancesStr);
}
for (ApplicationOptions option : allOptions) {
//do not install if '<API key>' is specified and our local ip address in not in it
String <API key> = option.<API key>();
if (<API key> != null && <API key>.length() > 0) {
String localAddress = IpAddresssUtil.getLocalHostAddress();
<API key> = <API key>.trim();
if (!<API key>.contains(localAddress)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping installation as local ip address {} is not specified " +
"in '<API key>' in {}", localAddress, option);
continue;
}
}
}
if (numInstances > 0) {
if (!option.isSystemGateway() && !option.isMetricsGateway()) {
option.setNumInstances(numInstances);
}
}
option.<API key>(locationInCluster);
if (!option.isSystemGateway() && !option.isMetricsGateway()) {
DeploymentType deploymentType = option.getDeploymentType();
if (DeploymentType.<API key> == deploymentType) {
File file = null;
if (isJarLaunch) {
file = new File(dir + File.separator + "launchers" + File.separator + "jar-launchers" + File.separator + option.getJarFile());
} else {
file = new File(baseLocation + File.separator + "launchers" + File.separator + "jar-launchers" + File.separator + option.getJarFile());
}
if (!file.exists()) {
missingFiles.add(option.getFriendlyName());
LOG.error("Could not find jar-launcher: {} ", file.getAbsolutePath());
continue;
}
if (option.getContextPath() == null) {
option.setContextPath(option.getFriendlyName());
option.setBundleId(option.getBundleId());
option.setHttpsPort(null);
}
} else if (DeploymentType.SERVLET_CONTAINER == deploymentType) {
File file = null;
if (isJarLaunch) {
file = new File(dir + File.separator + "launchers" + File.separator + "webapp-launchers" + File.separator + option.getWar() + ".war");
} else {
file = new File(baseLocation + File.separator + "launchers" + File.separator + "webapp-launchers" + File.separator + option.getWar() + ".war");
}
if (!file.exists()) {
missingFiles.add(option.getFriendlyName());
LOG.error("Could not find web-app-launcher: {} ", file.getAbsolutePath());
continue;
}
} else if (DeploymentType.<API key> == deploymentType) {
File file = null;
if (isJarLaunch) {
file = new File(dir + File.separator + "launchers" + File.separator + "script-launchers" + File.separator + option.getDeploymentFile());
} else {
file = new File(baseLocation + File.separator + "launchers" + File.separator + "script-launchers" + File.separator + option.getDeploymentFile());
}
if (!file.exists()) {
missingFiles.add(option.getFriendlyName());
LOG.error("Could not find script-launcher: {}", file.getAbsolutePath());
continue;
}
if (option.getContextPath() == null) {
option.setContextPath(option.getFriendlyName());
option.setBundleId(option.getBundleId());
option.setHttpsPort(null);
}
}
}
size += option.getNumInstances();
option.<API key>(<API key>);
}
message.<API key>(allOptions.get(0));
message.<API key>(size);
postLaunchActor.tell(message, null);
for (ApplicationOptions option : allOptions) {
//do not notify if '<API key>' is specified and our local ip address in not in it
String <API key> = option.<API key>();
if (<API key> != null && <API key>.length() > 0) {
String localAddress = IpAddresssUtil.getLocalHostAddress();
<API key> = <API key>.trim();
if (!<API key>.contains(localAddress)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping notification as local ip address {} is not specified " +
"in '<API key>' in {}", localAddress, option);
continue;
}
}
}
if (missingFiles.contains(option.getFriendlyName())) {
if (option.getDeploymentType() == DeploymentType.SERVLET_CONTAINER && option.isRequiresWar()) {
if (LOG.isDebugEnabled())
LOG.debug("Skipping {} since bundle file for this application could not be found", option.getFriendlyName());
continue;
}
if (option.getDeploymentType() != DeploymentType.SERVLET_CONTAINER) {
if (LOG.isDebugEnabled())
LOG.debug("Skipping {} since bundle file for this application could not be found", option.getFriendlyName());
continue;
}
}
<API key> request = new <API key>();
request.<API key>(BundleRequestType.HYDRATE);
request.<API key>(option);
supervisor.tell(request, null);
numLaunched++;
}
} else {
if (LOG.isDebugEnabled()) LOG.debug("Found no applications to launch");
}
return numLaunched;
}
private static final Logger LOG = LoggerFactory.getLogger(<API key>.class);
} |
import { Component, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-manager',
templateUrl: 'manager.component.html',
styleUrls: ['manager.component.scss']
})
export class ManagerComponent {
// SZ this.mutator has type number
// SZ so event emiters should have type number, not any
@Output() increase = new EventEmitter<number>();
@Output() decrease = new EventEmitter<number>();
private mutator: number;
constructor() {
this.mutator = 1;
}
public onIncrease(): void {
this.increase.emit(this.mutator);
}
public onDecrease(): void {
this.decrease.emit(this.mutator);
}
} |
# AUTOGENERATED FILE
FROM balenalib/cl-som-imx8-ubuntu:cosmic-run
ENV NODE_VERSION 10.23.1
ENV YARN_VERSION 1.22.4
RUN buildDeps='curl libatomic1' \
&& set -x \
&& for key in \
<API key> \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
done \
&& apt-get update && apt-get install -y $buildDeps --<API key> \ |
# Dichanthium annulatum (Forssk.) Stapf SPECIES
# Status
ACCEPTED
# According to
The Catalogue of Life, 3rd January 2011
# Published in
D. Prain, Fl. trop. Afr. 9:178. 1917
# Original name
Andropogon annulatus J.A.Schmidt
Remarks
null |
var Login = function () {
var handleLogin = function() {
$('.login-form').validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block', // default input error message class
focusInvalid: false, // do not focus the last invalid input
rules: {
username: {
required: true
},
password: {
required: true
},
remember: {
required: false
}
},
messages: {
username: {
required: "."
},
password: {
required: "."
}
},
invalidHandler: function (event, validator) { //display error alert on form submit
$(".loginbox-body").css({'margin-top':'78px'});
$('.alert-danger', $('.loginbody')).show();
},
highlight: function (element) { // hightlight error inputs
$(element)
.closest('.form-group').addClass('has-error'); // set error class to the control group
},
success: function (label) {
label.closest('.form-group').removeClass('has-error');
label.remove();
},
errorPlacement: function (error, element) {
// error.insertAfter(element.closest('.input-icon'));
},
submitHandler: function (form) {
form.submit();
}
});
$('.login-form input').keypress(function (e) {
if (e.which == 13) {
if ($('.login-form').validate().form()) {
$('.login-form').submit();
}
return false;
}
});
}
return {
//main function to initiate the module
init: function () {
handleLogin();
}
};
}(); |
package net.crowdweather.droid;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
public class MainActivity extends FragmentActivity {
private PagerAdapter mPagerAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.activity_main);
this.initialisePaging();
}
private void initialisePaging() {
this.mPagerAdapter = new PageAdapter(super.<API key>(),
this);
ViewPager pager = (ViewPager) super.findViewById(R.id.viewpager);
pager.setAdapter(this.mPagerAdapter);
}
} |
#ifndef LITE_ITERATOR_H
#define LITE_ITERATOR_H
#include "xnucxx/LiteObject.h"
class <API key> : public LiteObject {
public:
class Delegate {
public:
virtual bool initIterator(void *iterationContext) const = 0;
virtual bool <API key>(void *iterationContext, LiteObject **nextObject) const = 0;
};
public:
virtual void reset() = 0;
virtual LiteObject *getNextObject() = 0;
};
class <API key>;
class <API key> : public <API key> {
protected:
const <API key> *collection;
void *innerIterator;
public:
explicit <API key>(const <API key> *collection) {
initWithCollection(collection);
}
~<API key>() {
release();
}
void release() override;
void reset() override;
LiteObject *getNextObject() override;
bool initWithCollection(const <API key> *collection);
};
#endif |
# Bovista oblongispora (Lloyd) Bottomley SPECIES
# Status
ACCEPTED
# According to
Index Fungorum
# Published in
Bothalia 4(3): 580 (1948)
# Original name
Bovistella oblongispora Lloyd
Remarks
null |
package com.rnapexuiexample;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean <API key>() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
} |
<!
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http:
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<dom-module id="twitter-login">
<style is="custom-style">
:host {
font-size: 16px;
}
.large{
background: #00B0ED;
color: #fff;
border-radius: 3px;
cursor: pointer;
text-transform: none;
vertical-align: center;
width: 205px;
height: 50px;
}
.sort{
background: #00B0ED;
border-radius: 3px;
cursor: pointer;
vertical-align: center;
height: 46px;
width: 82px;
}
.icon{
--iron-icon-width: 24px;
--iron-icon-height: 24px;
margin-right: 5px;
}
.disconnect{
background: grey;
}
</style>
<template>
<iron-ajax
id="requestToken"
url="{{endpoint}}"
method="GET"
handleAs="json"
on-response="_authentication"
>
</iron-ajax>
<!-- Large and disconnected -->
<template is="dom-if" if="[[<API key>(logged, sort)]]">
<paper-button class="large" tittle="Twitter" on-click="_login">
<iron-icon src="twitter_logo.png" class="icon"></iron-icon>
<span>Login with Twitter</span>
</paper-button>
</template>
<!-- large and connected-->
<template is="dom-if" if="[[_largeAndConnected(logged, sort)]]">
<paper-button class="large disconnect" tittle="Twitter" on-click="_logout">
<iron-icon src="twitter_logo.png" class="icon"></iron-icon>
<span>Logout with Twitter</span>
</paper-button>
</template>
<!-- sort and disconnected -->
<template is="dom-if" if="[[<API key>(logged, sort)]]">
<paper-button class="sort" tittle="Twitter" on-click="_login">
<iron-icon src="twitter_logo.png" class="icon"></iron-icon>
</paper-button>
</template>
<!-- sort and connected-->
<template is="dom-if" if="[[_sortAndConnected(logged, sort)]]">
<paper-button class="sort disconnect" tittle="Twitter" on-click="_logout">
<iron-icon src="twitter_logo.png" class="icon"></iron-icon>
</paper-button>
</template>
</template>
<script>
Polymer({
is:"twitter-login",
properties:{
endpoint: {
type: String,
value: "",
reflectToAttribute: true
},
logged: {
type: Boolean,
value: false,
reflectToAttribute: true
},
sort: {
type: Boolean,
value: false,
reflectToAttribute: true
},
},
<API key>: function (logged,sort) {
return !logged && !sort;
},
_largeAndConnected: function(logged, sort) {
return logged && !sort;
},
<API key>: function(logged, sort) {
return !logged && sort;
},
_sortAndConnected: function(logged, sort) {
return logged && sort;
},
_login: function() {
this.$.requestToken.generateRequest();
},
_authentication: function(event, detail, sender) {
var oauth_url = detail.response.oauth_url;
var win = window.open(oauth_url, "Autoriza la aplicacion", 'width=800, height=600');
var back = this;
var pollTimer = window.setInterval(function() {
try {
var url, verifier_patron, exp, token_patron;
url = win.document.URL;
verifier_patron = "oauth_verifier"+"=([^&
token_patron = "oauth_token" + "=([^&
exp = new RegExp(verifier_patron);
back.oauth_verifier = exp.exec(url)[1];
exp = new RegExp(token_patron);
back.oauth_token = exp.exec(url)[1];
back.fire('twitter-logged',{oauth_verifier:back.oauth_verifier, redSocial:'twitter',token:back.oauth_token});
window.clearInterval(pollTimer);
win.close();
} catch(e) {
}
}, 100);
},
/* Borrar todo relacionado en base de datos */
_logout: function(event, detail, sender){
/* Borrar datos de la base de datos */
var back = this;
back.logged = false
},
});
</script>
</dom-module> |
<!DOCTYPE html>
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../../style.css');
@import url('../../../../../tree.css');
</style>
<script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../../clover.js" type="text/javascript"></script>
<script src="../../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../../cloud.js" type="text/javascript"></script>
<title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title>
</head>
<body>
<div id="page">
<header id="header" role="banner">
<nav class="aui-header <API key>" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo <API key>">
<a href="http://openclover.org" title="Visit OpenClover home page"><span class="<API key>">OpenClover</span></a>
</h1>
</div>
<div class="<API key>">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online documentation" target="_blank"
href="http://openclover.org/documentation">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="<API key>">
<div class="aui-page-panel-nav <API key>">
<div class="<API key>" style="margin-bottom: 20px;">
<div class="<API key>">
<a href="http://cardatechnologies.com" target="_top">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</a>
</div>
<div class="<API key>" >
<h1>
<a href="http://cardatechnologies.com" target="_top">
ABA Route Transit Number Validator 1.0.1-SNAPSHOT
</a>
</h1>
</div>
</div>
<nav class="aui-navgroup <API key>">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading <API key>">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui <API key>">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="<API key> hidden">
<small>No results found.</small>
</p>
<div class="<API key>" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator">
<div class="<API key>"></div>
<div class="<API key>"></div>
</div>
</div>
</div>
</nav> </div>
<section class="<API key>">
<div class="<API key>">
<div class="<API key>"><ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li>
<li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li>
<li><a href="<API key>.html">Class <API key></a></li>
</ol></div>
<h1 class="aui-h2-clover">
Test <API key>
</h1>
<table class="aui">
<thead>
<tr>
<th>Test</th>
<th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th>
<th><label title="When the test execution was started">Start time</label></th>
<th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th>
<th><label title="A failure or error message if the test is not successful.">Message</label></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/<API key>.html?line=8368#src-8368" ><API key></a>
</td>
<td>
<span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span>
</td>
<td>
7 Aug 12:34:29
</td>
<td>
0.0 </td>
<td>
<div></div>
<div class="errorMessage"></div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<table class="aui aui-table-sortable">
<thead>
<tr>
<th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th>
<th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> <API key></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=36348#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a>
</td>
<td>
<span class="sortValue">0.7352941</span>73.5%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td>
</tr>
</tbody>
</table>
</div> <!-- class="<API key>" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1
on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT.
</li>
</ul>
<ul>
<li>OpenClover is free and open-source software. </li>
</ul>
</section>
</footer> </section> <!-- class="<API key>" -->
</div> <!-- class="<API key>" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html> |
package measure;
import java.util.Iterator;
import org.apache.commons.configuration.<API key>;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.<API key>;
import org.apache.commons.configuration.<API key>;
public class CommonConfTest {
public static void main(String[] args) throws <API key> {
// TODO Auto-generated method stub
<API key> <API key> = new <API key>();
Configuration config = new <API key>("property");
<API key>.addConfiguration(config);
Iterator<String> keys = <API key>.getKeys();
// System.err.println(keys.next());
// System.err.println(keys.next());
// System.err.println(keys.next());
// System.err.println(keys.next());
// System.err.println(keys.next());
Iterator<String> ks = <API key>.getKeys("measure.producer");
System.out.println(ks.next().replaceFirst("measure.producer.", ""));
System.out.println(ks.next().replaceFirst("measure.producer.", ""));
System.out.println(ks.next().replaceFirst("measure.producer.", ""));
// Properties ps = <API key>.getProperties("key1");
// Set<Object> kesy = ps.keySet();
// for( Object k:kesy){
// System.out.println(k);
}
} |
package com.geecat.oo;
public interface Interface2 {
public void eat();
} |
package com.cloud.agent.api.routing;
import com.cloud.agent.api.to.IpAddressTO;
public class IpAssocVpcCommand extends IpAssocCommand {
protected IpAssocVpcCommand() {
super();
}
public IpAssocVpcCommand(final IpAddressTO[] ips) {
super(ips);
}
@Override
public int getAnswersCount() {
//Count private gateway to maximum value
return ipAddresses.length * 2;
}
} |
const utils = require('./utils.js');
const fs = require('fs');
const ncp = require('ncp').ncp;
const chalk = require('chalk');
const path = require('path');
const helperMessages = require('./helperMessages.js');
const inquirer = require('inquirer');
const configAngular = require('./configAngular').configAngular;
function updateCssCopy(settings, ionicPackage) {
// if there is no ionic_copy defined add the copy script and inject to the package.json
ionicPackage.config['ionic_copy'] = './scripts/copy-mobiscroll-css.js';
utils.writeToFile(settings.packageJsonLocation, JSON.stringify(ionicPackage, null, 4));
ncp(__dirname + '/../resources/ionic/scripts', path.resolve(settings.currDir, 'scripts'), function (err) {
if (err) {
utils.printError('Could not copy mobiscroll resources.\n\n' + err);
return;
}
});
}
function configIonic(settings, callback) {
let ionicPackage = settings.packageJson;
let currDir = settings.currDir;
// Add ionic_copy script to package.json and copy the scrips folder
ionicPackage.config = ionicPackage.config || {};
var ionicCopyLocation = ionicPackage.config['ionic_copy'];
if (settings.useScss) {
let fileName = 'variables.scss'
console.log(` Adding scss stylesheet to ${chalk.grey(fileName)}`);
utils.appendContentToFile(
path.resolve(currDir, 'src/theme', fileName),
`$mbsc-font-path: '../lib/mobiscroll/css/';
@import "../../node_modules/@mobiscroll/angular/dist/css/mobiscroll${ settings.isNpmSource ? '' : '.angular' }.scss";`,
'',
false,
/(\$mbsc-font-path: '..\/lib\/mobiscroll\/css\/';[\s\S]+)?@import "[\S]+mobiscroll[\S]+\.scss";/gm,
(err) => {
if (err) {
utils.printError(`Couldn't update ${chalk.grey(fileName)}. Does your project is configured with sass?`);
return;
}
}
);
} else {
console.log(`\n Adding stylesheet copy script to ${chalk.grey('package.json')}`);
console.log(` Copying scripts`);
}
if (!ionicCopyLocation) {
updateCssCopy(settings, ionicPackage);
} else {
// if the ionic_copy is already used update the specific script with mobiscroll copy
var copyScriptLocation = path.resolve(currDir, ionicCopyLocation);
let copyScript = require(copyScriptLocation);
if (Object.keys(copyScript).length === 1 && copyScript['copyMobiscrollCss']) {
fs.unlinkSync(copyScriptLocation);
delete ionicPackage.config['ionic_copy'];
updateCssCopy(settings, ionicPackage);
} else {
delete copyScript['copyMobiscrollCss'];
copyScript['copyMobiscrollCss'] = {
function detectReactPages(settings/*, callback*/) { |
using System;
using System.Collections.Generic;
using System.Text;
using NPOI.SS.Formula.Eval;
namespace NPOI.SS.Formula.Functions
{
internal class Clean : SingleArgTextFunc
{
public override ValueEval Evaluate(String arg)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < arg.Length; i++)
{
char c = arg[i];
if (TextFunction.IsPrintable(c))
{
result.Append(c);
}
}
return new StringEval(result.ToString());
}
}
} |
### User-configurable parameteres
## Paths
#boost_header_path=$(HOME)/sys/src/git/boost
boost_header_path=$(CURDIR)/thirdparty/boost_1_65_0
#boost_libs_path=$(HOME)/sys/src/git/boost/stage/lib
boost_libs_path=$(CURDIR)/thirdparty/boost_1_65_0/stage/lib
<API key>=$(HOME)/sys/src/svn/<API key>
boost_ublasx_home=../boost-ublasx
cplex_home=$(HOME)/sys/opt/optim/ibm/ILOG/CPLEX_Studio1271
dcsxx_commons_home=../dcsxx-commons
dcsxx_control_home=../dcsxx-control
dcsxx_network_home=../dcsxx-network
dcsxx_sysid_home=../dcsxx-sysid
<API key>=$(HOME)/sys/src/git/fuzzylite/fuzzylite
#fuzzylite_libs_path=$(HOME)/sys/src/git/fuzzylite/fuzzylite/debug/bin
fuzzylite_libs_path=$(HOME)/sys/src/git/fuzzylite/fuzzylite/release/bin
fuzzylitex_home=../fuzzylitex
gurobi_home=$(HOME)/sys/opt/optim/gurobi605/linux64
yaml_header_path=$(HOME)/sys/include
yaml_libs_path=$(HOME)/sys/lib
## Inform that MATLAB is available
<API key>=1
## Choose what optimizer to use
<API key>=1
<API key>=0
## Port used to contact memory info server inside a VM
meminfo_server_port=9090
## Have LAPACK
flx_have_lapack=1
ifeq (1,$(<API key>))
#cplex_version=126
cplex_incs=-I$(cplex_home)/cplex/include -I$(cplex_home)/concert/include -DIL_STD
cplex_libs=-L$(cplex_home)/cplex/lib/x86-64_linux/static_pic -L$(cplex_home)/concert/lib/x86-64_linux/static_pic -lilocplex -lcplex -lconcert -lm -lpthread
else ifeq (1,$(<API key>))
gurobi_incs=-I$(gurobi_home)/include
gurobi_libs=-L$(gurobi_home)/lib -lgurobi60 -lgurobi_c++ -Wl,-rpath,$(gurobi_home)/lib
endif
# verify that JAVA_HOME is set to something (should be the bare minimum)
ifndef JAVA_HOME
$(warning WARNING: Variable JAVA_HOME is not set! Use default value.)
JAVA_HOME=/usr/lib/jvm/java
endif
project_home=$(PWD)
export project_home
CXXFLAGS+=-Wall -Wextra -ansi -pedantic
#CXXFLAGS+=-Wall -Wextra -std=c++11 -pedantic
CXXFLAGS+=-g
# boost
CXXFLAGS+=-I$(boost_header_path)
CXXFLAGS+=-<API key>=4
LDFLAGS+=-L$(boost_libs_path)
LDLIBS+=-lboost_system -lboost_chrono -lboost_thread -lpthread -lrt
LDLIBS+=-lboost_timer
# <API key>
CXXFLAGS+=-I$(<API key>)
# boost-ublasx
CXXFLAGS+=-I$(boost_ublasx_home)
# dcsxx-commons
CXXFLAGS+=-I$(dcsxx_commons_home)/inc
# dcsxx-control
CXXFLAGS+=-I$(dcsxx_control_home)/inc
ifeq (1,$(<API key>))
CXXFLAGS+=-<API key>
CXXFLAGS+=$(cplex_incs)
LDFLAGS+=$(cplex_libs)
else ifeq (1,$(<API key>))
CXXFLAGS+=-<API key>
CXXFLAGS+=$(gurobi_incs)
LDFLAGS+=$(gurobi_libs)
endif
# dcsxx-network
CXXFLAGS+=-I$(dcsxx_network_home)/inc
# dcsxx-sysid
CXXFLAGS+=-I$(dcsxx_sysid_home)/inc
# dcsxx-testbed
CXXFLAGS+=-I./inc
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>=$(shell printf "%d" "'Y'")
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
#CXXFLAGS+=$(shell pkg-config sqlite3 --cflags)
#CXXFLAGS+=-<API key>
#CXXFLAGS+=$(shell mysql_config --cflags) -I$(HOME)/sys/include
#CXXFLAGS+=-<API key>
#CXXFLAGS+=-<API key>
##CXXFLAGS+=-<API key>
##CXXFLAGS+=-<API key>
##CXXFLAGS+=-<API key>
CXXFLAGS+=-<API key>
CXXFLAGS+=-<API key>="\"$(meminfo_server_port)\""
ifeq (1,$(<API key>))
CXXFLAGS+=-<API key>
endif
LDLIBS+=-lm
LDLIBS+=-llapack -lblas
LDLIBS+=-ljsoncpp
# fuzzylite
CXXFLAGS+=-I$(<API key>)
LDFLAGS+=-L$(fuzzylite_libs_path)
#LDLIBS+=-lfuzzylited
LDLIBS+=-lfuzzylite
# fuzzylitex
CXXFLAGS+=-I$(fuzzylitex_home)/include
CXXFLAGS+=-<API key>
LDLIBS+=-llapack -lblas -lm
#CXXFLAGS+=-<API key> -I/usr/include/lapacke
#CXXFLAGS+=-<API key> -<API key>="void" -<API key>="void"
#LDLIBS+=-llapacke
LDFLAGS+=-L$(fuzzylitex_home)/bin
LDLIBS+=-lfuzzylitex
# libvirt
CXXFLAGS+=$(shell pkg-config libvirt --cflags)
LDFLAGS+=$(shell pkg-config libvirt --libs)
# t-digest
CXXFLAGS += -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
<API key>+="\"$(CLASSPATH):thirdparty/t-digest\""
CXXFLAGS+=-<API key>=$(<API key>)
LDFLAGS += -L$(JAVA_HOME)/jre/lib/i386 -L$(JAVA_HOME)/jre/lib/amd64 -L$(JAVA_HOME)/jre/lib/i386/client -L$(JAVA_HOME)/jre/lib/amd64/server
LDLIBS += -ljvm
# yaml
CXXFLAGS+=-I$(yaml_header_path)
LDFLAGS+=-L$(yaml_libs_path)
LDLIBS+=-lyaml-cpp
.PHONY: all clean sysid sysmgt thirdparty
#all: netsnif sysid sysmgt
#netsnif: src/netsnif
all: sysid sysmgt
clean: thirdparty-clean
$(RM) src/sysid.o src/sysid \
src/sysmgt.o src/sysmgt
# src/netsnif.o src/netsnif
sysid: thirdparty src/sysid
sysmgt: thirdparty src/sysmgt
# These two rules are needed because the default behavior would be:
# $(CXX) $(CXXFLAGS) $(LDFLAGS) foobar.cpp -o foobar
# which causes CPLEX to not link
src/sysmgt: src/sysmgt.o thirdparty/t-digest/tdigestx.o thirdparty/t-digest/GiwsException.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
src/sysid: src/sysid.o thirdparty/t-digest/tdigestx.o thirdparty/t-digest/GiwsException.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
thirdparty: tdigest
thirdparty-clean: tdigest-clean
tdigest:
cd thirdparty/t-digest && $(MAKE)
tdigest-clean:
cd thirdparty/t-digest && $(MAKE) clean |
# Mobile Map Package
This sample demonstrates how to open and display a map from a Mobile Map Package. It is developed with the [Kotlin](http://kotlinlang.org/) programming language to demonstrate ArcGIS Android SDK support for Kotlin.

# Getting started with ArcGIS Android and Kotlin
## Using Gradle
Configure dependencies
We need to add dependencies to the **<API key>** and the **kotlin** standard library:
Project root build.gradle:
groovy
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'org.jetbrains.kotlin:<API key>:[version]'
}
App module build.gradle:
groovy
dependencies {
compile 'org.jetbrains.kotlin:kotlin-stdlib:[version]'
compile 'com.esri.arcgisruntime:arcgis-android:100.1.0'
}
Configure kotlin-plugin
Add the _kotlin-plugin_ & _Kotlin Android Extensions_ to your app module plugins in your app module build.gradle:
groovy
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: '<API key>'
Configure Kotlin source sets
Kotlin files go into your app module **src/main/kotlin** directory, update the following **sourceSets** to the _android_ method closure in your app module build.gradle:
groovy
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
## Features
- MapView
- MobileMapPackage
## Sample Pattern
This demo takes a Mobile Map Package that was created in ArcGIS Pro, and displays a `Map` from within the package in a `MapView`. This is accomplished by calling `MobileMapPackage.loadAsyc()` and waiting for its load status to be completed. Once the package is loaded, you can access its maps, and assign one of the maps to be viewed in the `MapView`.
This demo takes advantage of [Kotlin Android Extensions](http://kotlinlang.org/docs/tutorials/android-plugin.html) which enhances the development experience by removing `findViewById()` to instantiate a `MapView`.
Configure the dependency
You enable the Android Extensions Gradle plugin by adding the following to the app module build.gradle file:
groovy
apply plugin: '<API key>'
Import synthetic properties
You can import all widget properties from the `activity_main` layout resource all at once by adding the following import:
kotlin
import kotlinx.android.synthetic.main.activity_main.*
Now we can invoke the corresponding extension properties for the views in the XML file, specifically `mapView`:
xml
<!-- MapView -->
<com.esri.arcgisruntime.mapping.view.MapView
android:id="@+id/mapView"
>
</com.esri.arcgisruntime.mapping.view.MapView>
Now you can directly access `mapView` in code without declaring it first:
kotlin
mapView.map = mapPackage.maps[0]
## Provision your device
1. Download the data from [ArcGIS Online](https:
2. Extract the contents of the downloaded zip file to disk.
3. Create an ArcGIS/samples/MapPackage folder on your device. This requires you to use the [Android Debug Bridge (adb)](https://developer.android.com/guide/developing/tools/adb.html) tool found in **<sdk-dir>/platform-tools**.
4. Open up a command prompt and execute the ```adb shell``` command to start a remote shell on your target device.
5. Navigate to your sdcard directory, e.g. ```cd /sdcard/```.
6. Create the ArcGIS/samples/MapPackage directory, ```mkdir ArcGIS/samples/MapPackage```.
7. You should now have the following directory on your target device, ```/sdcard/ArcGIS/samples/MapPackage```. We will copy the contents of the downloaded data into this directory. Note: Directory may be slightly different on your device.
8. Exit the shell with the, ```exit``` command.
9. While still in your command prompt, navigate to the folder where you extracted the contents of the data from step 1 and execute the following command:
* ```adb push Yellowstone.mmpk /sdcard/ArcGIS/samples/MapPackage```
Link | Local Location
|[Yellowstone Mobile Map Package](https: |
package ru.job4j.bunmachine;
public class <API key> extends RuntimeException{
public String toString() {
return "Не назначена цена пончиков в автомате!";
}
} |
local cjson = require "cjson"
local helpers = require "spec.helpers"
describe("Plugin: rate-limiting (API)", function()
local admin_client
teardown(function()
if admin_client then admin_client:close() end
helpers.stop_kong()
end)
describe("POST", function()
setup(function()
assert(helpers.dao.apis:insert {
name = "test",
hosts = { "test1.com" },
upstream_url = "http://mockbin.com"
})
assert(helpers.start_kong())
admin_client = helpers.admin_client()
end)
it("should not save with empty config", function()
local res = assert(admin_client:send {
method = "POST",
path = "/apis/test/plugins/",
body = {
name = "rate-limiting"
},
headers = {
["Content-Type"] = "application/json"
}
})
local body = assert.res_status(400, res)
assert.equal([[{"config":"You need to set at least one limit: second, minute, hour, day, month, year"}]], body)
end)
it("should save with proper config", function()
local res = assert(admin_client:send {
method = "POST",
path = "/apis/test/plugins/",
body = {
name = "rate-limiting",
config = {
second = 10
}
},
headers = {
["Content-Type"] = "application/json"
}
})
local body = cjson.decode(assert.res_status(201, res))
assert.equal(10, body.config.second)
end)
end)
end) |
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>"src/core/Messages" | GDAX Trading Toolkit API Reference</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">GDAX Trading Toolkit API Reference</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="<API key>">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="<API key>" checked />
<label class="tsd-widget" for="<API key>">Inherited</label>
<input type="checkbox" id="<API key>" checked />
<label class="tsd-widget" for="<API key>">Externals</label>
<input type="checkbox" id="<API key>" />
<label class="tsd-widget" for="<API key>">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="_src_core_messages_.html">"src/core/Messages"</a>
</li>
</ul>
<h1>External module "src/core/Messages"</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Interfaces</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.baseordermessage.html" class="tsd-kind-icon">Base<wbr>Order<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">Cancel<wbr>Order<wbr>Request<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.changedordermessage.html" class="tsd-kind-icon">Changed<wbr>Order<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.errormessage.html" class="tsd-kind-icon">Error<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.levelmessage.html" class="tsd-kind-icon">Level<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">My<wbr>Order<wbr>Placed<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.newordermessage.html" class="tsd-kind-icon">New<wbr>Order<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.orderdonemessage.html" class="tsd-kind-icon">Order<wbr>Done<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.orderbookmessage.html" class="tsd-kind-icon">Orderbook<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.placeordermessage.html" class="tsd-kind-icon">Place<wbr>Order<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.snapshotmessage.html" class="tsd-kind-icon">Snapshot<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.streammessage.html" class="tsd-kind-icon">Stream<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.tickermessage.html" class="tsd-kind-icon">Ticker<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">Trade<wbr>Executed<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">Trade<wbr>Finalized<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.trademessage.html" class="tsd-kind-icon">Trade<wbr>Message</a></li>
<li class="tsd-kind-interface <API key>"><a href="../interfaces/_src_core_messages_.unknownmessage.html" class="tsd-kind-icon">Unknown<wbr>Message</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Functions</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-function <API key>"><a href="_src_core_messages_.html#iserrormessage" class="tsd-kind-icon">is<wbr>Error<wbr>Message</a></li>
<li class="tsd-kind-function <API key>"><a href="_src_core_messages_.html#isordermessage" class="tsd-kind-icon">is<wbr>Order<wbr>Message</a></li>
<li class="tsd-kind-function <API key>"><a href="_src_core_messages_.html#isorderbookmessage" class="tsd-kind-icon">is<wbr>Orderbook<wbr>Message</a></li>
<li class="tsd-kind-function <API key>"><a href="_src_core_messages_.html#isstreammessage" class="tsd-kind-icon">is<wbr>Stream<wbr>Message</a></li>
<li class="tsd-kind-function <API key>"><a href="_src_core_messages_.html#isunknownmessage" class="tsd-kind-icon">is<wbr>Unknown<wbr>Message</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Functions</h2>
<section class="tsd-panel tsd-member tsd-kind-function <API key>">
<a name="iserrormessage" class="tsd-anchor"></a>
<h3>is<wbr>Error<wbr>Message</h3>
<ul class="tsd-signatures tsd-kind-function <API key>">
<li class="tsd-signature tsd-kind-icon">is<wbr>Error<wbr>Message<span class="<API key>">(</span>msg<span class="<API key>">: </span><span class="tsd-signature-type">any</span><span class="<API key>">)</span><span class="<API key>">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/coinbase/gdax-tt/blob/a3d18bb/src/core/Messages.ts#L37">src/core/Messages.ts:37</a></li>
</ul>
</aside>
<h4 class="<API key>">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>msg: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function <API key>">
<a name="isordermessage" class="tsd-anchor"></a>
<h3>is<wbr>Order<wbr>Message</h3>
<ul class="tsd-signatures tsd-kind-function <API key>">
<li class="tsd-signature tsd-kind-icon">is<wbr>Order<wbr>Message<span class="<API key>">(</span>msg<span class="<API key>">: </span><span class="tsd-signature-type">any</span><span class="<API key>">)</span><span class="<API key>">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/coinbase/gdax-tt/blob/a3d18bb/src/core/Messages.ts#L75">src/core/Messages.ts:75</a></li>
</ul>
</aside>
<h4 class="<API key>">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>msg: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function <API key>">
<a name="isorderbookmessage" class="tsd-anchor"></a>
<h3>is<wbr>Orderbook<wbr>Message</h3>
<ul class="tsd-signatures tsd-kind-function <API key>">
<li class="tsd-signature tsd-kind-icon">is<wbr>Orderbook<wbr>Message<span class="<API key>">(</span>msg<span class="<API key>">: </span><span class="tsd-signature-type">any</span><span class="<API key>">)</span><span class="<API key>">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/coinbase/gdax-tt/blob/a3d18bb/src/core/Messages.ts#L61">src/core/Messages.ts:61</a></li>
</ul>
</aside>
<h4 class="<API key>">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>msg: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function <API key>">
<a name="isstreammessage" class="tsd-anchor"></a>
<h3>is<wbr>Stream<wbr>Message</h3>
<ul class="tsd-signatures tsd-kind-function <API key>">
<li class="tsd-signature tsd-kind-icon">is<wbr>Stream<wbr>Message<span class="<API key>">(</span>msg<span class="<API key>">: </span><span class="tsd-signature-type">any</span><span class="<API key>">)</span><span class="<API key>">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/coinbase/gdax-tt/blob/a3d18bb/src/core/Messages.ts#L28">src/core/Messages.ts:28</a></li>
</ul>
</aside>
<h4 class="<API key>">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>msg: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function <API key>">
<a name="isunknownmessage" class="tsd-anchor"></a>
<h3>is<wbr>Unknown<wbr>Message</h3>
<ul class="tsd-signatures tsd-kind-function <API key>">
<li class="tsd-signature tsd-kind-icon">is<wbr>Unknown<wbr>Message<span class="<API key>">(</span>msg<span class="<API key>">: </span><span class="tsd-signature-type">any</span><span class="<API key>">)</span><span class="<API key>">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/coinbase/gdax-tt/blob/a3d18bb/src/core/Messages.ts#L47">src/core/Messages.ts:47</a></li>
</ul>
</aside>
<h4 class="<API key>">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>msg: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../globals.html"><em>Globals</em></a>
</li>
<li class="current <API key>">
<a href="_src_core_messages_.html">"src/core/<wbr>Messages"</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.baseordermessage.html" class="tsd-kind-icon">Base<wbr>Order<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">Cancel<wbr>Order<wbr>Request<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.changedordermessage.html" class="tsd-kind-icon">Changed<wbr>Order<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.errormessage.html" class="tsd-kind-icon">Error<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.levelmessage.html" class="tsd-kind-icon">Level<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">My<wbr>Order<wbr>Placed<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.newordermessage.html" class="tsd-kind-icon">New<wbr>Order<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.orderdonemessage.html" class="tsd-kind-icon">Order<wbr>Done<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.orderbookmessage.html" class="tsd-kind-icon">Orderbook<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.placeordermessage.html" class="tsd-kind-icon">Place<wbr>Order<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.snapshotmessage.html" class="tsd-kind-icon">Snapshot<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.streammessage.html" class="tsd-kind-icon">Stream<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.tickermessage.html" class="tsd-kind-icon">Ticker<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">Trade<wbr>Executed<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.<API key>.html" class="tsd-kind-icon">Trade<wbr>Finalized<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.trademessage.html" class="tsd-kind-icon">Trade<wbr>Message</a>
</li>
<li class=" tsd-kind-interface <API key>">
<a href="../interfaces/_src_core_messages_.unknownmessage.html" class="tsd-kind-icon">Unknown<wbr>Message</a>
</li>
<li class=" tsd-kind-function <API key>">
<a href="_src_core_messages_.html#iserrormessage" class="tsd-kind-icon">is<wbr>Error<wbr>Message</a>
</li>
<li class=" tsd-kind-function <API key>">
<a href="_src_core_messages_.html#isordermessage" class="tsd-kind-icon">is<wbr>Order<wbr>Message</a>
</li>
<li class=" tsd-kind-function <API key>">
<a href="_src_core_messages_.html#isorderbookmessage" class="tsd-kind-icon">is<wbr>Orderbook<wbr>Message</a>
</li>
<li class=" tsd-kind-function <API key>">
<a href="_src_core_messages_.html#isstreammessage" class="tsd-kind-icon">is<wbr>Stream<wbr>Message</a>
</li>
<li class=" tsd-kind-function <API key>">
<a href="_src_core_messages_.html#isunknownmessage" class="tsd-kind-icon">is<wbr>Unknown<wbr>Message</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="<API key>"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function <API key>"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="<API key>"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="<API key>"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property <API key>"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method <API key>"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface <API key>"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="<API key> <API key>"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property <API key>"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method <API key>"><span class="tsd-kind-icon">Method</span></li>
<li class="<API key> <API key>"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class <API key>"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="<API key> <API key>"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property <API key>"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method <API key>"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor <API key>"><span class="tsd-kind-icon">Accessor</span></li>
<li class="<API key> <API key>"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="<API key> <API key> tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property <API key> tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method <API key> tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor <API key> tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property <API key> tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method <API key> tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor <API key> tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property <API key> tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method <API key> tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor <API key> tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property <API key> tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="<API key> <API key> tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="http://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
</body>
</html> |
package com.lamfire.json.serializer;
public interface PropertyFilter {
/**
* @param source the owner of the property
* @param name the name of the property
* @param value the value of the property
* @return true if the property will be filtered out, false otherwise
*/
boolean apply(Object source, String name, Object value);
} |
<!doctype html>
<html xmlns="http:
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Module docplex.cp.config — DOcplex.CP: Constraint Programming Modeling for Python V2.16 documentation</title>
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="<API key>" data-url_root="./" src="_static/<API key>.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/bizstyle.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Module docplex.cp.solver.solver" href="docplex.cp.solver.solver.py.html" />
<link rel="prev" title="Module docplex.cp.solution" href="docplex.cp.solution.py.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="docplex.cp.solver.solver.py.html" title="Module docplex.cp.solver.solver"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="docplex.cp.solution.py.html" title="Module docplex.cp.solution"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">DOcplex.CP: Constraint Programming Modeling for Python V2.16 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="refman.html" accesskey="U"><strong>docplex.cp</strong> reference manual</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="<API key>">
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Module <strong>docplex.cp.config</strong></a><ul>
<li><a class="reference internal" href="#general-parameters">General parameters</a></li>
<li><a class="reference internal" href="#<API key>">Configuration of the model solving</a></li>
<li><a class="reference internal" href="#<API key>">Configuration of the <cite>local</cite> solving agent</a></li>
<li><a class="reference internal" href="#<API key>">Configuration of the <cite>docloud</cite> solving agent</a></li>
<li><a class="reference internal" href="#<API key>">Configuration for best performances</a></li>
<li><a class="reference internal" href="#<API key>">Detailed description</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="docplex.cp.solution.py.html"
title="previous chapter">Module <strong>docplex.cp.solution</strong></a></p>
<h4>Next topic</h4>
<p class="topless"><a href="docplex.cp.solver.solver.py.html"
title="next chapter">Module <strong>docplex.cp.solver.solver</strong></a></p>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="<API key>">
<h1>Module <strong>docplex.cp.config</strong><a class="headerlink" href="#<API key>" title="Permalink to this headline">¶</a></h1>
<div class="toctree-wrapper compound">
</div>
<span class="target" id="module-docplex.cp.config"></span><p>Configuration of the CP Optimizer Python API</p>
<p>This module is the top-level handler of the configuration parameters for
the CP Optimizer Python API. It contains the default values of the different
configuration parameters.</p>
<p>It should NOT be changed directly.
The preferable way is to add at least one of the following files that contain the changes
to be performed:</p>
<blockquote>
<div><ul class="simple">
<li><em>cpo_config.py</em>, a local set of changes on these parameters,</li>
<li><em>cpo_config_<hostname>.py</em>, a hostname dependent set of changes.</li>
<li><em>docloud_config.py</em> (for DOcloud url and key, file shared with docplex.mp package).</li>
</ul>
</div></blockquote>
<p>Final set of parameters is obtained by reading first this module, and then those
listed above.
These modules should be visible from the <em>PYTHONPATH</em> and are loaded in
this order to overwrite default values.</p>
<p>This module also defines two global variables:</p>
<blockquote>
<div><ul>
<li><p class="first"><em>LOCAL_CONTEXT</em>, that contains the configuration appropriate to solve a model with a local
installation of the CPO solver.
This configuration is available for solver with version number greater or equal to 12.7.0.</p>
<p>This context is the context by default, referenced by the global variable ‘context’.</p>
</li>
<li><p class="first"><em>DOCLOUD_CONTEXT</em>, that contains the configuration necessary to solve a model on DOcloud.</p>
</li>
</ul>
</div></blockquote>
<p>The method <a class="reference internal" href="#docplex.cp.config.set_default" title="docplex.cp.config.set_default"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_default()</span></code></a> allows to set the default configuration to one that is predefined,
or another that has been totally customized.</p>
<p>If called as main, this module prints the actual configuration on standard output, including
all customizations made using the mechanism described above.</p>
<p>Following sections describe the most important parameters that can be easily modified to customize
the behavior of the Python API.
All available parameters are available by consulting the source code of this module.</p>
<div class="section" id="general-parameters">
<h2>General parameters<a class="headerlink" href="#general-parameters" title="Permalink to this headline">¶</a></h2>
<p><em>context.log_output = sys.stdout</em></p>
<blockquote>
<div>This parameter contains the default log stream.
By default it is set to the standard output.
A value of <em>None</em> can be used to disable all logs.</div></blockquote>
<p><em>context.verbose = 0</em></p>
<blockquote>
<div>This parameter controls the verbosity level of the log, between 0 and 9, if <em>log_output</em> is not None.
The default value of 0 means no log.</div></blockquote>
<p><em>context.model.add_source_location = True</em></p>
<blockquote>
<div>This parameter indicates that when the model is transformed into CPO format, additional information is added
to correlate expressions with the Python file and line where it has been generated.
If any error is raised by the solver during the solve, this information is provided in the
error description, which allows for easier debugging.</div></blockquote>
<p><em>context.model.length_for_alias = None</em></p>
<blockquote>
<div><p>This parameter allows to associate a shorter alias to variables whose name is longer than the given length.
In the CPO representation of the model, variable is declared with its original name and an alias is created
to use it with a shorter name in model expressions, allowing to reduce the size of the generated CPO format.</p>
<p>In the returned solution, variable can be still retrieved with their original names.</p>
<p>By default, the value is None, which indicates to always keep original variable names.</p>
</div></blockquote>
<p><em>context.model.<API key> = False</em></p>
<blockquote>
<div>This parameter enables the naming of all constraints when the model is generated in CPO format.
It is mandatory only if the <em>refine conflict</em> function is called.
Anyway, if the <em>refine conflict</em> function is called, and if the CPO format of the model has already been generated,
it is generated again with this option set in order to allow proper completion of the request.
Setting it to <em>True</em> is preferable only if <em>refine conflict</em> function is called on a big model.</div></blockquote>
<p><em>context.model.dump_directory = None</em></p>
<blockquote>
<div><p>This parameter gives the name of a directory where the CPO files that are generated for solving models are stored
for logging purpose.</p>
<p>If not None, the directory is created and generated models are stored in files named <cite><model_name>.cpo</cite>.</p>
</div></blockquote>
<p><em>context.model.cache.size = 10000</em></p>
<blockquote>
<div>This parameter gives the maximum capacity of the internal cache used to speed-up conversion of Python expressions
into CPO expressions.</div></blockquote>
<p><em>context.model.cache.active = True</em></p>
<blockquote>
<div>This parameter allows to enable or disable the expression cache mechanism.
Value os a boolean (True or False). Default value is True.</div></blockquote>
<p><em>context.params.xxx</em></p>
<blockquote>
<div>The parameter <cite>context.params</cite> is an instance of the class
<a class="reference internal" href="docplex.cp.parameters.py.html#docplex.cp.parameters.CpoParameters" title="docplex.cp.parameters.CpoParameters"><code class="xref py py-class docutils literal notranslate"><span class="pre">CpoParameters</span></code></a> (in <a class="reference internal" href="docplex.cp.parameters.py.html"><span class="doc">parameters.py</span></a>)
which describes all of the public solver parameters as properties.</div></blockquote>
</div>
<div class="section" id="<API key>">
<h2>Configuration of the model solving<a class="headerlink" href="#<API key>" title="Permalink to this headline">¶</a></h2>
<p><em>context.solver.trace_cpo = False</em></p>
<blockquote>
<div>This parameter indicates to trace the CPO model that is generated before submitting it for solving.
The model is printed on the <cite>context.log_output stream</cite>, if given.</div></blockquote>
<p><em>context.solver.trace_log = False</em></p>
<blockquote>
<div><p>This parameter indicates to trace the log generated by the solver when solving the CPO model.
The log is printed on the <cite>context.log_output stream</cite>, if given.</p>
<p>The default value of this parameter is False for a solve on the cloud, and True for a local solve.</p>
</div></blockquote>
<p><em>context.solver.<API key> = False</em></p>
<blockquote>
<div>This parameter allows to enable the possibility to set solving parameters that are not in the public parameters
detailed in the class
<a class="reference internal" href="docplex.cp.parameters.py.html#docplex.cp.parameters.CpoParameters" title="docplex.cp.parameters.CpoParameters"><code class="xref py py-class docutils literal notranslate"><span class="pre">CpoParameters</span></code></a> (in <a class="reference internal" href="docplex.cp.parameters.py.html"><span class="doc">parameters.py</span></a>).</div></blockquote>
<p><em>context.solver.add_log_to_solution = True</em></p>
<blockquote>
<div>This parameter indicates to add the solver log content to the solution object.
By default, this parameter is True but it can be set to False if the log is very big or of no interest.</div></blockquote>
<p><em>context.solver.add_conflict_as_cpo = True</em></p>
<blockquote>
<div>This parameter indicates to include the conflict in CPO format in the conflict refiner result
By default, this parameter is True.</div></blockquote>
<p><em>context.solver.agent = ‘local’</em></p>
<blockquote>
<div><p>This parameter specifies the name of the solver agent that is used to solve the model.
The value of this parameter is the name of a child context of <cite>context.solver</cite>, which contains necessary attributes
that allow to create and run the required agent.</p>
<p>There are two different agents described in the default configuration file:</p>
<blockquote>
<div><ul class="simple">
<li><cite>local</cite>, the default agent, allowing to solve models locally using the CP Optimizer Interactive coming with
versions of COS greater or equal to 12.7.0.</li>
<li><cite>docloud</cite>, the agent for solving a CPO model using the DOcplexcloud service.</li>
</ul>
</div></blockquote>
<p>If the CP Optimizer Interactive program <em>cpoptimizer(.exe)</em> is <strong>NOT</strong> detected in the system path,
the default solver agent is automatically set to <em>docloud</em> instead of <em>local</em>.</p>
</div></blockquote>
<p><em>context.solver.log_prefix = “[Solver] “</em></p>
<blockquote>
<div>Prefix that is added to every message that is logged by the solver component.</div></blockquote>
</div>
<div class="section" id="<API key>">
<h2>Configuration of the <cite>local</cite> solving agent<a class="headerlink" href="#<API key>" title="Permalink to this headline">¶</a></h2>
<p><em>context.solver.local.execfile</em></p>
<blockquote>
<div>Name or full path of the CP Optimizer Interactive executable file.
By default, it is set to <em>cpoptimizer(.exe)</em>, which supposes that the program is visible from the system path.</div></blockquote>
</div>
<div class="section" id="<API key>">
<h2>Configuration of the <cite>docloud</cite> solving agent<a class="headerlink" href="#<API key>" title="Permalink to this headline">¶</a></h2>
<p><em>context.solver.docloud.url = &
<blockquote>
<div>This parameter is used to specify the URL of the <em>DOcplexcloud</em> service.</div></blockquote>
<p><em>context.solver.docloud.key = “‘Set your key in docloud_config.py’”</em></p>
<blockquote>
<div>This parameter contains the personal key for authorizing access to the <em>DOcplexcloud</em> service.
Access credentials (base URL and access key) can be retrieved after registration from <a class="reference external" href="http:
<p><em>context.solver.docloud.verify_ssl = True</em></p>
<blockquote>
<div>This parameter allows to enable/disable the verification of SSL certificates.</div></blockquote>
<p><em>context.solver.docloud.proxies = None</em></p>
<blockquote>
<div>This parameter allows to optionally define proxies to be used in the connection with <em>DOcplexcloud</em>.
It is a Python dictionary protocol_name / endpoint, as described in <a class="reference external" href="http://docs.python-requests.org/en/master/user/advanced/
<p><em>context.solver.docloud.request_timeout = 30</em></p>
<blockquote>
<div>This parameter contains the maximum time, in seconds, that a response is waited for after a unitary request to <em>DOcplexcloud</em> server.</div></blockquote>
<p><em>context.solver.docloud.<API key> = 60</em></p>
<blockquote>
<div>This parameter is a time in seconds added to the expected solve time to compute the total result waiting timeout.</div></blockquote>
<p><em>context.solver.docloud.<API key> = True</em></p>
<blockquote>
<div>This parameter indicates whether the job is automatically cleaned after the model is solved.
If not set to True, the model stays on the <em>DOcplexcloud</em> server and is visible from its <em>DropSolve</em> interface.
Note that the server may block future solving requests if there are too many jobs waiting.</div></blockquote>
<p><em>context.solver.docloud.polling = Context(min=1, max=3, incr=0.2)</em></p>
<blockquote>
<div>This parameter describes how the Python client polls the result of the solve on <em>DOcplexcloud</em>.
Polling delay is inside an interval [min, max], starting by min, growing to max with the given increment.</div></blockquote>
</div>
<div class="section" id="<API key>">
<h2>Configuration for best performances<a class="headerlink" href="#<API key>" title="Permalink to this headline">¶</a></h2>
<p>To configure the CP Python API for best performances, the following configuration settings may be used.
Obviously, this performance is won at the cost of the loss of some features that may be useful in other cases.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">context</span><span class="o">.</span><span class="n">verbose</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">context</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">add_source_location</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">context</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">length_for_alias</span> <span class="o">=</span> <span class="mi">10</span>
<span class="n">context</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n"><API key></span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">context</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">dump_directory</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">context</span><span class="o">.</span><span class="n">solver</span><span class="o">.</span><span class="n">trace_cpo</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">context</span><span class="o">.</span><span class="n">solver</span><span class="o">.</span><span class="n">trace_log</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">context</span><span class="o">.</span><span class="n">solver</span><span class="o">.</span><span class="n">add_log_to_solution</span> <span class="o">=</span> <span class="kc">False</span>
</pre></div>
</div>
</div>
<div class="section" id="<API key>">
<h2>Detailed description<a class="headerlink" href="#<API key>" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="docplex.cp.config.get_default">
<code class="descclassname">docplex.cp.config.</code><code class="descname">get_default</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/docplex/cp/config.html#get_default"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#docplex.cp.config.get_default" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the default context</p>
<p>Default context is also accessible with the global variable ‘context’ in this module.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Current default context</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="docplex.cp.config.set_default">
<code class="descclassname">docplex.cp.config.</code><code class="descname">set_default</code><span class="sig-paren">(</span><em>ctx</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/docplex/cp/config.html#set_default"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#docplex.cp.config.set_default" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the default context.</p>
<p>Default context becomes accessible in the global variable ‘context’ in this module.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>ctx</strong> – New default context</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="docplex.cp.solver.solver.py.html" title="Module docplex.cp.solver.solver"
>next</a> |</li>
<li class="right" >
<a href="docplex.cp.solution.py.html" title="Module docplex.cp.solution"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">DOcplex.CP: Constraint Programming Modeling for Python V2.16 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="refman.html" ><strong>docplex.cp</strong> reference manual</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&
</div>
</body>
</html> |
package org.kavaproject.kavatouch.dispatch.staging;
public enum Mode {
} |
# ds3_autogen/ds3-autogen-go
This readme specifies how to generate the Spectra Go SDK command and model files and integrate them
into the existing Spectra Go SDK. This assumes that both the Autogen project and the Spectra Go SDK
project are both on the current system.
## Install Autogen
See the Autogen [README](../README.md) for installation instructions.
## Prepare the Go SDK
Go to the Go SDK folder and delete the old commands and models. This is necessary because commands
and models can be deleted or renamed between releases, and phantom code should be removed. The following
files and folders should be removed:
Within the folder `ds3-go-sdk/src/ds3/models`:
* Delete all files in `models` EXCEPT for the following:
* Do not delete `aggregateError.go`
* Do not delete `badStatusCodeError.go`
* Do not delete `enum.go`
* Do not delete `requestPayloadUtils.go`
* Do not delete `<API key>.go`
* Do not delete `responseParsingUtil.go`
* Do not delete `xmlTree.go`
## Generate Go SDK Files
To generate the go SDK files, use the following command. This assumes that the input API spec is in
the current directory and named `api_spec.xml` and it will place all generated files and directories
within `go_sdk_files/` folder.
* `ds3-autogen-cli -d go_sdk_files/ -i api_spec.xml -l go`
This will generate the command and model code in proper folders starting at the `ds3` folder.
## Integrate Generated Code Into Go SDK
Copy the generated folder `ds3` and all its contents. Go to the `ds3-go-sdk/src/` folder and
paste the copied `ds3` into the Go SDK. There may be warnings about overwriting `ds3Deletes.go`,
`ds3Gets.go`, `ds3Heads.go`, `ds3Posts.go`, and `ds3Puts`. Accept the overwrites, and continue.
Compile the Go SDK and verify that there are no compilation errors. |
/**
* \file CSharedMemory.cpp
* \date Mar 18, 2010
* \author samael
*/
#ifdef __D2MCE__ /* DSM mode */
#include "CSharedMemory.h"
#include <cstring>
#include "CD2mce.h"
using namespace std;
namespace wolf
{
/**
* Clone the shared memory. It's done by D2MCE::createSharedMemory().
*/
IDrop* SharedMemory::clone() const
{
return new SharedMemory(*this);
}
}
#endif /* __D2MCE__ */ |
package com.coolweather.app.model;
public class City {
private int id;
private String cityName;
private String cityCode;
private int provinceId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public int getProvinceId() {
return provinceId;
}
public void setProvinceId(int provinceId) {
this.provinceId = provinceId;
}
} |
#region
using System;
using System.Configuration;
#endregion
namespace BAUG.BatchingRemote
{
<summary>
The configuration for TopNWords.
</summary>
public class BatchConfiguration
{
<summary>
The Batch service URL.
</summary>
public string BatchServiceUrl { get; private set; }
<summary>
The Batch account name to run the sample against.
</summary>
public string BatchAccountName { get; private set; }
<summary>
The Batch account key.
</summary>
public string BatchAccountKey { get; private set; }
<summary>
The number of tasks to create.
</summary>
public int NumberOfTasks { get; private set; }
<summary>
The size of the VMs to use in the pool.
</summary>
public int PoolSize { get; private set; }
<summary>
The number of top N words to calculate (5 would mean the top 5 words).
</summary>
public int NumberOfTopWords { get; private set; }
<summary>
The name of the pool.
</summary>
public string PoolName { get; private set; }
<summary>
If a pool should be created.
</summary>
public bool ShouldCreatePool { get; private set; }
<summary>
The name of the work item.
</summary>
public string WorkItemName { get; private set; }
<summary>
The name of the storage account to store the files required to run the tasks.
</summary>
public string StorageAccountName { get; private set; }
<summary>
The key of the storage account to store the files required to run the tasks.
</summary>
public string StorageAccountKey { get; private set; }
<summary>
The storage accounts blob endpoint.
</summary>
public string <API key> { get; private set; }
<summary>
The file name containing the book to process.
</summary>
public string BookFileName { get; private set; }
<summary>
If the work item should be deleted when the sample ends.
</summary>
public bool <API key> { get; private set; }
<summary>
If the container should be deleted when the sample ends.
</summary>
public bool <API key> { get; private set; }
<summary>
Loads the configuration from the App.Config file
</summary>
<returns></returns>
public static BatchConfiguration <API key>()
{
var configuration = new BatchConfiguration();
configuration.BatchServiceUrl = <API key>.AppSettings["BatchServiceUrl"];
configuration.BatchAccountName = <API key>.AppSettings["Account"];
configuration.BatchAccountKey = <API key>.AppSettings["Key"];
configuration.NumberOfTasks = Int32.Parse(<API key>.AppSettings["NumTasks"]);
configuration.PoolSize = Int32.Parse(<API key>.AppSettings["PoolSize"]);
configuration.NumberOfTopWords = Int32.Parse(<API key>.AppSettings["NumTopWords"]);
configuration.PoolName = <API key>.AppSettings["PoolName"];
configuration.ShouldCreatePool = string.IsNullOrEmpty(configuration.PoolName);
if (configuration.ShouldCreatePool)
{
configuration.PoolName = "BAUG_Pool" + DateTime.Now.ToString("_yyMMdd_HHmmss_") +
Guid.NewGuid().ToString("N");
}
configuration.WorkItemName = "BAUG_WorkItem" + DateTime.Now.ToString("_yyMMdd_HHmmss_") +
Guid.NewGuid().ToString("N");
configuration.StorageAccountName = <API key>.AppSettings["StorageAccountName"];
configuration.StorageAccountKey = <API key>.AppSettings["StorageAccountKey"];
configuration.<API key> = <API key>.AppSettings["<API key>"];
configuration.<API key> = bool.Parse(<API key>.AppSettings["DeleteWorkitem"]);
configuration.<API key> = bool.Parse(<API key>.AppSettings["DeleteContainer"]);
return configuration;
}
}
} |
package pl.kmi.adventofcode.day2;
import java.util.Arrays;
import java.util.List;
public class Calculator {
public int calculateArea(int l, int w, int h) {
int firstSideArea = l * w;
int secondSideArea = w * h;
int thirdSideArea = h * l;
int smallestSideArea = getTheSmallest(firstSideArea, secondSideArea, thirdSideArea);
return 2 * (firstSideArea + secondSideArea + thirdSideArea) + smallestSideArea;
}
private int getTheSmallest(int a1, int a2, int a3) {
final int[] array = {a1, a2, a3};
Arrays.sort(array);
return array[0];
}
public int <API key>(List<int[]> boxes) {
boxes.forEach(Arrays::sort);
return boxes.stream()
.mapToInt(arr -> 2 * arr[0] + 2 * arr[1] + arr[0] * arr[1] * arr[2])
.sum();
}
} |
package com.centurylink.mdw.config;
import java.util.Map;
/**
* Translate old-style java properties to yaml.
*/
@FunctionalInterface
public interface <API key> {
/**
* Map key is rule. Value is property value.
*/
public YamlBuilder translate(Map<String,Object> ruleProps);
} |
package nest.sparkle.time.protocol
import scala.annotation.implicitNotFound
import scala.collection.JavaConverters._
import scala.concurrent.ExecutionContext
import spray.json.{ JsObject, JsonWriter }
import spray.httpx.SprayJsonSupport._
import nest.sparkle.time.protocol.RequestJson.<API key>
import spray.json.DefaultJsonProtocol._
import nest.sparkle.store.Column
import nest.sparkle.time.transform.CustomTransform
import com.typesafe.config.Config
import nest.sparkle.store.Event
import spray.json.JsonFormat
import nest.sparkle.util.RecoverJsonFormat
import nest.sparkle.util.ConfigUtil.sparkleConfigName
class DoublingTransform(rootConfig: Config) extends CustomTransform {
override def name: String = this.getClass.getSimpleName
override def apply[T, U] // format: OFF
(column: Column[T, U], transformParameters: JsObject)
(implicit execution: ExecutionContext): JsonDataStream = { // format: ON
val events = column.readRangeOld(None, None)
implicit val keyFormat = RecoverJsonFormat.jsonFormat[T](column.keyType)
implicit val valueFormat = RecoverJsonFormat.jsonFormat[U](column.valueType)
val doubled = events.initial.map {
case Event(key, value: Double) =>
val double = (value * 2).asInstanceOf[U]
Event(key, double)
}
JsonDataStream(
dataStream = JsonEventWriter.<API key>(doubled),
streamType = KeyValueType
)
}
}
class TestCustomTransform extends PreloadedRamService with StreamRequestor {
lazy val transformClassName = classOf[DoublingTransform].getCanonicalName
override def configOverrides = {
val transforms = Seq(s"$transformClassName").asJava
super.configOverrides :+ s"$sparkleConfigName.custom-transforms" -> transforms
}
test("custom transform selector") {
val requestMessage = streamRequest(classOf[DoublingTransform].getSimpleName, JsObject())
Post("/v1/data", requestMessage) ~> v1protocol ~> check {
val events = TestDataService.typicalStreamData(response)
events.length shouldBe 2
events(0).value shouldBe 2
events(1).value shouldBe 4
}
}
} |
package com.mscharhag.archunit.layers.repository;
import com.mscharhag.archunit.model.User;
import javax.persistence.EntityManager;
public class UserRepository {
private EntityManager entityManager;
public User loadUser() {
return new User("John Doe");
}
} |
package it.cnr.istc.stlab.lizard.commons.inmemory;
import org.apache.jena.ontology.OntResource;
import org.apache.jena.rdf.model.RDFNode;
import it.cnr.istc.stlab.lizard.commons.PropertyMap;
public class <API key> extends InMemoryLizardClass {
public <API key>() {
super();
}
public <API key>(RDFNode individual, OntResource classResource) {
super(individual, classResource);
}
public <API key>(RDFNode individual, OntResource classResource, PropertyMap propertyMap) {
super(individual, classResource, propertyMap);
}
} |
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { Insomnia } from '@ionic-native/insomnia';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import {RecipeDetailPage} from '../pages/recipe-detail/recipe-detail';
import {RecipeTimerPage} from '../pages/recipe-timer/recipe-timer';
import { HttpModule } from '@angular/http';
import { SmartAudioProvider } from '../providers/smart-audio/smart-audio';
import { NativeAudio } from '@ionic-native/native-audio';
import { UtilityProvider } from '../providers/utility/utility';
@NgModule({
declarations: [
MyApp,
HomePage,
RecipeDetailPage,
RecipeTimerPage
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
RecipeDetailPage,
RecipeTimerPage
],
providers: [
StatusBar,
SplashScreen,
Insomnia,
NativeAudio,
{provide: ErrorHandler, useClass: IonicErrorHandler},
SmartAudioProvider,
UtilityProvider
]
})
export class AppModule {} |
// Name: propgrid.cpp
// Purpose: wxPropertyGrid
// Created: Sep-25-2004
// RCS-ID: $Id:
#include "stdafx.h"
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "propgrid.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/hash.h"
#include "wx/string.h"
#include "wx/log.h"
#include "wx/event.h"
#include "wx/window.h"
#include "wx/panel.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include "wx/button.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/cursor.h"
#include "wx/dialog.h"
#include "wx/settings.h"
#include "wx/msgdlg.h"
#include "wx/choice.h"
#include "wx/stattext.h"
#include "wx/scrolwin.h"
#include "wx/dirdlg.h"
#include "wx/combobox.h"
#include "wx/layout.h"
#include "wx/sizer.h"
#include "wx/textdlg.h"
#include "wx/filedlg.h"
#include "wx/statusbr.h"
#include "wx/intl.h"
#include "wx/frame.h"
#endif
//correction of non Unicode include file
#define GetHwnd() ((HWND)GetHWND())
#define GetHwndOf(win) ((HWND)((win)->GetHWND()))
// old name
#define GetWinHwnd GetHwndOf
#include "wx/timer.h"
#include "wx/dcbuffer.h"
// This define is necessary to prevent macro clearing
#define <API key>
#include "propgrid.h"
#include "propdev.h"
#ifdef __WXPYTHON__
#include <wx/propgrid/advprops.h>
#include <wx/propgrid/extras.h>
#endif
#if <API key>
#include <wx/renderer.h>
#endif
#include "odcombo.h"
#ifdef __WXMSW__
//#include <wx/msw/private.h>
#endif
// Two pics for the expand / collapse buttons.
// Files are not supplied with this project (since it is
// recommended to use either custom or native rendering).
// If you want them, get wxTreeMultiCtrl by Jorgen Bodde,
// and copy xpm files from archive to wxPropertyGrid src directory
// (and also comment/undef wxPG_ICON_WIDTH in propGrid.h
// and set <API key> to 0).
#ifndef wxPG_ICON_WIDTH
#if defined(__WXMAC__)
#include "mac_collapse.xpm"
#include "mac_expand.xpm"
#elif defined(__WXGTK__)
#include "linux_collapse.xpm"
#include "linux_expand.xpm"
#else
#include "default_collapse.xpm"
#include "default_expand.xpm"
#endif
#endif
//#define wxPG_TEXT_INDENT 4 // For the wxComboControl
#define wxPG_ALLOW_CLIPPING 1 // If 1, GetUpdateRegion() in OnPaint event handler is not ignored
#define wxPG_GUTTER_DIV 3 // gutter is max(iconwidth/gutter_div,gutter_min)
#define wxPG_GUTTER_MIN 3 // gutter before and after image of [+] or [-]
#define wxPG_YSPACING_MIN 1
#define wxPG_BUTTON_SIZEDEC 0
#define <API key> 2 // This matches .NET propertygrid's value,
// but causes normal combobox to spill out under MSW
#define wxPG_OPTIMAL_WIDTH 200 // Arbitrary
#define wxPG_CAPRECTXMARGIN 2 // space between caption and selection rectangle,
#define wxPG_CAPRECTYMARGIN 1 // horizontally and vertically
#define <API key> 16 // Maximum number of children summarized in a parent property's
// value field.
#define <API key> 64 // Character limit of summary field when not editing
#define <API key> 10 // Smallest scrollbar width on any platform
// Must be larger than largest control border
// width * 2.
#define wxPG_DEFAULT_CURSOR wxNullCursor
#define RedrawAllVisible Refresh
// Here are some extra platform dependent defines.
#if defined(__WXMSW__)
// tested
#define <API key> 110 // default splitter position
#define <API key> 0 // 1 to create controls out of sight, hide them, and then move them into correct position
#define <API key> 0 // 1 if splitter drag detect margin and control cannot overlap
#define <API key> 20 // for wxColourProperty etc.
#define <API key> 1 // If 1, then setting empty tooltip actually hides it
#define <API key> 0 // Unremovable border of native textctrl.
#define <API key> 0 // Unremovable border of native textctrl.
#define <API key> 1
#define <API key> 1
#define <API key> 1
#define <API key> (m_spacingy+0)
#define wxPG_CHOICEXADJUST (-1) // Extra pixels next to wxChoice/ComboBox.
#define wxPG_CHOICEYADJUST 0 // Extra pixels above wxChoice/ComboBox.
#define <API key> 0 // If 1 then controls are refreshed after selected was drawn.
#define wxPG_CHECKMARK_XADJ 1
#define wxPG_CHECKMARK_YADJ (-1)
#define wxPG_CHECKMARK_WADJ 0
#define wxPG_CHECKMARK_HADJ 0
#define <API key> 0
#elif defined(__WXGTK__)
// tested
#define <API key> 110
#define <API key> 0 // 1 to create controls out of sight, hide them, and then move them into correct position
#define <API key> 1 // 1 if splitter drag detect margin and control cannot overlap
#define <API key> 20 // for wxColourProperty etc.
#define <API key> 0 // If 1, then setting empty tooltip actually hides it
#define <API key> 3 // Unremovable border of native textctrl.
#define <API key> 3 // Unremovable border of native textctrl.
#define <API key> 1
#define <API key> 1
#define <API key> 1
#define <API key> 0
#define wxPG_CHOICEXADJUST 2 // Extra pixels next to wxChoice/ComboBox.
#define wxPG_CHOICEYADJUST 0
#define <API key> 1 // If 1 then controls are refreshed after selected was drawn.
#define wxPG_CHECKMARK_XADJ 0
#define wxPG_CHECKMARK_YADJ 0
#define wxPG_CHECKMARK_WADJ (-1)
#define wxPG_CHECKMARK_HADJ (-1)
#define <API key> 3
#elif defined(__WXMAC__)
// *not* tested
#define <API key> 110
#define <API key> 0 // 1 to create controls out of sight, hide them, and then move them into correct position
#define <API key> 0 // 1 if splitter drag detect margin and control cannot overlap
#define <API key> 20 // for wxColourProperty etc.
#define <API key> 1 // If 1, then setting empty tooltip actually hides it
#define <API key> 0 // Unremovable border of native textctrl.
#define <API key> 0 // Unremovable border of native textctrl.
#define <API key> 0
#define <API key> 0
#define <API key> 0
#define <API key> 3
#define wxPG_CHOICEXADJUST 0 // Extra pixels next to wxChoice/ComboBox.
#define wxPG_CHOICEYADJUST 0
#define <API key> 0 // If 1 then controls are refreshed after selected was drawn.
#define wxPG_CHECKMARK_XADJ 0
#define wxPG_CHECKMARK_YADJ 0
#define wxPG_CHECKMARK_WADJ 0
#define wxPG_CHECKMARK_HADJ 0
#define <API key> 0
#else
// defaults
#define <API key> 110
#define <API key> 0 // 1 to create controls out of sight, hide them, and then move them into correct position
#define <API key> 1 // 1 if splitter drag detect margin and control cannot overlap
#define <API key> 20 // for wxColourProperty etc.
#define <API key> 0 // If 1, then setting empty tooltip actually hides it
#define <API key> 0 // Unremovable border of native textctrl.
#define <API key> 0 // Unremovable border of native textctrl.
#define <API key> 0
#define <API key> 0
#define <API key> 0
#define <API key> 0
#define wxPG_CHOICEXADJUST 0 // Extra pixels next to wxChoice/ComboBox.
#define wxPG_CHOICEYADJUST 0
#define <API key> 1 // If 1 then controls are refreshed after selected was drawn.
#define wxPG_CHECKMARK_XADJ 0
#define wxPG_CHECKMARK_YADJ 0
#define wxPG_CHECKMARK_WADJ 0
#define wxPG_CHECKMARK_HADJ 0
#define <API key> 0
#endif
#if <API key>
#define <API key> 3 // this much on left
#define <API key> 2 // this much on right
#define wxPG_CONTROL_MARGIN 0 // space between splitter and control
#else
#define <API key> 3 // this much on left
#define <API key> 2 // this much on right
#define wxPG_CONTROL_MARGIN 0 // space between splitter and control
#endif
#define <API key> 4 // before image
#define <API key> 5 // after image
#if (!<API key> && !<API key>)
#define <API key> 0
#else
#define <API key> 1
#endif
//#define <API key> 0
// for odcombo
#undef wxPG_CHOICEXADJUST
#define wxPG_CHOICEXADJUST 0
#undef wxPG_CHOICEYADJUST
#define wxPG_CHOICEYADJUST 0
#define wxPG_DRAG_MARGIN 30
#define <API key> 1 // space between vertical sides of a custom image
// Use this macro to generate standard custom image height from
#define <API key>(LINEHEIGHT) (LINEHEIGHT-3)
// How many pixels between textctrl and button
#ifdef __WXMAC__
#define <API key> 8
#else
#define <API key> 2
#endif
#define <API key> 25
// m_expanded of <API key> is set to this code if children should
// not be deleted in destructor.
#define <API key> 127
#define <API key> m_lineHeight
#ifdef wxPG_ICON_WIDTH
#define m_iconHeight m_iconWidth
#endif
#define wxPG_TOOLTIP_DELAY 1000
// Colour for the empty but visible space below last property.
#define <API key> m_colPropBack
// Milliseconds to wait for two mouse-ups after focus inorder
// to trigger a double-click.
#define <API key> 500
// Parenting types
enum
{
PT_CUSTOMPROPERTY = -2,
PT_FIXEDCHILDREN = -1,
PT_NONE = 0,
PT_CAPTION = 1,
PT_ROOT = 2
};
// Helper to decide which way is better (ie. first macro clears
// "unspecified" state of siblings of child properties as well, while the latter is
// more precise).
//#define <API key>(p) wxPropertyGridState::<API key>(p,<API key>)
#define <API key>(p) p->ClearFlag(<API key>)
#define <API key> 0
#define __PAINT_DEBUGGING__ 0
#define __MOUSE_DEBUGGING__ 0
#if wxUSE_INTL
void wxPropertyGrid::AutoGetTranslation ( bool enable )
{
<API key>()
wxPGGlobalVars-><API key> = enable;
}
#else
void wxPropertyGrid::AutoGetTranslation ( bool ) { }
#endif
// This was needed to make quicker progress towards wxPropertyGridState
#define FROM_STATE(X) m_pState->X
#if !wxCHECK_VERSION(2, 7, 1)
#if defined(__WXMSW__)
#ifndef WS_EX_COMPOSITED
#define WS_EX_COMPOSITED 0x02000000L
#endif
static bool <API key>( const wxWindow* wnd )
{
while ( wnd )
{
if ( GetWindowLong((HWND)wnd->GetHWND(), GWL_EXSTYLE) & WS_EX_COMPOSITED )
return true;
if ( wnd->IsTopLevel() )
break;
wnd = wnd->GetParent();
}
return false;
}
#elif defined(__WXGTK20__)
//#include <gtk/gtk.h>
static bool <API key>( const wxWindow* wnd )
{
return false;
// return <API key>(wnd->GetHandle());
}
#elif defined(__WXMAC_OSX__) || defined(__WXCOCOA__) || defined(__WXDFB__)
static bool <API key>( const wxWindow* WXUNUSED(wnd) )
{
return true;
}
#else
static bool <API key>( const wxWindow* WXUNUSED(wnd) )
{
return false;
}
#endif
#else
static bool <API key>( const wxWindow* wnd )
{
return wnd->IsDoubleBuffered();
}
#endif
// DeviceContext Init Macros.
#define wxPG_CLIENT_DC_INIT() \
wxClientDC dc(this); \
PrepareDC(dc);
#define <API key>(RETVAL) \
wxClientDC dc(this); \
PrepareDC(dc);
#define wxPG_PAINT_DC_INIT() \
wxPaintDC dc(this); \
PrepareDC(dc);
// For wxMSW cursor consistency, we must do mouse capturing even
// when using custom controls.
#define BEGIN_MOUSE_CAPTURE \
if ( !(m_iFlags & <API key>) ) \
{ \
CaptureMouse(); \
m_iFlags |= <API key>; \
}
#define END_MOUSE_CAPTURE \
if ( m_iFlags & <API key> ) \
{ \
ReleaseMouse(); \
m_iFlags &= ~(<API key>); \
}
// NOTES
// TODO
// For Next Release:
// * Fix NULL(?) focus after odcombo closed.
const wxChar *<API key> = wxT("wxPropertyGrid");
const wxChar *wxPGTypeName_long = wxT("long");
const wxChar *wxPGTypeName_bool = wxT("bool");
const wxChar *wxPGTypeName_double = wxT("double");
const wxChar *<API key> = wxT("string");
const wxChar *wxPGTypeName_void = wxT("void*");
const wxChar *<API key> = wxT("arrstring");
#ifdef __WXPYTHON__
const wxChar *<API key> = wxT("PyObject");
#endif
static void wxPGDrawFocusRect( wxDC& dc, const wxRect& rect )
{
#if defined(__WXMSW__) && !defined(__WXWINCE__)
/*
RECT mswRect;
mswRect.left = rect.x;
mswRect.top = rect.y;
mswRect.right = rect.x + rect.width;
mswRect.bottom = rect.y + rect.height;
HDC hdc = (HDC) dc.GetHDC();
SetMapMode(hdc,MM_TEXT); // Just in case...
DrawFocusRect(hdc,&mswRect);
*/
// FIXME: Use DrawFocusRect code above (currently it draws solid line
// for caption focus but works ok for other stuff).
// Also, it seems that this code may not work in future wx versions.
dc.SetLogicalFunction(wxINVERT);
wxPen pen(*wxBLACK,1,wxDOT);
pen.SetCap(wxCAP_BUTT);
dc.SetPen(pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect);
dc.SetLogicalFunction(wxCOPY);
#else
dc.SetLogicalFunction(wxINVERT);
dc.SetPen(wxPen(*wxBLACK,1,wxDOT));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect);
dc.SetLogicalFunction(wxCOPY);
#endif
}
// Choice related methods from various classes
void <API key>::AddPropertyChoice( wxPGId id,
const wxString& label,
int value )
{
<API key>()
p->InsertChoice(label,-1,value);
}
void <API key>::<API key>( wxPGId id,
const wxString& label,
int index,
int value )
{
<API key>()
p->InsertChoice(label,index,value);
}
void <API key>::<API key>( wxPGId id,
int index )
{
<API key>()
p->DeleteChoice(index);
}
// Statics in one class for easy destruction.
// NB: We prefer to use wxModule, as it offers more consistent behaviour
// across platforms. However, for those rare problem situations, we
// also need to offer option to use simpler approach.
#ifndef wxPG_USE_WXMODULE
#define wxPG_USE_WXMODULE 1
#endif
#if wxPG_USE_WXMODULE
#include <wx/module.h>
class <API key> : public wxModule
{
<API key>(<API key>)
public:
<API key>() {}
virtual bool OnInit() { wxPGGlobalVars = new wxPGGlobalVarsClass(); return true; }
virtual void OnExit() { delete wxPGGlobalVars; wxPGGlobalVars = NULL; }
};
<API key>(<API key>, wxModule)
#else // !wxPG_USE_WXMODULE
class <API key>
{
public:
<API key>() {}
~<API key>() { delete wxPGGlobalVars; }
};
static <API key> <API key>;
#endif
wxPGGlobalVarsClass* wxPGGlobalVars = (wxPGGlobalVarsClass*) NULL;
wxPGGlobalVarsClass::wxPGGlobalVarsClass()
{
m_boolChoices[0] = _("False");
m_boolChoices[1] = _("True");
m_boolChoices[2] = _("Unspecified");
m_numBoolChoices = 2;
m_fontFamilyChoices = (wxPGChoices*) NULL;
<API key> = false;
m_offline = 0;
}
wxPGGlobalVarsClass::~wxPGGlobalVarsClass()
{
size_t i;
// This will always have one ref
delete m_fontFamilyChoices;
#if wxUSE_VALIDATORS
for ( i=0; i<m_arrValidators.GetCount(); i++ )
delete ((wxValidator*)m_arrValidators[i]);
#endif
// Destroy value type class instances.
wxPGHashMapS2P::iterator vt_it;
for( vt_it = m_dictValueType.begin(); vt_it != m_dictValueType.end(); ++vt_it )
{
wxPGValueType* pcls = (wxPGValueType*) vt_it->second;
wxASSERT( pcls );
delete pcls;
}
// Destroy editor class instances.
// iterate over all the elements in the class
for( vt_it = m_mapEditorClasses.begin(); vt_it != m_mapEditorClasses.end(); ++vt_it )
{
delete ((wxPGEditor*)vt_it->second);
}
}
// wxPGProperty
<API key> <API key> = {wxT("wxBaseProperty"),
(const <API key>*) NULL,
(<API key>) NULL};
void wxPGProperty::Init()
{
#ifdef __WXPYTHON__
m_scriptObject = NULL;
#endif
m_y = -3;
m_arrIndex = 0xFFFF;
m_parent = (<API key>*) NULL;
#if <API key>
m_clientData = NULL;
#endif
m_dataExt = (wxPGPropertyDataExt*) NULL;
m_maxLen = 0; // infinite maximum length
m_flags = 0;
m_depth = 1;
m_parentingType = 0;
m_bgColIndex = 0;
m_fgColIndex = 0;
}
void wxPGProperty::Init( const wxString& label, const wxString& name )
{
m_label = label;
#ifndef __WXPYTHON__
if ( &name != ((wxString*)NULL) )
#else
if ( (&name != ((wxString*)NULL)) && name != wxT("_LABEL_AS_NAME") )
#endif
DoSetName( name );
else
DoSetName( label );
Init();
}
wxPGProperty::wxPGProperty()
#if <API key>
: wxObject()
#endif
{
Init();
}
wxPGProperty::wxPGProperty( const wxString& label, const wxString& name )
#if <API key>
: wxObject()
#endif
{
Init( label, name );
}
wxPGProperty::~wxPGProperty()
{
#ifdef __WXPYTHON__
#if <API key>
if ( m_clientData )
Py_DECREF( m_clientData );
#endif
#endif
delete m_dataExt;
}
bool wxPGProperty::IsSomeParent( wxPGProperty* candidate ) const
{
<API key>* parent = m_parent;
do
{
if ( parent == (<API key>*)candidate )
return true;
parent = parent->m_parent;
} while ( parent );
return false;
}
wxPropertyGridState* wxPGProperty::GetParentState() const
{
wxASSERT( m_parent );
return m_parent->GetParentState();
}
size_t wxPGProperty::GetChildCount() const
{
int cc = GetParentingType();
if ( cc == 0 ) return 0;
return ((<API key>*)this)->GetCount();
}
void wxPGProperty::ShowError( const wxString& msg )
{
if ( !msg.length() )
return;
#if wxUSE_STATUSBAR
if ( !wxPGGlobalVars->m_offline )
{
wxPropertyGrid* pg = GetParentState()->m_pPropGrid;
wxASSERT(pg);
wxWindow* topWnd = ::wxGetTopLevelParent(pg);
if ( topWnd )
{
wxFrame* pFrame = wxDynamicCast(topWnd,wxFrame);
if ( pFrame )
{
wxStatusBar* pStatusBar = pFrame->GetStatusBar();
if ( pStatusBar )
{
pStatusBar->SetStatusText(msg);
return;
}
}
}
}
#endif
wxLogError(msg);
}
wxPropertyGrid* wxPGProperty::GetGrid() const
{
return GetParentState()->GetGrid();
}
void wxPGProperty::UpdateControl( wxWindow* primary )
{
if ( primary )
GetEditorClass()->UpdateControl(this,primary);
}
void wxPGProperty::DoSetValue( wxPGVariant )
{
// Actually, this should never get called
wxFAIL_MSG( wxT("must be overridden") );
}
// <API key>, at least, should make use of this.
wxPGVariant wxPGProperty::DoGetValue() const
{
return wxPGVariant((long)0);
}
wxString wxPGProperty::GetValueAsString( int ) const
{
wxFAIL_MSG( wxT("must be overridden") );
return m_name;
}
wxVariant wxPGProperty::GetValueAsVariant() const
{
// Return NULL variant for unspecified value
//if ( HasFlag(<API key>) )
// return wxVariant();
wxPGVariant value = DoGetValue();
const wxPGValueType* typeClass = GetValueTypePtr();
wxASSERT_MSG( typeClass, wxT("Did you forgot to use <API key>(T) in constructor?") );
return typeClass->GenerateVariant(value,m_name);
}
bool wxPGProperty::SetValueFromString( const wxString&, int )
{
wxFAIL_MSG( wxT("must be overridden") );
return false;
}
bool wxPGProperty::SetValueFromInt( long, int )
{
wxFAIL_MSG ( wxT("must be overridden") );
return false;
}
wxSize wxPGProperty::GetImageSize() const
{
if ( m_dataExt && m_dataExt->m_valueBitmap )
return wxSize(m_dataExt->m_valueBitmap->GetWidth(),-1);
return wxSize(0,0);
}
void wxPGProperty::OnCustomPaint( wxDC& dc,
const wxRect& rect,
wxPGPaintData& )
{
wxCHECK_RET( m_dataExt, wxT("m_dataExt is mandatory") );
wxBitmap* bmp = m_dataExt->m_valueBitmap;
wxCHECK_RET( bmp && bmp->Ok(), wxT("invalid bitmap") );
wxCHECK_RET( rect.x >= 0, wxT("unexpected measure call") );
dc.DrawBitmap(*bmp,rect.x,rect.y);
}
const wxPGEditor* wxPGProperty::DoGetEditorClass() const
{
return wxPG_EDITOR(TextCtrl);
}
#ifdef __WXPYTHON__
wxString wxPGProperty::GetEditor() const
{
return wxEmptyString;
}
#endif
#ifdef __WXPYTHON__
wxString wxPGProperty::GetType() const
{
return wxString();
}
const wxPGValueType* wxPGProperty::GetValueType() const
{
wxString s = GetType();
const wxPGValueType* p = <API key>::GetValueType(s);
wxCHECK_MSG( p, wxPG_VALUETYPE(none),
wxT("GetType must return string that identifies a valid type") );
return p;
}
#endif
#if <API key>
const wxPGValueType* wxPGProperty::GetValueTypePtr() const
{
return <API key>::GetValueTypeByName(GetValueType());
}
#endif
// Default extra property event handling - that is, none at all.
bool wxPGProperty::OnEvent( wxPropertyGrid*, wxWindow*, wxEvent& )
{
return false;
}
void wxPGProperty::SetChoiceSelection( int newValue, const wxPGChoiceInfo& choiceInfo )
{
// Changes value of a property with choices, but only
// works if the value type is long or string.
const wxPGValueType* vt = GetValueTypePtr();
wxCHECK_RET( choiceInfo.m_choices, wxT("invalid choiceinfo") );
if ( vt == wxPG_VALUETYPE_PTR(long) )
{
DoSetValue( (long) newValue );
}
else if ( vt == wxPG_VALUETYPE_PTR(wxString) )
{
DoSetValue( choiceInfo.m_choices->GetLabel(newValue) );
}
}
int wxPGProperty::InsertChoice( const wxString& label, int index, int value )
{
wxPropertyGrid* pg = GetGrid();
wxPGChoiceInfo ci;
ci.m_choices = (wxPGChoices*) NULL;
int sel = GetChoiceInfo(&ci);
if ( ci.m_choices )
{
int newSel = sel;
if ( index < 0 )
index = ci.m_choices->GetCount();
if ( index <= sel )
newSel++;
ci.m_choices->Insert(label, index, value);
if ( sel != newSel )
SetChoiceSelection(newSel, ci);
if ( this == wxPGIdToPtr(pg->GetSelection()) )
GetEditorClass()->InsertItem(pg->GetPrimaryEditor(),label,index);
return index;
}
return -1;
}
void wxPGProperty::DeleteChoice( int index )
{
wxPropertyGrid* pg = GetGrid();
wxPGChoiceInfo ci;
ci.m_choices = (wxPGChoices*) NULL;
int sel = GetChoiceInfo(&ci);
if ( ci.m_choices )
{
int newSel = sel;
// Adjust current value
if ( sel == index )
{
SetFlag( <API key> );
newSel = 0;
}
else if ( index < sel )
{
newSel
}
ci.m_choices->RemoveAt(index);
if ( sel != newSel )
SetChoiceSelection(newSel, ci);
if ( this == wxPGIdToPtr(pg->GetSelection()) )
GetEditorClass()->DeleteItem(pg->GetPrimaryEditor(), index);
}
}
int wxPGProperty::GetChoiceInfo( wxPGChoiceInfo* )
{
return 0;
}
void wxPGProperty::SetAttribute( int, wxVariant& )
{
}
#if wxUSE_VALIDATORS
wxValidator* wxPGProperty::DoGetValidator() const
{
return (wxValidator*) NULL;
}
#endif
bool wxPGProperty::SetChoices( wxPGChoices& choices )
{
wxPGChoiceInfo ci;
ci.m_choices = (wxPGChoices*) NULL;
// Unref existing
GetChoiceInfo(&ci);
if ( ci.m_choices )
{
ci.m_choices->Assign(choices);
// This may be needed to trigger some initialization
// (but don't do it if property is somewhat uninitialized)
if ( m_parent )
DoSetValue(GetValueTypePtr()->GetDefaultValue());
return true;
}
return false;
}
const wxPGEditor* wxPGProperty::GetEditorClass() const
{
const wxPGEditor* editor;
if ( !m_dataExt || !m_dataExt->m_customEditor )
{
#ifdef __WXPYTHON__
wxString editorName = GetEditor();
if ( editorName.length() )
editor = <API key>::GetEditorByName(editorName);
else
#endif
editor = DoGetEditorClass();
}
else
{
editor = m_dataExt->m_customEditor;
}
return editor;
}
bool wxPGProperty::IsKindOf( <API key>& info )
{
const <API key>* ownInfo = GetClassInfo();
do
{
if ( ownInfo == &info )
return true;
ownInfo = ownInfo->m_baseInfo;
} while ( ownInfo );
return false;
}
// Privatizes set of choices
void wxPGProperty::SetChoicesExclusive()
{
wxPGChoiceInfo ci;
ci.m_choices = (wxPGChoices*) NULL;
GetChoiceInfo(&ci);
if ( ci.m_choices )
ci.m_choices->SetExclusive();
}
bool wxPGProperty::<API key>( wxPropertyGrid* propGrid )
{
wxWindow* primary = propGrid->GetEditorControl();
if ( primary && propGrid-><API key>() )
{
GetEditorClass()-><API key>( this, primary );
return true;
}
else if ( m_flags & <API key> )
{
// Set default value in case it was unspecified
DoSetValue(GetValueTypePtr()->GetDefaultValue());
}
return false;
}
bool wxPGProperty::RecreateEditor()
{
wxPropertyGrid* pg = GetGrid();
wxASSERT(pg);
wxPGProperty* selected = pg->GetSelection();
if ( this == selected )
{
pg->DoSelectProperty(this, wxPG_SEL_FORCE);
return true;
}
return false;
}
bool wxPGProperty::EnsureDataExt()
{
if ( !m_dataExt )
{
m_dataExt = new wxPGPropertyDataExt();
return true;
}
return false;
}
void wxPGProperty::SetValueImage( wxBitmap& bmp )
{
EnsureDataExt();
delete m_dataExt->m_valueBitmap;
if ( &bmp && bmp.Ok() )
{
// Resize the image
wxSize maxSz = GetGrid()->GetImageSize();
wxSize imSz(bmp.GetWidth(),bmp.GetHeight());
if ( imSz.x != maxSz.x || imSz.y != maxSz.y )
{
// Create a memory DC
wxBitmap* bmpNew = new wxBitmap(maxSz.x,maxSz.y,bmp.GetDepth());
wxMemoryDC dc;
dc.SelectObject(*bmpNew);
// Scale
// FIXME: This is ugly - use image or wait for scaling patch.
double scaleX = (double)maxSz.x / (double)imSz.x;
double scaleY = (double)maxSz.y / (double)imSz.y;
dc.SetUserScale(scaleX,scaleY);
dc.DrawBitmap( bmp, 0, 0 );
m_dataExt->m_valueBitmap = bmpNew;
}
else
m_dataExt->m_valueBitmap = new wxBitmap(bmp);
m_flags |= <API key>;
}
else
{
m_dataExt->m_valueBitmap = (wxBitmap*) NULL;
m_flags &= ~(<API key>);
}
}
wxPGProperty* wxPGProperty::GetMainParent() const
{
const wxPGProperty* curChild = this;
const <API key>* curParent = m_parent;
while ( curParent->m_parentingType < 0 )
{
curChild = curParent;
curParent = curParent->m_parent;
}
return (wxPGProperty*) curChild;
}
const wxPGProperty* wxPGProperty::<API key>() const
{
// Returns last visible sub-item, recursively.
if ( GetParentingType() == PT_NONE )
return this;
const <API key>* pwc = (<API key>*) this;
unsigned int count = pwc->GetCount();
if ( !pwc->IsExpanded() || !count )
return this;
return pwc->Last()-><API key>();
}
bool wxPGProperty::UsesAutoUnspecified() const
{
if ( GetGrid()->GetExtraStyle() & <API key> )
return true;
return false;
}
// <API key>
<API key> <API key> = {wxT("<API key>"),
&<API key>,
(<API key>) NULL};
<API key>::<API key>()
: wxPGProperty()
{
m_expanded = 1;
m_y = -2;
m_parentingType = -1;
}
<API key>::<API key>( const wxString &label, const wxString& name )
: wxPGProperty(label,name)
{
m_expanded = 1;
m_y = -2;
m_parentingType = -1;
m_parentState = (wxPropertyGridState*) NULL;
}
<API key>::~<API key>()
{
Empty(); // this deletes items
}
// This is used by Insert etc.
void <API key>::AddChild2( wxPGProperty* prop, int index, bool correct_mode )
{
if ( index < 0 || (size_t)index >= m_children.GetCount() )
{
if ( correct_mode ) prop->m_arrIndex = m_children.GetCount();
m_children.Add( (void*)prop );
}
else
{
m_children.Insert( (void*)prop, index );
if ( correct_mode ) <API key>( index );
}
prop->m_parent = this;
}
// This is used by properties that have fixed sub-properties
void <API key>::AddChild( wxPGProperty* prop )
{
prop->m_arrIndex = m_children.GetCount();
m_children.Add( (void*)prop );
int custImgHeight = prop->GetImageSize().y;
if ( custImgHeight < 0 /*|| custImgHeight > 1*/ )
prop->m_flags |= <API key>;
prop->m_parent = this;
prop->m_y = -1; // Collapsed
}
void <API key>::<API key>( size_t starthere )
{
size_t i;
for ( i=starthere;i<GetCount();i++)
Item(i)->m_arrIndex = i;
}
// Returns (direct) child property with given name (or NULL if not found)
wxPGProperty* <API key>::GetPropertyByName( const wxString& name ) const
{
size_t i;
for ( i=0; i<GetCount(); i++ )
{
wxPGProperty* p = Item(i);
if ( p->m_name == name )
return p;
}
// Does it have point, then?
int pos = name.Find(wxT('.'));
if ( pos <= 0 )
return (wxPGProperty*) NULL;
<API key>* pwc =
(<API key>*) GetPropertyByName(name.substr(0,pos));
if ( !pwc || !pwc->GetParentingType() )
return (wxPGProperty*) NULL;
return pwc->GetPropertyByName(name.substr(pos+1,name.length()-pos-1));
}
wxPGProperty* <API key>::GetItemAtY( unsigned int y, unsigned int lh )
{
// Linear search.
unsigned int i = 0;
unsigned int iMax = GetCount();
unsigned long py = 0xFFFFFFFF;
wxPGProperty* p = (wxPGProperty*) NULL;
while ( i < iMax )
{
p = Item(i);
if ( p->m_y >= 0 )
{
py = (unsigned long)p->m_y;
if ( (py+lh) > y )
break;
}
i++;
}
if ( py <= y && i < iMax )
{
// perfectly this item
wxASSERT_MSG( p, wxT("invalid property id") );
return p;
}
else
{
// If no visible children, we must retract our steps
// (should not really happen, so right now we check that it
// really doesn't).
if ( py == 0xFFFFFFFF )
{
wxLogDebug(wxT("wxPropertyGrid: \"%s\" (y=%i) did not have visible children (it should)."),m_label.c_str(),(int)m_y);
return (wxPGProperty*) NULL;
}
// We are about to return a child of previous' visible item.
#ifdef __WXDEBUG__
if ( i < 1 )
{
wxLogDebug( wxT("WARNING: \"%s\"->GetItemAtY: (i <= 0)"), m_label.c_str() );
wxLogDebug( wxT(" \\--> y = %i, py = %i"), (int)y, (int)py );
if ( p )
wxLogDebug( wxT(" \\--> p = \"%s\""), p->GetLabel().c_str() );
else
wxLogDebug( wxT(" \\--> p = None") );
return (wxPGProperty*) NULL;
}
#endif
// Get previous *visible* parent.
<API key>* pwc;
do
{
wxASSERT( i > 0 );
i
pwc = (<API key>*)Item(i);
} while ( pwc->m_y < 0 );
if ( pwc->GetParentingType() != 0 )
{
#ifdef __WXDEBUG__
if ( !pwc->m_expanded || pwc->m_y < 0 )
{
wxLogDebug(wxT("WARNING: <API key>::GetItemAtY: Item %s should have been visible and expanded."),pwc->m_label.c_str());
wxLogDebug(wxT(" (%s[%i]: %s)"),pwc->m_parent->m_label.c_str(),pwc->m_arrIndex,pwc->m_label.c_str());
//wxLogDebug(wxT(" py=%i"),(int)py);
return (wxPGProperty*) NULL;
}
#endif
return pwc->GetItemAtY(y,lh);
}
}
return (wxPGProperty*) NULL;
}
void <API key>::Empty()
{
size_t i;
if ( m_expanded != <API key> )
{
for ( i=0; i<GetCount(); i++ )
{
wxPGProperty* p = (wxPGProperty*) Item(i);
delete p;
}
}
m_children.Empty();
}
void <API key>::ChildChanged( wxPGProperty* WXUNUSED(p) )
{
}
wxString <API key>::GetValueAsString( int argFlags ) const
{
wxCHECK_MSG( GetCount() > 0,
wxString(),
wxT("If user property does not have any children, it must override GetValueAsString.") );
wxString text;
int i;
int iMax = m_children.GetCount();
if ( iMax > <API key> &&
!(argFlags & wxPG_FULL_VALUE) )
iMax = <API key>;
int iMaxMinusOne = iMax-1;
wxPGProperty* curChild = (wxPGProperty*) m_children.Item(0);
for ( i = 0; i < iMax; i++ )
{
wxString s;
if ( !(curChild->m_flags & <API key>) )
s = curChild->GetValueAsString(argFlags);
if ( curChild->GetParentingType() == 0 )
text += s;
else
text += wxT("[") + s + wxT("]");
if ( i < iMaxMinusOne )
{
if ( text.length() > <API key> &&
!(argFlags & wxPG_EDITABLE_VALUE) &&
!(argFlags & wxPG_FULL_VALUE) )
break;
curChild = (wxPGProperty*) m_children.Item(i+1);
if ( curChild->GetParentingType() == 0 )
text += wxT("; ");
else
text += wxT(" ");
}
}
if ( (unsigned int)i < m_children.GetCount() )
text += wxT("; ...");
return text;
}
// Convert semicolon delimited tokens into child values.
bool <API key>::SetValueFromString( const wxString& text, int argFlags )
{
if ( !GetCount() )
return false;
unsigned int curChild = 0;
unsigned int iMax = m_children.GetCount();
if ( iMax > <API key> &&
!(argFlags & wxPG_FULL_VALUE) )
iMax = <API key>;
bool changed = false;
wxString token;
size_t pos = 0;
// Its best only to add non-empty group items
bool addOnlyIfNotEmpty = false;
const wxChar delimeter = wxT(';');
wxChar a;
size_t lastPos = text.length();
size_t tokenStart = 0xFFFFFF;
do
{
a = text[pos];
if ( tokenStart != 0xFFFFFF )
{
// Token is running
if ( a == delimeter || a == 0 )
{
token = text.substr(tokenStart,pos-tokenStart);
token.Trim(true);
size_t len = token.length();
if ( !addOnlyIfNotEmpty || len > 0 )
{
wxPGProperty* child = Item(curChild);
if ( len > 0 )
{
bool wasUnspecified = child->IsValueUnspecified();
if ( child->SetValueFromString( token, wxPG_REPORT_ERROR ) )
{
// If modified, set mod flag and store value back to parent
child->SetFlag( wxPG_PROP_MODIFIED );
// Clear unspecified flag only if SetValueFromString didn't
// affect it.
if ( child->IsValueUnspecified() &&
(wasUnspecified || !UsesAutoUnspecified()) )
child->ClearFlag( <API key> );
ChildChanged( child );
changed = true;
}
}
else
{
child->SetFlag( <API key> );
changed = true;
}
curChild++;
if ( curChild >= iMax )
break;
}
tokenStart = 0xFFFFFF;
}
}
else
{
// Token is not running
if ( a != wxT(' ') )
{
addOnlyIfNotEmpty = false;
// Is this a group of tokens?
if ( a == wxT('[') )
{
int depth = 1;
pos++;
size_t startPos = pos;
// Group item - find end
do
{
a = text[pos];
pos++;
if ( a == wxT(']') )
depth
else if ( a == wxT('[') )
depth++;
} while ( depth > 0 && a );
token = text.substr(startPos,pos-startPos-1);
if ( !token.length() )
break;
wxPGProperty* child = Item(curChild);
//wxLogDebug(wxT("child(1) %i: %s"),curChild,token.c_str());
if ( child->SetValueFromString( token, wxPG_REPORT_ERROR ) )
{
// If modified, set mod flag and store value back to parent
child->SetFlag( wxPG_PROP_MODIFIED );
ChildChanged( child );
changed = true;
}
curChild++;
if ( curChild >= iMax )
break;
addOnlyIfNotEmpty = true;
tokenStart = 0xFFFFFF;
}
else
{
tokenStart = pos;
if ( a == delimeter )
{
pos
}
}
}
}
pos++;
}
while ( pos <= lastPos );
// This ensures that the last item is set unspecified even
// if the blank had no terminating delimiter.
if ( curChild < iMax )
{
wxPGProperty* child = Item(curChild);
child->SetFlag( <API key> );
changed = true;
}
return changed;
}
void <API key>::RefreshChildren ()
{
}
// wxParentProperty
wxPGProperty* wxParentProperty( const wxString& label, const wxString& name )
{
return new <API key>(label,name);
}
<API key>(wxParentProperty,none,TextCtrl)
<API key>(wxParentProperty,<API key>)
<API key>::<API key>( const wxString& label, const wxString& name )
: <API key>(label,name)
{
m_parentingType = PT_CUSTOMPROPERTY;
}
<API key>::~<API key>() { }
void <API key>::DoSetValue( wxPGVariant value )
{
const wxString& str = wxPGVariantToString(value);
m_string = str;
SetValueFromString(str,wxPG_REPORT_ERROR);
}
wxPGVariant <API key>::DoGetValue() const
{
return wxPGVariant();
}
void <API key>::ChildChanged( wxPGProperty* WXUNUSED(p) )
{
}
wxString <API key>::GetValueAsString( int argFlags ) const
{
if ( !GetCount() )
return wxEmptyString;
return <API key>::GetValueAsString(argFlags);
}
// <API key>
<API key>(wxPGRootProperty,none,TextCtrl)
const <API key>* <API key>::GetClassInfo() const
{
return (const <API key>*) NULL;
}
<API key>::<API key>()
: <API key>()
{
m_parentingType = PT_ROOT; // this was PT_CAPTION in <= 1.1.6, but changed
// so the depth calculations can become
// more consistent.
m_depth = 0;
}
<API key>::~<API key>()
{
}
// <API key>
wxPGProperty* wxPropertyCategory( const wxString& label, const wxString& name )
{
return new <API key>(label,name);
}
<API key>(wxPropertyCategory,<API key>)
<API key>(wxPropertyCategory,none,TextCtrl)
<API key>::<API key>()
: <API key>()
{
// don't set colour - prepareadditem method should do this
m_parentingType = 1;
m_capFgColIndex = 1;
}
<API key>::<API key>( const wxString &label, const wxString& name )
: <API key>(label,name)
{
// don't set colour - prepareadditem method should do this
m_parentingType = 1;
m_capFgColIndex = 1;
}
<API key>::~<API key>()
{
}
wxString <API key>::GetValueAsString( int ) const
{
return wxEmptyString;
}
void <API key>::CalculateTextExtent( wxWindow* wnd, wxFont& font )
{
int x = 0, y = 0;
wnd->GetTextExtent( m_label, &x, &y, 0, 0, &font );
m_textExtent = x;
}
// wxPGEditor
wxPGEditor::~wxPGEditor()
{
}
void wxPGEditor::DrawValue( wxDC& dc, wxPGProperty* property, const wxRect& rect ) const
{
if ( !(property->GetFlags() & <API key>) )
dc.DrawText( property->GetDisplayedString(), rect.x+wxPG_XBEFORETEXT, rect.y );
}
void wxPGEditor::<API key>( wxWindow*, const wxString& ) const
{
}
void wxPGEditor::SetControlIntValue( wxWindow*, int ) const
{
}
int wxPGEditor::InsertItem( wxWindow*, const wxString&, int ) const
{
return -1;
}
void wxPGEditor::DeleteItem( wxWindow*, int ) const
{
return;
}
void wxPGEditor::OnFocus( wxPGProperty*, wxWindow* ) const
{
}
bool wxPGEditor::<API key>() const
{
return false;
}
// wxPGClipperWindow
#if <API key>
// Clipper window is used to "remove" borders from controls
// which otherwise insist on having them despite of supplied
// wxNO_BORDER window style.
class wxPGClipperWindow : public wxWindow
{
DECLARE_CLASS(wxPGClipperWindow)
public:
wxPGClipperWindow()
: wxWindow()
{
wxPGClipperWindow::Init();
}
wxPGClipperWindow(wxWindow* parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize)
{
Init();
Create(parent,id,pos,size);
}
void Create(wxWindow* parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
virtual ~wxPGClipperWindow();
virtual bool ProcessEvent(wxEvent& event);
inline wxWindow* GetControl() const { return m_ctrl; }
// This is called before wxControl is constructed.
void GetControlRect( int xadj, int yadj, wxPoint& pt, wxSize& sz );
// This is caleed after wxControl has been constructed.
void SetControl( wxWindow* ctrl );
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL );
virtual void SetFocus();
virtual bool SetFont(const wxFont& font);
inline int GetXClip() const { return m_xadj; }
inline int GetYClip() const { return m_yadj; }
protected:
wxWindow* m_ctrl;
int m_xadj; // Horizontal border clip.
int m_yadj; // Vertical border clip.
private:
void Init ()
{
m_ctrl = (wxWindow*) NULL;
}
};
IMPLEMENT_CLASS(wxPGClipperWindow,wxWindow)
// This is called before wxControl is constructed.
void wxPGClipperWindow::GetControlRect( int xadj, int yadj, wxPoint& pt, wxSize& sz )
{
m_xadj = xadj;
m_yadj = yadj;
pt.x = -xadj;
pt.y = -yadj;
wxSize own_size = GetSize();
sz.x = own_size.x+(xadj*2);
sz.y = own_size.y+(yadj*2);
}
// This is caleed after wxControl has been constructed.
void wxPGClipperWindow::SetControl( wxWindow* ctrl )
{
m_ctrl = ctrl;
// GTK requires this.
ctrl->SetSizeHints(3,3);
// Correct size of this window to match the child.
wxSize sz = GetSize();
wxSize chsz = ctrl->GetSize();
int hei_adj = chsz.y - (sz.y+(m_yadj*2));
if ( hei_adj )
SetSize(sz.x,chsz.y-(m_yadj*2));
}
void wxPGClipperWindow::Refresh( bool eraseBackground, const wxRect *rect )
{
wxWindow::Refresh(false,rect);
if ( m_ctrl )
// FIXME: Rect to sub-ctrl refresh too
m_ctrl->Refresh(eraseBackground);
}
// Pass focus to control
void wxPGClipperWindow::SetFocus()
{
if ( m_ctrl )
m_ctrl->SetFocus();
else
wxWindow::SetFocus();
}
bool wxPGClipperWindow::SetFont(const wxFont& font)
{
bool res = wxWindow::SetFont(font);
if ( m_ctrl )
return m_ctrl->SetFont(font);
return res;
}
void wxPGClipperWindow::Create(wxWindow* parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size )
{
wxWindow::Create(parent,id,pos,size);
}
wxPGClipperWindow::~wxPGClipperWindow()
{
}
bool wxPGClipperWindow::ProcessEvent(wxEvent& event)
{
if ( event.GetEventType() == wxEVT_SIZE )
{
if ( m_ctrl )
{
// Maintain correct size relationship.
wxSize sz = GetSize();
m_ctrl->SetSize(sz.x+(m_xadj*2),sz.y+(m_yadj*2));
event.Skip();
return false;
}
}
return wxWindow::ProcessEvent(event);
}
#endif // <API key>
/*wxWindow* wxPropertyGrid::<API key>( wxWindow* ctrl )
{
#if <API key>
// Pass real control instead of clipper window
if ( ctrl->IsKindOf(CLASSINFO(wxPGClipperWindow)) )
{
return ((wxPGClipperWindow*)ctrl)->GetControl();
}
#else
return ctrl;
#endif
}*/
// wxPGTextCtrlEditor
// Clipper window support macro (depending on whether it is used
// for this editor or not)
#if <API key> || <API key>
#define <API key> 1
#define <API key>(WND) \
wxASSERT( WND ); \
wxTextCtrl* tc = (wxTextCtrl*)((wxPGClipperWindow*)WND)->GetControl()
#else
#define <API key> 0
#define <API key>(WND) \
wxASSERT( WND ); \
wxTextCtrl* tc = (wxTextCtrl*)WND
#endif
<API key>(TextCtrl,wxPGTextCtrlEditor,wxPGEditor)
#ifndef __WXPYTHON__
wxWindow* wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz,
wxWindow** ) const
#else
wxPGWindowPair wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz ) const
#endif
{
wxString text;
// If has children and limited editing, then don't create.
if ((property->GetFlags() & wxPG_PROP_NOEDITOR) &&
property->GetParentingType() < 0 &&
!property->IsKindOf(WX_PG_CLASSINFO(wxCustomProperty)))
return (wxWindow*) NULL;
if ( !(property->GetFlags() & <API key>) )
text = property->GetValueAsString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
int flags = 0;
if ( (property->GetFlags() & wxPG_PROP_PASSWORD) &&
property->IsKindOf(WX_PG_CLASSINFO(wxStringProperty)) )
flags |= wxTE_PASSWORD;
wxWindow* wnd = propGrid-><API key>(pos,sz,text,(wxWindow*)NULL,flags,
property->GetMaxLength());
return wnd;
}
void wxPGTextCtrlEditor::DrawValue( wxDC& dc, wxPGProperty* property, const wxRect& rect ) const
{
if ( !(property->GetFlags() & <API key>) )
{
wxString drawStr = property->GetDisplayedString();
// Code below should no longer be needed, as the obfuscation
// is now done in GetValueAsString.
/*if ( (property->GetFlags() & wxPG_PROP_PASSWORD) &&
property->IsKindOf(WX_PG_CLASSINFO(wxStringProperty)) )
{
size_t a = drawStr.length();
drawStr.Empty();
drawStr.Append(wxT('*'),a);
}*/
dc.DrawText( drawStr, rect.x+wxPG_XBEFORETEXT, rect.y );
}
}
void wxPGTextCtrlEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
{
<API key>(ctrl);
tc->SetValue(property->GetDisplayedString());
}
// Provided so that, for example, ComboBox editor can use the same code
// (multiple inheritance would get way too messy).
bool wxPGTextCtrlEditor::OnTextCtrlEvent( wxPropertyGrid* propGrid,
wxPGProperty* property,
wxWindow* ctrl,
wxEvent& event )
{
if ( !ctrl )
return false;
if ( event.GetEventType() == <API key> )
{
if ( propGrid-><API key>() )
{
return true;
}
}
else if ( event.GetEventType() == <API key> )
{
<API key>(ctrl);
// If value is unspecified and character count is zero,
// then do not set as modified.
if ( !(property->GetFlags() & <API key>) ||
!tc ||
(tc->IsKindOf(CLASSINFO(wxTextCtrl)) &&
(tc->GetLastPosition() > 0)) )
{
// We must check this since an 'empty' text event
// may be triggered when creating the property.
if ( !(propGrid->GetInternalFlags() & <API key>) )
{
// Pass this event outside wxPropertyGrid so that,
// if necessary, program can tell when user is editing
// a textctrl.
// FIXME: Is it safe to change event id in the middle of event
// processing (seems to work, but...)?
event.Skip();
event.SetId(propGrid->GetId());
}
propGrid-><API key>();
}
}
return false;
}
bool wxPGTextCtrlEditor::OnEvent( wxPropertyGrid* propGrid,
wxPGProperty* property,
wxWindow* ctrl,
wxEvent& event ) const
{
return wxPGTextCtrlEditor::OnTextCtrlEvent(propGrid,property,ctrl,event);
}
bool wxPGTextCtrlEditor::<API key>( wxPGProperty* property, wxWindow* ctrl )
{
#if <API key>
// Pass real control instead of clipper window
if ( ctrl->IsKindOf(CLASSINFO(wxPGClipperWindow)) )
{
ctrl = ((wxPGClipperWindow*)ctrl)->GetControl();
}
#endif
wxTextCtrl* tc = (wxTextCtrl*)ctrl;
bool res = property->SetValueFromString(tc->GetValue(),0);
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).
if ( !res && property->IsFlagSet(<API key>) )
res = true;
return res;
}
bool wxPGTextCtrlEditor::<API key>( wxPGProperty* property, wxWindow* ctrl ) const
{
return wxPGTextCtrlEditor::<API key>(property,ctrl);
}
void wxPGTextCtrlEditor::<API key>( wxWindow* ctrl ) const
{
<API key>(ctrl);
tc->Remove(0,tc->GetValue().length());
}
void wxPGTextCtrlEditor::<API key>( wxWindow* ctrl, const wxString& txt ) const
{
<API key>(ctrl);
tc->SetValue(txt);
}
void wxPGTextCtrlEditor::OnFocus( wxPGProperty*, wxWindow* wnd ) const
{
<API key>(wnd);
tc->SetSelection(-1,-1);
}
wxPGTextCtrlEditor::~wxPGTextCtrlEditor() { }
// wxPGChoiceEditor
extern const wxChar* <API key>; // in props.cpp
<API key>(Choice,wxPGChoiceEditor,wxPGEditor)
// This is a special enhanced double-click processor class.
// In essence, it allows for double-clicks for which the
// first click "created" the control.
class <API key> : public wxEvtHandler
{
public:
<API key>( <API key>* combo )
: wxEvtHandler()
{
m_timeLastMouseUp = 0;
m_combo = combo;
m_downReceived = false;
}
protected:
void OnMouseEvent( wxMouseEvent& event )
{
wxLongLong t = ::<API key>();
int evtType = event.GetEventType();
if ( m_combo->HasFlag(<API key>) &&
!m_combo->IsPopupShown() )
{
// Just check that it is in the text area
wxPoint pt = event.GetPosition();
if ( m_combo->GetTextRect().wxPGRectContains(pt) )
{
if ( evtType == wxEVT_LEFT_DOWN )
{
// Set value to avoid up-events without corresponding downs
m_downReceived = true;
}
else if ( evtType == wxEVT_LEFT_DCLICK )
{
// We'll make our own double-clicks
event.SetEventType(0);
return;
}
else if ( evtType == wxEVT_LEFT_UP )
{
if ( m_downReceived || m_timeLastMouseUp == 1 )
{
wxLongLong timeFromLastUp = (t-m_timeLastMouseUp);
if ( timeFromLastUp < <API key> )
{
event.SetEventType(wxEVT_LEFT_DCLICK);
m_timeLastMouseUp = 1;
}
else
{
m_timeLastMouseUp = t;
}
}
}
}
}
event.Skip();
}
void OnSetFocus( wxFocusEvent& event )
{
m_timeLastMouseUp = ::<API key>();
event.Skip();
}
private:
wxLongLong m_timeLastMouseUp;
<API key>* m_combo;
bool m_downReceived;
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(<API key>, wxEvtHandler)
EVT_MOUSE_EVENTS(<API key>::OnMouseEvent)
EVT_SET_FOCUS(<API key>::OnSetFocus)
END_EVENT_TABLE()
class wxPGComboBox : public <API key>
{
public:
wxPGComboBox()
: <API key>()
{
m_dclickProcessor = (<API key>*) NULL;
}
~wxPGComboBox()
{
if ( m_dclickProcessor )
{
RemoveEventHandler(m_dclickProcessor);
delete m_dclickProcessor;
}
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr)
{
if ( !<API key>::Create( parent,
id,
value,
pos,
size,
n,
choices,
style,
validator,
name ) )
return false;
m_dclickProcessor = new <API key>(this);
PushEventHandler(m_dclickProcessor);
return true;
}
virtual bool OnDrawListItem( wxDC& dc, const wxRect& rect, int item, int flags )
{
wxPropertyGrid* pg = wxDynamicCast(GetParent(),wxPropertyGrid);
wxASSERT(pg);
pg->OnComboItemPaint((<API key>*)this,item,dc,(wxRect&)rect,flags);
return true;
}
virtual wxCoord OnMeasureListItem( int item )
{
wxPropertyGrid* pg = wxDynamicCast(GetParent(),wxPropertyGrid);
wxASSERT(pg);
wxRect rect;
rect.x = -1;
rect.width = 0;
pg->OnComboItemPaint((<API key>*)this,item,*((wxDC*)NULL),rect,0);
return rect.height;
}
virtual wxCoord <API key>( int item )
{
wxPropertyGrid* pg = wxDynamicCast(GetParent(),wxPropertyGrid);
wxASSERT(pg);
wxRect rect;
rect.x = -1;
rect.width = -1;
pg->OnComboItemPaint((<API key>*)this,item,*((wxDC*)NULL),rect,0);
return rect.width;
}
private:
<API key>* m_dclickProcessor;
};
void wxPropertyGrid::OnComboItemPaint( <API key>* pCc,
int item,
wxDC& dc,
wxRect& rect,
int flags )
{
<API key>* pCb = (<API key>*)pCc;
// Sanity check
wxASSERT( IsKindOf(CLASSINFO(wxPropertyGrid)) );
wxPGProperty* p = m_selected;
// Decide what custom image size to use
wxSize cis = GetImageSize(p);
if ( rect.x < 0 &&
!(m_iFlags & <API key>) )
{
// Default measure behaviour (no flexible, custom paint image only)
if ( rect.width < 0 )
{
wxCoord x, y;
GetTextExtent(pCb->GetString(item), &x, &y, 0, 0, &m_font);
rect.width = cis.x + <API key> + <API key> + 9 + x;
}
rect.height = cis.y + 2;
return;
}
wxPGPaintData paintdata;
paintdata.m_parent = NULL;
paintdata.m_choiceItem = item;
// This is by the current (1.0.0b) spec - if painting control, item is -1
if ( (flags & <API key>) )
paintdata.m_choiceItem = -1;
if ( &dc )
dc.SetBrush(*wxWHITE_BRUSH);
if ( rect.x >= 0 )
{
// DrawItem call
wxPoint pt(rect.x + wxPG_CONTROL_MARGIN - wxPG_CHOICEXADJUST - 1,
rect.y + 1);
if ( cis.x > 0 &&
( !p->m_dataExt || !p->m_dataExt->m_valueBitmap || item == pCb->GetSelection() ) &&
( item >= 0 || (flags & <API key>) )
)
{
pt.x += <API key>;
wxRect r(pt.x,pt.y,cis.x,cis.y);
if ( flags & <API key> )
{
//r.width = cis.x;
r.height = <API key>(m_lineHeight);
}
if ( m_iFlags & <API key> )
r.width = rect.width;
paintdata.m_drawnWidth = r.width;
dc.SetPen(m_colPropFore);
if ( item >= 0 )
p->OnCustomPaint( dc, r, paintdata );
else
dc.DrawRectangle( r );
if ( (m_iFlags & <API key>) )
{
if ( paintdata.m_drawnWidth > 0 )
return;
// Revert pt.x
pt.x -= (<API key>+1);
}
else
pt.x += paintdata.m_drawnWidth + <API key> - 1;
}
else
// TODO: This aligns text so that it seems to be horizontally
// on the same line as property values. Not really
// sure if its needed, but seems to not cause any harm.
pt.x -= 1;
// Draw text
pt.y += (rect.height-m_fontHeight)/2 - 1;
wxString text;
if ( !(flags & <API key>) )
{
text = pCb->GetString(item);
}
else
{
if ( !p->IsValueUnspecified() )
text = p->GetValueAsString(0);
}
dc.DrawText( text, pt.x + wxPG_XBEFORETEXT, pt.y );
}
else
{
// MeasureItem call
p->OnCustomPaint( dc, rect, paintdata );
rect.height = paintdata.m_drawnHeight + 2;
rect.width = cis.x + <API key> + <API key> + 9;
}
}
// CreateControls calls this with CB_READONLY in extraStyle
wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz,
long extraStyle ) const
{
wxString defString;
wxPGChoiceInfo choiceInfo;
// Get choices.
choiceInfo.m_arrWxString = (wxString*) NULL;
choiceInfo.m_arrWxChars = (const wxChar**) NULL;
choiceInfo.m_itemCount = 0;
int index = property->GetChoiceInfo( &choiceInfo );
if ( property->GetFlags() & <API key> )
{
index = -1;
}
else
{
defString = property->GetDisplayedString();
}
// SLAlloc allows fast conversion using potentially pre-allocated wxStrings
// (and appending is out of question due to performance problems on some platforms).
// If itemcount is < 0, fill wxArrayString using GetEntry
if ( choiceInfo.m_itemCount < 0 )
{
<API key>* ep = (<API key>*) property;
size_t i = 0;
const wxString* entryLabel;
int entryValue;
wxArrayString& sl = propGrid->SLGet();
entryLabel = ep->GetEntry(i,&entryValue);
while ( entryLabel )
{
if ( sl.GetCount() > i )
sl[i] = *entryLabel;
else
sl.Add(*entryLabel);
i++;
entryLabel = ep->GetEntry(i,&entryValue);
}
choiceInfo.m_itemCount = ((int)i) - 1;
}
else if ( !choiceInfo.m_arrWxString )
{
wxASSERT( choiceInfo.m_arrWxChars || !choiceInfo.m_itemCount );
propGrid->SLAlloc( choiceInfo.m_itemCount, choiceInfo.m_arrWxChars );
if ( choiceInfo.m_itemCount )
choiceInfo.m_arrWxString = &propGrid->SLGet().Item(0);
}
//<API key>* cb;
wxPGComboBox* cb;
wxPoint po(pos);
wxSize si(sz);
po.y += wxPG_CHOICEYADJUST;
si.y -= (wxPG_CHOICEYADJUST*2);
/*#if <API key>
po.x += (wxPG_CHOICEXADJUST+<API key>);
si.x -= (wxPG_CHOICEXADJUST+<API key>);
wxPGClipperWindow* wnd = new wxPGClipperWindow(propGrid,wxPG_SUBID1,po,si);
wxWindow* ctrlParent = wnd;
wnd->GetControlRect(<API key>,<API key>,po,si);
#else*/
po.x += wxPG_CHOICEXADJUST;
si.x -= wxPG_CHOICEXADJUST;
wxWindow* ctrlParent = propGrid;
//#endif
// NB: Using wxWidgets <API key> needs adding wxTE_PROCESS_ENTER
// into the flags.
int odcbFlags = extraStyle | wxNO_BORDER | <API key> | wxPGCC_ALT_KEYS;
if ( !(property->GetFlags() & <API key>) )
odcbFlags |= <API key>;
if ( (property->GetFlags() & wxPG_PROP_USE_DCC) &&
(property->GetClassName()==<API key>) )
odcbFlags |= <API key>;
cb = new wxPGComboBox();
#ifdef __WXMSW__
cb->Hide();
#endif
cb->Create(ctrlParent,
wxPG_SUBID1,
wxString(),
po,
si,
choiceInfo.m_itemCount,choiceInfo.m_arrWxString,
//(<API key>) &wxPropertyGrid::OnComboItemPaint,
odcbFlags);
int extRight = propGrid->GetClientSize().x - (po.x+si.x);
cb->SetButtonPosition(si.y,0,wxRIGHT);
cb->SetPopupExtents( 1, extRight );
cb->SetTextIndent(wxPG_XBEFORETEXT-2);
if ( (property->GetFlags() & <API key>) &&
!(propGrid->GetInternalFlags() & <API key>) )
{
wxSize imageSize = propGrid->GetImageSize(property);
cb->SetCustomPaintWidth( imageSize.x+6 );
}
if ( index >= 0 && index < (int)cb->GetCount() )
{
cb->SetSelection( index );
if ( defString.length() )
cb->SetValue( defString );
}
else if ( !(extraStyle & wxCB_READONLY) && defString.length() )
cb->SetValue( defString );
else
cb->SetSelection( -1 );
if ( property->HasFlag(wxPG_PROP_READONLY) )
cb->Disable();
#ifdef __WXMSW__
cb->Show();
#endif
return (wxWindow*) cb;
}
void wxPGChoiceEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
{
wxASSERT( ctrl );
<API key>* cb = (<API key>*)ctrl;
wxASSERT( cb->IsKindOf(CLASSINFO(<API key>)));
int ind = property->GetChoiceInfo( (wxPGChoiceInfo*)NULL );
cb->SetSelection(ind);
}
#ifndef __WXPYTHON__
wxWindow* wxPGChoiceEditor::CreateControls( wxPropertyGrid* propGrid, wxPGProperty* property,
const wxPoint& pos, const wxSize& sz, wxWindow** ) const
#else
wxPGWindowPair wxPGChoiceEditor::CreateControls( wxPropertyGrid* propGrid, wxPGProperty* property,
const wxPoint& pos, const wxSize& sz ) const
#endif
{
return CreateControlsBase(propGrid,property,pos,sz,wxCB_READONLY);
}
int wxPGChoiceEditor::InsertItem( wxWindow* ctrl, const wxString& label, int index ) const
{
wxASSERT( ctrl );
<API key>* cb = (<API key>*)ctrl;
wxASSERT( cb->IsKindOf(CLASSINFO(<API key>)));
if (index < 0)
index = cb->GetCount();
return cb->Insert(label,index);
}
void wxPGChoiceEditor::DeleteItem( wxWindow* ctrl, int index ) const
{
wxASSERT( ctrl );
<API key>* cb = (<API key>*)ctrl;
wxASSERT( cb->IsKindOf(CLASSINFO(<API key>)));
cb->Delete(index);
}
bool wxPGChoiceEditor::OnEvent( wxPropertyGrid* WXUNUSED(propGrid), wxPGProperty* WXUNUSED(property),
wxWindow* WXUNUSED(ctrl), wxEvent& event ) const
{
if ( event.GetEventType() == <API key> )
{
/*if ( <API key>( property, ctrl ) )
{
return true;
}
propGrid-><API key>();
//wxPropertyGridState::<API key>(property,<API key>);
<API key>(property);*/
return true;
}
return false;
}
bool wxPGChoiceEditor::<API key>( wxPGProperty* property, wxWindow* ctrl ) const
{
<API key>* cb = (<API key>*)ctrl;
int index = cb->GetSelection();
if ( index != property->GetChoiceInfo( (wxPGChoiceInfo*) NULL ) ||
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).
property->IsFlagSet(<API key>)
)
{
property->SetValueFromInt(index,0);
return true;
}
return false;
}
void wxPGChoiceEditor::<API key>( wxWindow* ctrl, const wxString& txt ) const
{
<API key>* cb = (<API key>*)ctrl;
wxASSERT( cb );
cb->SetValue(txt);
}
void wxPGChoiceEditor::SetControlIntValue( wxWindow* ctrl, int value ) const
{
<API key>* cb = (<API key>*)ctrl;
wxASSERT( cb );
cb->SetSelection(value);
}
void wxPGChoiceEditor::<API key>( wxWindow* ctrl ) const
{
<API key>* cb = (<API key>*)ctrl;
cb->SetSelection(-1);
}
bool wxPGChoiceEditor::<API key>() const
{
return true;
}
wxPGChoiceEditor::~wxPGChoiceEditor() { }
// wxPGComboBoxEditor
<API key>(ComboBox,wxPGComboBoxEditor,wxPGChoiceEditor)
void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
{
<API key>* cb = (<API key>*)ctrl;
cb->SetValue(property->GetDisplayedString());
// TODO: If string matches any selection, then select that.
}
#ifndef __WXPYTHON__
wxWindow* wxPGComboBoxEditor::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz,
wxWindow** ) const
#else
wxPGWindowPair wxPGComboBoxEditor::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz ) const
#endif
{
return CreateControlsBase(propGrid,property,pos,sz,0);
}
bool wxPGComboBoxEditor::OnEvent( wxPropertyGrid* propGrid,
wxPGProperty* property,
wxWindow* ctrl,
wxEvent& event ) const
{
<API key>* cb = (<API key>*) NULL;
wxWindow* textCtrl = (wxWindow*) NULL;
if ( ctrl )
{
cb = (<API key>*)ctrl;
textCtrl = cb->GetTextCtrl();
}
if ( wxPGTextCtrlEditor::OnTextCtrlEvent(propGrid,property,textCtrl,event) )
return true;
return wxPGChoiceEditor::OnEvent(propGrid,property,ctrl,event);
}
bool wxPGComboBoxEditor::<API key>( wxPGProperty* property, wxWindow* ctrl ) const
{
<API key>* cb = (<API key>*)ctrl;
bool res = property->SetValueFromString(cb->GetValue(),0);
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).
if ( !res && property->IsFlagSet(<API key>) )
res = true;
return res;
}
void wxPGComboBoxEditor::OnFocus( wxPGProperty*, wxWindow* ctrl ) const
{
<API key>* cb = (<API key>*)ctrl;
cb->GetTextCtrl()->SetSelection(-1,-1);
}
wxPGComboBoxEditor::~wxPGComboBoxEditor() { }
// <API key>
// This simpler implement_editor macro doesn't define class body.
<API key>(ChoiceAndButton,<API key>,wxPGChoiceEditor)
#ifndef __WXPYTHON__
wxWindow* <API key>::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz,
wxWindow** psecondary ) const
#else
wxPGWindowPair <API key>::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz ) const
#endif
{
// Use one two units smaller to match size of the combo's dropbutton.
// (normally a bigger button is used because it looks better)
int bt_wid = sz.y;
bt_wid -= 2;
wxSize bt_sz(bt_wid,bt_wid);
// Position of button.
wxPoint bt_pos(pos.x+sz.x-bt_sz.x,pos.y);
#ifdef __WXMAC__
bt_pos.y -= 1;
#else
bt_pos.y += 1;
#endif
wxWindow* bt = propGrid-><API key>( bt_pos, bt_sz );
// Size of choice.
wxSize ch_sz(sz.x-bt->GetSize().x,sz.y);
#ifdef __WXMAC__
ch_sz.x -= <API key>;
#endif
wxWindow* ch = wxPG_EDITOR(Choice)->CreateControls(propGrid,property,
pos,ch_sz
#ifndef __WXPYTHON__
, (wxWindow**)NULL);
#else
).m_primary;
#endif
#ifdef __WXMSW__
bt->Show();
#endif
#ifndef __WXPYTHON__
*psecondary = bt;
return ch;
#else
return wxPGWindowPair(ch, bt);
#endif
}
<API key>::~<API key>() { }
// <API key>
// This simpler implement_editor macro doesn't define class body.
<API key>(TextCtrlAndButton,<API key>,wxPGTextCtrlEditor)
#ifndef __WXPYTHON__
wxWindow* <API key>::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz,
wxWindow** psecondary ) const
{
wxWindow* wnd = propGrid-><API key>( pos, sz, psecondary,
property->GetFlags() & wxPG_PROP_NOEDITOR, property);
return wnd;
}
#else
wxPGWindowPair <API key>::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& sz ) const
{
wxWindow* wnd2;
wxWindow* wnd = propGrid-><API key>( pos, sz, &wnd2,
property->GetFlags() & wxPG_PROP_NOEDITOR, property);
return wxPGWindowPair(wnd, wnd2);
}
#endif
<API key>::~<API key>() { }
// wxPGCheckBoxEditor
#if <API key>
<API key>(CheckBox,wxPGCheckBoxEditor,wxPGEditor)
// state argument: 0x01 = set if checked
// 0x02 = set if rectangle should be bold
static void DrawSimpleCheckBox( wxDC& dc, const wxRect& rect, int box_hei, int state, const wxColour& linecol )
{
// Box rectangle.
wxRect r(rect.x+wxPG_XBEFORETEXT,rect.y+((rect.height-box_hei)/2),box_hei,box_hei);
// Draw check mark first because it is likely to overdraw the
// surrounding rectangle.
if ( state & 1 )
{
wxRect r2(r.x+wxPG_CHECKMARK_XADJ,
r.y+wxPG_CHECKMARK_YADJ,
r.width+wxPG_CHECKMARK_WADJ,
r.height+wxPG_CHECKMARK_HADJ);
#if <API key>
r2.Deflate(<API key>);
#endif
dc.DrawCheckMark(r2);
// This would draw a simple cross check mark.
// dc.DrawLine(r.x,r.y,r.x+r.width-1,r.y+r.height-1);
// dc.DrawLine(r.x,r.y+r.height-1,r.x+r.width-1,r.y);
}
if ( !(state & 2) )
{
// Pen for thin rectangle.
dc.SetPen(linecol);
}
else
{
// Pen for bold rectangle.
wxPen linepen(linecol,2,wxSOLID);
linepen.SetJoin(wxJOIN_MITER); // This prevents round edges.
dc.SetPen(linepen);
r.x++;
r.y++;
r.width
r.height
}
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(r);
dc.SetPen(*wxTRANSPARENT_PEN);
}
// Real simple custom-drawn <API key> class.
class wxSimpleCheckBox : public wxControl
{
public:
void SetValue( int value );
wxSimpleCheckBox( wxWindow* parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize )
: wxControl(parent,id,pos,size,wxNO_BORDER|wxWANTS_CHARS)
{
// Due to SetOwnFont stuff necessary for GTK+ 1.2, we need to have this
SetFont( parent->GetFont() );
m_state = 0;
m_boxHeight = ((wxPropertyGrid*)parent)->GetFontHeight();
SetBackgroundStyle( wxBG_STYLE_COLOUR );
}
virtual ~wxSimpleCheckBox();
virtual bool ProcessEvent(wxEvent& event);
int m_state;
int m_boxHeight;
static wxBitmap* ms_doubleBuffer;
};
wxSimpleCheckBox::~wxSimpleCheckBox()
{
delete ms_doubleBuffer;
ms_doubleBuffer = NULL;
}
wxBitmap* wxSimpleCheckBox::ms_doubleBuffer = (wxBitmap*) NULL;
// value = 2 means toggle (sorry, too lazy to do constants)
void wxSimpleCheckBox::SetValue( int value )
{
if ( value > 1 )
{
m_state++;
if ( m_state > 1 ) m_state = 0;
}
else
{
m_state = value;
}
Refresh();
wxCommandEvent evt(<API key>,GetParent()->GetId());
((wxPropertyGrid*)GetParent())->OnCustomEditorEvent(evt);
}
bool wxSimpleCheckBox::ProcessEvent(wxEvent& event)
{
wxPropertyGrid* propGrid = (wxPropertyGrid*) GetParent();
if ( event.GetEventType() == <API key> )
{
//wxLogDebug(wxT("<API key>"));
//SetFocusFromKbd();
//event.Skip();
//return wxControl::ProcessEvent(event);
}
else
if ( ( (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK)
&& ((wxMouseEvent&)event).m_x > (wxPG_XBEFORETEXT-2)
&& ((wxMouseEvent&)event).m_x <= (wxPG_XBEFORETEXT-2+m_boxHeight) )
)
{
SetValue(2);
return true;
}
else if ( event.GetEventType() == wxEVT_PAINT )
{
wxSize clientSize = GetClientSize();
wxPaintDC dc(this);
/*
// Buffered paint DC doesn't seem to do much good
if ( !ms_doubleBuffer ||
clientSize.x > ms_doubleBuffer->GetWidth() ||
clientSize.y > ms_doubleBuffer->GetHeight() )
{
delete ms_doubleBuffer;
ms_doubleBuffer = new wxBitmap(clientSize.x+25,clientSize.y+25);
}
wxBufferedPaintDC dc(this,*ms_doubleBuffer);
*/
wxRect rect(0,0,clientSize.x,clientSize.y);
rect.x -= 1;
rect.width += 1;
m_boxHeight = propGrid->GetFontHeight();
wxColour bgcol = GetBackgroundColour();
dc.SetBrush( bgcol );
dc.SetPen( bgcol );
dc.DrawRectangle( rect );
wxColour txcol = GetForegroundColour();
int state = m_state;
if ( m_font.GetWeight() == wxBOLD )
state |= 2;
DrawSimpleCheckBox(dc,rect,m_boxHeight,state,txcol);
// If focused, indicate it somehow.
/*
if ( wxWindow::FindFocus() == this )
{
rect.x += 1;
rect.width -= 1;
wxPGDrawFocusRect(dc,rect);
}
*/
return true;
}
else if ( event.GetEventType() == wxEVT_SIZE ||
event.GetEventType() == wxEVT_SET_FOCUS ||
event.GetEventType() == wxEVT_KILL_FOCUS
)
{
Refresh();
}
else if ( event.GetEventType() == wxEVT_KEY_DOWN )
{
wxKeyEvent& keyEv = (wxKeyEvent&) event;
if ( keyEv.GetKeyCode() == WXK_TAB )
{
propGrid-><API key>( keyEv.ShiftDown()?0:1 );
return true;
}
else
if ( keyEv.GetKeyCode() == WXK_SPACE )
{
SetValue(2);
return true;
}
}
return wxControl::ProcessEvent(event);
}
#ifndef __WXPYTHON__
wxWindow* wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& size,
wxWindow** ) const
#else
wxPGWindowPair wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid,
wxPGProperty* property,
const wxPoint& pos,
const wxSize& size ) const
#endif
{
wxPoint pt = pos;
pt.x -= wxPG_XBEFOREWIDGET;
wxSize sz = size;
sz.x += wxPG_XBEFOREWIDGET;
wxSimpleCheckBox* cb = new wxSimpleCheckBox(propGrid,wxPG_SUBID1,pt,sz);
cb->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
cb->Connect( wxPG_SUBID1, wxEVT_LEFT_DOWN,
(<API key>) (wxEventFunction) (<API key>)
&wxPropertyGrid::OnCustomEditorEvent, NULL, propGrid );
cb->Connect( wxPG_SUBID1, wxEVT_LEFT_DCLICK,
(<API key>) (wxEventFunction) (<API key>)
&wxPropertyGrid::OnCustomEditorEvent, NULL, propGrid );
if ( property->GetChoiceInfo((wxPGChoiceInfo*)NULL) &&
!(property->GetFlags() & <API key>) )
cb->m_state = 1;
// If mouse cursor was on the item, toggle the value now.
if ( propGrid->GetInternalFlags() & <API key> )
{
wxPoint pt = propGrid->ScreenToClient(::wxGetMousePosition());
if ( pt.x <= (cb->GetPosition().x+wxPG_XBEFORETEXT-2+cb->m_boxHeight) )
{
cb->m_state++;
if ( cb->m_state > 1 )
cb->m_state = 0;
property->ClearFlag(<API key>);
property->SetValueFromInt(cb->m_state,0);
propGrid->PropertyWasModified(property);
}
}
return cb;
}
void wxPGCheckBoxEditor::DrawValue( wxDC& dc, wxPGProperty* property, const wxRect& rect ) const
{
int state = 0;
if ( !(property->GetFlags() & <API key>) )
{
state = property->GetChoiceInfo((wxPGChoiceInfo*)NULL);
if ( dc.GetFont().GetWeight() == wxBOLD ) state |= 2;
}
DrawSimpleCheckBox(dc,rect,dc.GetCharHeight(),state,dc.GetTextForeground());
}
void wxPGCheckBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
{
wxASSERT( ctrl );
((wxSimpleCheckBox*)ctrl)->m_state = property->GetChoiceInfo((wxPGChoiceInfo*)NULL);
ctrl->Refresh();
}
bool wxPGCheckBoxEditor::OnEvent( wxPropertyGrid* WXUNUSED(propGrid), wxPGProperty* WXUNUSED(property),
wxWindow* WXUNUSED(ctrl), wxEvent& event ) const
{
if ( event.GetEventType() == <API key> )
{
/*if ( <API key>( property, ctrl ) )
return true;
propGrid-><API key>();
<API key>(property);*/
return true;
}
return false;
}
bool wxPGCheckBoxEditor::<API key>( wxPGProperty* property, wxWindow* ctrl ) const
{
wxSimpleCheckBox* cb = (wxSimpleCheckBox*)ctrl;
int index = cb->m_state;
if ( index != property->GetChoiceInfo( (wxPGChoiceInfo*) NULL ) ||
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).
property->IsFlagSet(<API key>)
)
{
property->SetValueFromInt(index,0);
return true;
}
return false;
}
void wxPGCheckBoxEditor::SetControlIntValue( wxWindow* ctrl, int value ) const
{
if ( value != 0 ) value = 1;
((wxSimpleCheckBox*)ctrl)->m_state = value;
ctrl->Refresh();
}
void wxPGCheckBoxEditor::<API key>( wxWindow* ctrl ) const
{
((wxSimpleCheckBox*)ctrl)->m_state = 0;
ctrl->Refresh();
}
wxPGCheckBoxEditor::~wxPGCheckBoxEditor() { }
#endif // <API key>
// wxPGBrush
// This class is a wxBrush derivative used in the background colour
// brush cache. It adds wxPG-type colour-in-long to the class.
// JMS: Yes I know wxBrush doesn't actually hold the value (refcounted
// object does), but this is simpler implementation and equally
// effective.
class wxPGBrush : public wxBrush
{
public:
wxPGBrush( const wxColour& colour );
wxPGBrush();
virtual ~wxPGBrush() { }
void SetColour2( const wxColour& colour );
inline long GetColourAsLong() const { return m_colAsLong; }
private:
long m_colAsLong;
};
void wxPGBrush::SetColour2( const wxColour& colour )
{
wxBrush::SetColour(colour);
m_colAsLong = wxPG_COLOUR(colour.Red(),colour.Green(),colour.Blue());
}
wxPGBrush::wxPGBrush() : wxBrush()
{
m_colAsLong = 0;
}
wxPGBrush::wxPGBrush( const wxColour& colour ) : wxBrush(colour)
{
m_colAsLong = wxPG_COLOUR(colour.Red(),colour.Green(),colour.Blue());
}
// wxPGColour
// Same as wxPGBrush, but for wxColour instead.
class wxPGColour : public wxColour
{
public:
wxPGColour( const wxColour& colour );
wxPGColour();
virtual ~wxPGColour() { }
void SetColour2( const wxColour& colour );
inline long GetColourAsLong() const { return m_colAsLong; }
private:
long m_colAsLong;
};
void wxPGColour::SetColour2( const wxColour& colour )
{
*this = colour;
m_colAsLong = wxPG_COLOUR(colour.Red(),colour.Green(),colour.Blue());
}
wxPGColour::wxPGColour() : wxColour()
{
m_colAsLong = 0;
}
wxPGColour::wxPGColour( const wxColour& colour ) : wxColour(colour)
{
m_colAsLong = wxPG_COLOUR(colour.Red(),colour.Green(),colour.Blue());
}
// wxPGTLWHandler
// Intercepts Close-events sent to wxPropertyGrid's top-level parent,
// and tries to commit property value.
class wxPGTLWHandler : public wxEvtHandler
{
public:
wxPGTLWHandler( wxPropertyGrid* pg )
: wxEvtHandler()
{
m_pg = pg;
}
protected:
void OnClose( wxCloseEvent& event )
{
// ClearSelection forces value validation/commit.
if ( event.CanVeto() && !m_pg->ClearSelection() )
{
event.Veto();
return;
}
event.Skip();
}
private:
wxPropertyGrid* m_pg;
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxPGTLWHandler, wxEvtHandler)
EVT_CLOSE(wxPGTLWHandler::OnClose)
END_EVENT_TABLE()
// wxPropertyGrid
IMPLEMENT_CLASS(wxPropertyGrid, wxScrolledWindow)
BEGIN_EVENT_TABLE(wxPropertyGrid, wxScrolledWindow)
EVT_MOTION(wxPropertyGrid::OnMouseMove)
EVT_IDLE(wxPropertyGrid::OnIdle)
EVT_LEFT_DOWN(wxPropertyGrid::OnMouseClick)
EVT_LEFT_UP(wxPropertyGrid::OnMouseUp)
EVT_RIGHT_UP(wxPropertyGrid::OnMouseRightClick)
EVT_LEFT_DCLICK(wxPropertyGrid::OnMouseDoubleClick)
EVT_PAINT(wxPropertyGrid::OnPaint)
EVT_SIZE(wxPropertyGrid::OnResize)
EVT_KEY_DOWN(wxPropertyGrid::OnKey)
EVT_KEY_UP(wxPropertyGrid::OnKeyUp)
EVT_CHAR(wxPropertyGrid::OnKey)
EVT_ENTER_WINDOW(wxPropertyGrid::OnMouseEntry)
EVT_LEAVE_WINDOW(wxPropertyGrid::OnMouseEntry)
<API key>(wxPropertyGrid::OnCaptureChange)
EVT_SCROLLWIN(wxPropertyGrid::OnScrollEvent)
EVT_NAVIGATION_KEY(wxPropertyGrid::OnNavigationKey)
EVT_TEXT(wxPG_SUBID1,wxPropertyGrid::OnCustomEditorEvent)
EVT_COMBOBOX(wxPG_SUBID1,wxPropertyGrid::OnCustomEditorEvent)
EVT_BUTTON(wxPG_SUBID2,wxPropertyGrid::OnCustomEditorEvent)
EVT_CHILD_FOCUS(wxPropertyGrid::OnChildFocusEvent)
EVT_SET_FOCUS(wxPropertyGrid::OnFocusEvent)
EVT_KILL_FOCUS(wxPropertyGrid::OnFocusEvent)
EVT_TEXT_ENTER(wxPG_SUBID1,wxPropertyGrid::OnCustomEditorEvent)
<API key>(wxPropertyGrid::OnSysColourChanged)
END_EVENT_TABLE()
wxPropertyGrid::wxPropertyGrid()
: wxScrolledWindow()
{
Init1();
}
wxPropertyGrid::wxPropertyGrid( wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxChar* name )
: wxScrolledWindow()
{
Init1();
Create(parent,id,pos,size,style,name);
}
bool wxPropertyGrid::Create( wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxChar* name )
{
if ( !(style&wxBORDER_MASK) )
style |= wxSIMPLE_BORDER;
style |= wxVSCROLL;
#ifdef __WXMSW__
// This prevents crash under Win2K, but still
// enables keyboard navigation
if ( style & wxTAB_TRAVERSAL )
{
style &= ~(wxTAB_TRAVERSAL);
style |= wxWANTS_CHARS;
}
#else
if ( style & wxTAB_TRAVERSAL )
style |= wxWANTS_CHARS;
#endif
wxScrolledWindow::Create(parent,id,pos,size,style,name);
Init2();
return true;
}
static void <API key>();
// Initialize values to defaults
void wxPropertyGrid::Init1()
{
<API key>()
#if !wxPG_USE_WXMODULE
if ( !wxPGGlobalVars )
wxPGGlobalVars = new wxPGGlobalVarsClass();
#endif
// Register type classes, if necessary.
if ( wxPGGlobalVars->m_dictValueType.empty() )
<API key>();
// Register editor classes, if necessary.
if ( wxPGGlobalVars->m_mapEditorClasses.empty() )
<API key>();
// Register property classes, if necessary
if ( wxPGGlobalVars-><API key>.empty() )
<API key>();
m_iFlags = 0;
m_pState = (wxPropertyGridState*) NULL;
m_wndPrimary = m_wndSecondary = (wxWindow*) NULL;
m_selected = (wxPGProperty*) NULL;
m_propHover = (wxPGProperty*) NULL;
m_eventObject = this;
m_curFocused = (wxWindow*) NULL;
m_tlwHandler = NULL;
m_processingEvent = 0;
m_dragStatus = 0;
m_mouseSide = 16;
m_editorFocused = 0;
m_coloursCustomized = 0;
m_frozen = 0;
#if wxPG_DOUBLE_BUFFER
m_doubleBuffer = (wxBitmap*) NULL;
#endif
m_windowsToDelete = NULL;
#ifndef wxPG_ICON_WIDTH
m_expandbmp = NULL;
m_collbmp = NULL;
m_iconWidth = 11;
m_iconHeight = 11;
#else
m_iconWidth = wxPG_ICON_WIDTH;
#endif
m_prevVY = -1;
m_calcVisHeight = 0;
m_gutterWidth = wxPG_GUTTER_MIN;
<API key> = 10;
m_lineHeight = 0;
m_width = m_height = m_fWidth = 0;
m_bottomy = 0;
m_splitterx = <API key>;
m_fSplitterX = (float) <API key>;
#if !wxPG_HEAVY_GFX
m_splitterpen.SetColour( *wxBLACK );
m_splitterpen.SetWidth( 4 );
<API key> = -1;
#endif
SetButtonShortcut(0);
m_keyComboConsumed = 0;
m_ignoredEvents = 0;
}
// Initialize after parent etc. set
void wxPropertyGrid::Init2()
{
wxASSERT( !(m_iFlags & wxPG_FL_INITIALIZED ) );
#ifdef __WXMAC__
// Smaller controls on Mac
SetWindowVariant(<API key>);
#endif
// Now create state, if one didn't exist already
// (<API key> might have created it for us).
if ( !m_pState )
{
m_pState = CreateState();
m_pState->m_pPropGrid = this;
m_iFlags |= <API key>;
}
if ( !(m_windowStyle & <API key>) )
m_iFlags |= <API key>;
if ( m_windowStyle & <API key> )
{
m_pState->InitNonCatMode();
FROM_STATE(m_properties) = FROM_STATE(m_abcArray);
}
GetClientSize(&m_width,&m_height);
#if !wxPG_HEAVY_GFX
m_splitterpen.SetColour( *wxBLACK );
m_splitterpen.SetWidth( 4 );
#endif
#ifndef wxPG_ICON_WIDTH
// create two bitmap nodes for drawing
m_expandbmp = new wxBitmap(expand_xpm);
m_collbmp = new wxBitmap(collapse_xpm);
// calculate average font height for bitmap centering
m_iconWidth = m_expandbmp->GetWidth();
m_iconHeight = m_expandbmp->GetHeight();
#endif
m_curcursor = wxCURSOR_ARROW;
m_cursorSizeWE = new wxCursor( wxCURSOR_SIZEWE );
// adjust bitmap icon y position so they are centered
m_vspacing = <API key>;
if ( !m_font.Ok() )
{
wxFont useFont = wxScrolledWindow::GetFont();
wxScrolledWindow::SetOwnFont( useFont );
}
else
// This should be otherwise called by SetOwnFont
<API key>( <API key> );
// Add base brush item
m_arrBgBrushes.Add((void*)new wxPGBrush());
// Add base colour items
m_arrFgCols.Add((void*)new wxPGColour());
m_arrFgCols.Add((void*)new wxPGColour());
RegainColours();
// This helps with flicker
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
// Hook the TLW
wxPGTLWHandler* handler = new wxPGTLWHandler(this);
m_tlp = ::wxGetTopLevelParent(this);
m_tlwHandler = handler;
m_tlp->PushEventHandler(handler);
// set virtual size to this window size
wxSize wndsize = GetSize();
SetVirtualSize(wndsize.GetWidth(), wndsize.GetWidth());
m_timeCreated = ::<API key>();
m_iFlags |= wxPG_FL_INITIALIZED;
// Need to call OnResize handler or size given in constructor/Create
// will never work.
wxSizeEvent sizeEvent(wndsize,0);
OnResize(sizeEvent);
}
wxPropertyGrid::~wxPropertyGrid()
{
size_t i;
DoSelectProperty(NULL);
// This should do prevent things from going too badly wrong
m_iFlags &= ~(wxPG_FL_INITIALIZED);
END_MOUSE_CAPTURE
wxPGTLWHandler* handler = (wxPGTLWHandler*) m_tlwHandler;
m_tlp->RemoveEventHandler(handler);
delete handler;
#ifdef __WXDEBUG__
if ( <API key>() )
::wxMessageBox(wxT("Most recent change in property editor was lost!!!\n\n(if you don't want this to happen, close your frames and dialogs using Close(false).)"),
wxT("wxPropertyGrid Debug Warning") );
#endif
#if wxPG_DOUBLE_BUFFER
if ( m_doubleBuffer )
delete m_doubleBuffer;
#endif
delete m_windowsToDelete;
m_selected = (wxPGProperty*) NULL;
if ( m_iFlags & <API key> )
delete m_pState;
delete m_cursorSizeWE;
#ifndef wxPG_ICON_WIDTH
delete m_expandbmp;
delete m_collbmp;
#endif
// Delete cached text colours.
for ( i=0; i<m_arrFgCols.GetCount(); i++ )
{
delete (wxPGColour*)m_arrFgCols.Item(i);
}
// Delete cached brushes.
for ( i=0; i<m_arrBgBrushes.GetCount(); i++ )
{
delete (wxPGBrush*)m_arrBgBrushes.Item(i);
}
}
bool wxPropertyGrid::Destroy()
{
END_MOUSE_CAPTURE
return wxScrolledWindow::Destroy();
}
wxPropertyGridState* wxPropertyGrid::CreateState() const
{
return new wxPropertyGridState();
}
// wxPropertyGrid overridden wxWindow methods
void wxPropertyGrid::SetWindowStyleFlag( long style )
{
long old_style = m_windowStyle;
if ( m_iFlags & wxPG_FL_INITIALIZED )
{
wxASSERT( m_pState );
if ( !(style & <API key>) && (old_style & <API key>) )
{
// Enable categories
EnableCategories( true );
}
else if ( (style & <API key>) && !(old_style & <API key>) )
{
// Disable categories
EnableCategories( false );
}
if ( !(old_style & wxPG_AUTO_SORT) && (style & wxPG_AUTO_SORT) )
{
// Autosort enabled
if ( !m_frozen )
<API key>();
else
FROM_STATE(m_itemsAdded) = 1;
}
#if <API key>
if ( !(old_style & wxPG_TOOLTIPS) && (style & wxPG_TOOLTIPS) )
{
// Tooltips enabled
/*wxToolTip* tooltip = new wxToolTip ( wxEmptyString );
SetToolTip ( tooltip );
tooltip->SetDelay ( wxPG_TOOLTIP_DELAY );*/
}
else if ( (old_style & wxPG_TOOLTIPS) && !(style & wxPG_TOOLTIPS) )
{
// Tooltips disabled
wxScrolledWindow::SetToolTip ( (wxToolTip*) NULL );
}
#endif
}
wxScrolledWindow::SetWindowStyleFlag ( style );
if ( m_iFlags & wxPG_FL_INITIALIZED )
{
if ( (old_style & wxPG_HIDE_MARGIN) != (style & wxPG_HIDE_MARGIN) )
{
<API key>( m_vspacing );
RedrawAllVisible();
}
}
}
void wxPropertyGrid::Freeze()
{
m_frozen++;
wxScrolledWindow::Freeze();
}
void wxPropertyGrid::Thaw()
{
m_frozen
wxScrolledWindow::Thaw();
#if <API key>
Refresh();
#endif
// Force property re-selection
if ( m_selected )
DoSelectProperty(m_selected, wxPG_SEL_FORCE);
}
void wxPropertyGrid::SetExtraStyle( long exStyle )
{
if ( exStyle & <API key> )
{
#if defined(__WXMSW__)
/*
// Don't use WS_EX_COMPOSITED just now.
HWND hWnd;
if ( m_iFlags & wxPG_FL_IN_MANAGER )
hWnd = (HWND)GetParent()->GetHWND();
else
hWnd = (HWND)GetHWND();
::SetWindowLong( hWnd, GWL_EXSTYLE,
::GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_COMPOSITED );
*/
//#elif defined(__WXGTK20__)
#endif
// Only apply <API key> if the window
// truly was double-buffered.
if ( !<API key>(this) )
{
exStyle &= ~(<API key>);
}
else
{
#if wxPG_DOUBLE_BUFFER
delete m_doubleBuffer;
m_doubleBuffer = NULL;
#endif
}
}
wxScrolledWindow::SetExtraStyle( exStyle );
if ( exStyle & wxPG_EX_INIT_NOCAT )
m_pState->InitNonCatMode ();
if ( exStyle & <API key> )
m_windowStyle |= wxPG_TOOLTIPS;
if ( exStyle & <API key> )
{
wxPGGlobalVars->m_numBoolChoices = 3;
}
else
{
wxPGGlobalVars->m_numBoolChoices = 2;
}
}
// returns the best acceptable minimal size
wxSize wxPropertyGrid::DoGetBestSize() const
{
int hei = 15;
if ( m_lineHeight > hei )
hei = m_lineHeight;
wxSize sz = wxSize( 60, hei+40 );
CacheBestSize(sz);
return sz;
}
// wxPropertyGrid Font and Colour Methods
void wxPropertyGrid::<API key>( int vspacing )
{
int x = 0, y = 0;
m_captionFont = GetFont();
GetTextExtent(wxT("jG"), &x, &y, 0, 0, &m_captionFont);
<API key> = x + (x/2);
m_fontHeight = y;
#if <API key>
m_iconWidth = wxPG_ICON_WIDTH;
#elif wxPG_ICON_WIDTH
// scale icon
m_iconWidth = (m_fontHeight * wxPG_ICON_WIDTH) / 13;
if ( m_iconWidth < 5 ) m_iconWidth = 5;
else if ( !(m_iconWidth & 0x01) ) m_iconWidth++; // must be odd
#endif
m_gutterWidth = m_iconWidth / wxPG_GUTTER_DIV;
if ( m_gutterWidth < wxPG_GUTTER_MIN )
m_gutterWidth = wxPG_GUTTER_MIN;
int vdiv = 6;
if ( vspacing <= 1 ) vdiv = 12;
else if ( vspacing >= 3 ) vdiv = 3;
m_spacingy = m_fontHeight / vdiv;
if ( m_spacingy < wxPG_YSPACING_MIN )
m_spacingy = wxPG_YSPACING_MIN;
m_marginWidth = 0;
if ( !(m_windowStyle & wxPG_HIDE_MARGIN) )
m_marginWidth = m_gutterWidth*2 + m_iconWidth;
m_captionFont.SetWeight(wxBOLD);
GetTextExtent(wxT("jG"), &x, &y, 0, 0, &m_captionFont);
m_lineHeight = m_fontHeight+(2*m_spacingy)+1;
// button spacing
m_buttonSpacingY = (m_lineHeight - m_iconHeight) / 2;
if ( m_buttonSpacingY < 0 ) m_buttonSpacingY = 0;
InvalidateBestSize();
}
void wxPropertyGrid::OnSysColourChanged( <API key> &WXUNUSED(event) )
{
RegainColours();
Refresh();
}
static wxColour wxPGAdjustColour(const wxColour& src, int ra,
int ga = 1000, int ba = 1000,
bool forceDifferent = false)
{
if ( ga >= 1000 )
ga = ra;
if ( ba >= 1000 )
ba = ra;
// Recursion guard (allow 2 max)
static int isinside = 0;
isinside++;
wxCHECK_MSG( isinside < 3,
*wxBLACK,
wxT("wxPGAdjustColour should not be recursively called more than once") );
wxColour dst;
int r = src.Red();
int g = src.Green();
int b = src.Blue();
int r2 = r + ra;
if ( r2>255 ) r2 = 255;
else if ( r2<0) r2 = 0;
int g2 = g + ga;
if ( g2>255 ) g2 = 255;
else if ( g2<0) g2 = 0;
int b2 = b + ba;
if ( b2>255 ) b2 = 255;
else if ( b2<0) b2 = 0;
// Make sure they are somewhat different
if ( forceDifferent && (abs((r+g+b)-(r2+g2+b2)) < abs(ra/2)) )
dst = wxPGAdjustColour(src,-(ra*2));
else
dst = wxColour((unsigned char)r2,(unsigned char)g2,(unsigned char)b2);
// Recursion guard (allow 2 max)
isinside
return dst;
}
static int wxPGGetColAvg( const wxColour& col )
{
return (col.Red() + col.Green() + col.Blue()) / 3;
}
void wxPropertyGrid::RegainColours()
{
wxColour def_bgcol = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
if ( !(m_coloursCustomized & 0x0002) )
{
wxColour col = wxSystemSettings::GetColour( <API key> );
// Make sure colour is dark enough
#ifdef __WXGTK__
int colDec = wxPGGetColAvg(col) - 230;
#else
int colDec = wxPGGetColAvg(col) - 200;
#endif
if ( colDec > 0 )
m_colCapBack = wxPGAdjustColour(col,-colDec);
else
m_colCapBack = col;
}
if ( !(m_coloursCustomized & 0x0001) )
m_colMargin = m_colCapBack;
if ( !(m_coloursCustomized & 0x0004) )
{
#ifdef __WXGTK__
int colDec = -90;
#else
int colDec = -72;
#endif
wxColour capForeCol = wxPGAdjustColour(m_colCapBack,colDec,5000,5000,true);
m_colCapFore = capForeCol;
// Set the cached colour as well.
((wxPGColour*)m_arrFgCols.Item(1))->SetColour2(capForeCol);
}
if ( !(m_coloursCustomized & 0x0008) )
{
wxColour bgCol = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
m_colPropBack = bgCol;
// Set the cached brush as well.
((wxPGBrush*)m_arrBgBrushes.Item(0))->SetColour2(bgCol);
}
if ( !(m_coloursCustomized & 0x0010) )
{
wxColour fgCol = wxSystemSettings::GetColour( <API key> );
m_colPropFore = fgCol;
// Set the cached colour as well.
((wxPGColour*)m_arrFgCols.Item(0))->SetColour2(fgCol);
}
if ( !(m_coloursCustomized & 0x0020) )
m_colSelBack = wxSystemSettings::GetColour( <API key> );
if ( !(m_coloursCustomized & 0x0040) )
m_colSelFore = wxSystemSettings::GetColour( <API key> );
if ( !(m_coloursCustomized & 0x0080) )
m_colLine = m_colCapBack;
if ( !(m_coloursCustomized & 0x0100) )
m_colDisPropFore = m_colCapFore;
}
void wxPropertyGrid::ResetColours()
{
m_coloursCustomized = 0;
RegainColours();
Refresh();
}
bool wxPropertyGrid::SetFont( const wxFont& font )
{
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::SetFont") );
#endif
// Must disable active editor.
if ( m_selected )
{
bool selRes = ClearSelection();
wxPG_CHECK_MSG_DBG( selRes,
false,
wxT("failed to deselect a property (editor probably had invalid value)") );
}
// TODO: Following code is disabled with wxMac because
// it is reported to fail. I (JMS) cannot debug it
// personally right now.
#if !defined(__WXMAC__)
bool res = wxScrolledWindow::SetFont( font );
if ( res )
{
<API key>( m_vspacing );
if ( m_pState )
{
// Recalculate caption text extents.
// TODO: This should also be done to other pages of manager
// (so add <API key>::SetFont), but since font
// is usually set before categories are added, this is
// quite low priority.
size_t i;
for ( i=0;i<FROM_STATE(m_regularArray).GetCount();i++ )
{
wxPGProperty* p = FROM_STATE(m_regularArray).Item(i);
if ( p->GetParentingType() > 0 )
((<API key>*)p)->CalculateTextExtent(this,m_captionFont);
}
CalculateYs(NULL,-1);
}
Refresh();
}
return res;
#else
// ** wxMAC Only **
// TODO: Remove after SetFont crash fixed.
if ( m_iFlags & wxPG_FL_INITIALIZED )
{
wxLogDebug(wxT("WARNING: propGrid.cpp: wxPropertyGrid::SetFont has been disabled on wxMac since there has been crash reported in it. If you are willing to debug the cause, replace line '#if !defined(__WXMAC__)' with line '#if 1' in wxPropertyGrid::SetFont."));
}
return false;
#endif
}
void wxPropertyGrid::SetLineColour( const wxColour& col )
{
m_colLine = col;
m_coloursCustomized |= 0x80;
Refresh();
}
void wxPropertyGrid::SetMarginColour( const wxColour& col )
{
m_colMargin = col;
m_coloursCustomized |= 0x01;
Refresh();
}
void wxPropertyGrid::<API key>( const wxColour& col )
{
m_colPropBack = col;
m_coloursCustomized |= 0x08;
// Set the cached brush as well.
((wxPGBrush*)m_arrBgBrushes.Item(0))->SetColour2(col);
Refresh();
}
void wxPropertyGrid::SetCellTextColour( const wxColour& col )
{
m_colPropFore = col;
m_coloursCustomized |= 0x10;
// Set the cached colour as well.
((wxPGColour*)m_arrFgCols.Item(0))->SetColour2(col);
Refresh();
}
void wxPropertyGrid::<API key>( const wxColour& col )
{
m_colDisPropFore = col;
m_coloursCustomized |= 0x100;
Refresh();
}
void wxPropertyGrid::<API key>( const wxColour& col )
{
m_colSelBack = col;
m_coloursCustomized |= 0x20;
Refresh();
}
void wxPropertyGrid::<API key>( const wxColour& col )
{
m_colSelFore = col;
m_coloursCustomized |= 0x40;
Refresh();
}
void wxPropertyGrid::<API key>( const wxColour& col )
{
m_colCapBack = col;
m_coloursCustomized |= 0x02;
Refresh();
}
void wxPropertyGrid::<API key>( const wxColour& col )
{
m_colCapFore = col;
m_coloursCustomized |= 0x04;
// Set the cached colour as well.
((wxPGColour*)m_arrFgCols.Item(1))->SetColour2(col);
Refresh();
}
void wxPropertyGrid::<API key>( wxPGProperty* p, int index, int flags )
{
unsigned char ind = (unsigned char)index;
if ( (p->m_bgColIndex == 0) || (flags & (wxPG_RECURSE_STARTS|wxPG_FORCE)) )
p->m_bgColIndex = ind;
if ( p->GetParentingType() != 0 && (flags & wxPG_RECURSE) )
{
<API key>* pwc = (<API key>*)p;
unsigned int i;
for ( i=0; i<pwc->GetCount(); i++ )
<API key>(pwc->Item(i), index, flags & ~(wxPG_RECURSE_STARTS));
}
}
void wxPropertyGrid::<API key>( wxPGId id, const wxColour& colour )
{
<API key>()
size_t i;
int colInd = -1;
long colAsLong = wxPG_COLOUR(colour.Red(),colour.Green(),colour.Blue());
// As it is most likely that the previous colour is used, start comparison
// from the end.
for ( i=(m_arrBgBrushes.GetCount()-1); i>0; i
{
if ( ((wxPGBrush*)m_arrBgBrushes.Item(i))->GetColourAsLong() == colAsLong )
{
colInd = i;
break;
}
}
if ( colInd < 0 )
{
colInd = m_arrBgBrushes.GetCount();
wxCHECK_RET( colInd < 256, wxT("wxPropertyGrid: Warning - Only 255 different property background colours allowed.") );
m_arrBgBrushes.Add( (void*)new wxPGBrush(colour) );
}
// Set indexes
<API key>(p, colInd, wxPG_RECURSE|wxPG_RECURSE_STARTS);
// If this was on a visible grid, then draw it.
DrawItemAndChildren(p);
}
wxColour wxPropertyGrid::<API key>( wxPGId id ) const
{
<API key>(wxColour())
return ((wxPGBrush*)m_arrBgBrushes.Item(p->m_bgColIndex))->GetColour();
}
void wxPropertyGrid::SetTextColourIndex( wxPGProperty* p, int index, int flags )
{
unsigned char ind = (unsigned char)index;
if ( (p->m_fgColIndex == 0) || (flags & (wxPG_RECURSE_STARTS|wxPG_FORCE)) )
p->m_fgColIndex = ind;
if ( p->GetParentingType() != 0 && (flags & wxPG_RECURSE) )
{
<API key>* pwc = (<API key>*)p;
unsigned int i;
for ( i=0; i<pwc->GetCount(); i++ )
SetTextColourIndex( pwc->Item(i), index, flags&~(wxPG_RECURSE_STARTS) );
}
}
int wxPropertyGrid::CacheColour( const wxColour& colour )
{
unsigned int i;
int colInd = -1;
long colAsLong = wxPG_COLOUR(colour.Red(),colour.Green(),colour.Blue());
// As it is most likely that the previous colour is used, start comparison
// from the end.
for ( i=(m_arrFgCols.GetCount()-1); i>0; i
{
if ( ((wxPGColour*)m_arrFgCols.Item(i))->GetColourAsLong() == colAsLong )
{
colInd = i;
break;
}
}
if ( colInd < 0 )
{
colInd = m_arrFgCols.GetCount();
wxCHECK_MSG( colInd < 256, 0, wxT("wxPropertyGrid: Warning - Only 255 different property foreground colours allowed.") );
m_arrFgCols.Add( (void*)new wxPGColour(colour) );
}
return colInd;
}
void wxPropertyGrid::<API key>( wxPGId id, const wxColour& colour )
{
<API key>()
// Set indexes
SetTextColourIndex(p, CacheColour(colour), wxPG_RECURSE|wxPG_RECURSE_STARTS );
// If this was on a visible grid, then draw it.
DrawItemAndChildren(p);
}
void wxPropertyGrid::<API key>( wxPGId id, const wxColour& colour )
{
<API key>()
wxCHECK_RET( p->GetParentingType() == PT_CAPTION,
wxT("Only call <API key> for caption properties") );
// Set indexes
<API key>* cat = (<API key>*) p;
cat->SetTextColIndex(CacheColour(colour));
// If this was on a visible grid, then draw it.
DrawItemAndChildren(p);
}
wxColour wxPropertyGrid::<API key>( wxPGId id ) const
{
<API key>(wxColour())
return wxColour(*((wxPGColour*)m_arrFgCols.Item(p->m_fgColIndex)));
}
void wxPropertyGrid::<API key>( wxPGId id )
{
<API key>()
<API key>( p, 0, wxPG_RECURSE|wxPG_FORCE );
SetTextColourIndex( p, 0, wxPG_RECURSE|wxPG_FORCE );
if ( p->GetParentingType() == PT_CAPTION )
{
<API key>* cat = (<API key>*) p;
cat->SetTextColIndex(1);
}
}
// wxPropertyGrid property adding and removal
wxPGId wxPropertyGrid::Append( wxPGProperty* property )
{
return FROM_STATE(Append(property));
}
wxPGId wxPropertyGrid::_Insert( wxPGProperty* priorthis, wxPGProperty* property )
{
wxASSERT( priorthis );
return FROM_STATE(DoInsert(priorthis->GetParent(), priorthis->GetArrIndex(), property));
}
void <API key>::Delete( wxPGId id )
{
<API key>()
wxPropertyGridState* state = p->GetParentState();
wxPropertyGrid* grid = state->GetGrid();
if ( grid->GetState() == state )
{
bool selRes = grid->DoSelectProperty(wxPGIdGen(NULL), wxPG_SEL_DELETING);
wxPG_CHECK_RET_DBG( selRes,
wxT("failed to deselect a property (editor probably had invalid value)") );
}
state->DoDelete( p );
if ( grid->GetState() == state && !grid->IsFrozen() )
{
// This should be enough to resolve even the worst
// graphics glitch imaginable.
grid->Update();
grid->Refresh();
}
}
wxPGId <API key>::ReplaceProperty( wxPGId id, wxPGProperty* property )
{
<API key>(wxNullProperty)
wxPGProperty* replaced = wxPGIdToPtr(id);
wxCHECK_MSG( replaced && property,
wxNullProperty,
wxT("NULL property") );
wxCHECK_MSG( replaced->GetParentingType() == 0 || replaced->GetParentingType() == -1,
wxNullProperty,
wxT("cannot replace this type of property") );
wxCHECK_MSG( !m_pState->IsInNonCatMode(),
wxNullProperty,
wxT("cannot replace properties in alphabetic mode") );
// Get address to the slot
<API key>* parent = replaced->GetParent();
int ind = replaced->GetIndexInParent();
wxPropertyGridState* state = replaced->GetParentState();
Delete(replaced); // Must use generic Delete
state->DoInsert(parent,ind,property);
return wxPGIdGen(property);
}
void wxPropertyGrid::<API key>()
{
if ( !FROM_STATE(m_itemsAdded) ) return;
#if <API key>
wxLogDebug(wxT("<API key>( in thread 0x%lX )"),
(unsigned long)wxThread::GetCurrentId());
#endif
FROM_STATE(m_itemsAdded) = 0;
if ( m_windowStyle & wxPG_AUTO_SORT )
{
Sort ();
}
else
{
if ( m_bottomy < 1 )
CalculateYs( NULL, -1 );
else
{
<API key>();
// Update visibles array (maybe not necessary here, but just in case)
CalculateVisibles ( -1, true );
}
}
}
// wxPropertyGrid property value setting and getting
void wxPGGetFailed( const wxPGProperty* p, const wxChar* typestr )
{
<API key>(p,typestr,wxT("Get"));
}
void <API key>( const wxPGProperty* p, const wxChar* typestr,
const wxChar* op )
{
wxASSERT( p != NULL );
wxLogError( _T("Type operation \"%s\" failed: Property labeled \"%s\" is of type \"%s\", NOT \"%s\"."),
op,p->GetLabel().c_str(),wxPG_TO_WXCHAR_PTR(p->GetValueTypePtr()->GetCustomTypeName()),typestr );
}
void wxPropertyGrid::SetPropertyValue( wxPGId id, const wxPGValueType* typeclass, const wxPGVariant& value )
{
<API key>()
if ( p && m_pState->SetPropertyValue(p,typeclass,value) )
<API key>( p );
}
void wxPropertyGrid::SetPropertyValue( wxPGId id, const wxChar* typestring, const wxPGVariant& value )
{
<API key>()
if ( p && m_pState->SetPropertyValue(p,typestring,value) )
<API key>( p );
}
void wxPropertyGrid::<API key>( wxPGId id, const wxString& value )
{
<API key>()
if ( m_pState-><API key>(p,value) )
<API key>( p );
}
void wxPropertyGrid::<API key>( wxPGId id, wxObject* value )
{
<API key>()
if ( m_pState-><API key>(p,value) )
<API key>( p );
}
#ifndef __WXPYTHON__
void wxPropertyGrid::SetPropertyValue( wxPGId id, wxVariant& value )
{
<API key>()
if ( m_pState->SetPropertyValue(p,value) )
<API key>( p );
}
#endif
bool wxPropertyGrid::ClearPropertyValue( wxPGId id )
{
<API key>(false)
if ( m_pState->ClearPropertyValue(p) )
{
DrawItemAndChildren( p );
return true;
}
return false;
}
void wxPropertyGrid::<API key>( wxPGId id )
{
<API key>()
m_pState-><API key>(p);
DrawItemAndChildren(p);
<API key>* parent = p->GetParent();
while ( parent->GetParentingType() <= PT_FIXEDCHILDREN )
{
DrawItem(parent);
parent = parent->GetParent();
}
}
// wxPropertyGrid miscellaneous GetPropertyXXX methods
<API key>* wxPropertyGrid::<API key>( wxPGProperty* p )
{
wxPGProperty* parent = (<API key>*)p;
wxPGProperty* grandparent = (wxPGProperty*)parent->GetParent();
do
{
parent = grandparent;
grandparent = (wxPGProperty*)parent->GetParent();
if ( parent->GetParentingType() >= PT_CAPTION && grandparent )
return (<API key>*)parent;
} while ( grandparent );
return (<API key>*) NULL;
}
// wxPropertyGrid property operations
bool wxPropertyGrid::EnableProperty( wxPGId id, bool enable )
{
<API key>(false)
if ( enable )
{
if ( !(p->m_flags & wxPG_PROP_DISABLED) )
return false;
// If active, Set active Editor.
if ( p == m_selected )
DoSelectProperty( p, wxPG_SEL_FORCE );
}
else
{
if ( p->m_flags & wxPG_PROP_DISABLED )
return false;
// If active, Disable as active Editor.
if ( p == m_selected )
DoSelectProperty( p, wxPG_SEL_FORCE );
}
m_pState->EnableProperty(p,enable);
DrawItemAndChildren( p );
return true;
}
void wxPropertyGrid::<API key>( wxPGId id, bool limit )
{
<API key>()
m_pState-><API key>(p,limit);
if ( p == m_selected )
DoSelectProperty( p, wxPG_SEL_FORCE );
}
void wxPropertyGrid::_SetPropertyLabel( wxPGProperty* p, const wxString& newproplabel )
{
wxCHECK_RET( p, wxT("invalid property id") );
p->m_label = newproplabel;
if ( m_windowStyle & wxPG_AUTO_SORT )
{
Sort(p->GetParent());
Refresh();
}
else
DrawItem ( p );
}
void wxPropertyGrid::DoSetPropertyName( wxPGProperty* p, const wxString& newname )
{
wxCHECK_RET( p, wxT("invalid property id") );
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::SetPropertyName( %s -> %s )"),
p->GetName().c_str(), newname.c_str() );
#endif
if ( p->GetName().Len() ) FROM_STATE(m_dictName).erase ( wxPGNameConv(p->GetName()) );
if ( newname.Len() ) FROM_STATE(m_dictName)[newname] = (void*) p;
p->DoSetName(newname);
}
bool wxPropertyGrid::EnsureVisible( wxPGId id )
{
<API key>(false)
Update();
bool changed = false;
// Is it inside collapsed section?
if ( p->m_y < 0 )
{
// expand parents
wxPGProperty* parent = p->GetParent();
wxPGProperty* grandparent = parent->GetParent();
if ( grandparent && grandparent != FROM_STATE(m_properties) )
Expand ( grandparent );
Expand ( parent );
changed = true;
}
// Need to scroll?
int vx, vy;
GetViewStart(&vx,&vy);
vy*=<API key>;
if ( p->m_y < vy )
{
Scroll (vx, p->m_y/<API key> );
m_iFlags |= wxPG_FL_SCROLLED;
changed = true;
}
else if ( (p->m_y+m_lineHeight) > (vy+m_height) )
{
Scroll (vx, (p->m_y-m_height+(m_lineHeight*2))/<API key> );
m_iFlags |= wxPG_FL_SCROLLED;
changed = true;
}
if ( changed )
DrawItems ( p, p );
return changed;
}
// wxPropertyGrid helper methods called by properties
// Fixes position of wxTextCtrl-like control (wxSpinCtrl usually
// fits into that category as well).
void wxPropertyGrid::FixPosForTextCtrl( wxWindow* ctrl )
{
// Center the control vertically
wxRect finalPos = ctrl->GetRect();
int y_adj = (m_lineHeight - finalPos.height)/2 + <API key>;
// Prevent over-sized control
int sz_dec = (y_adj + finalPos.height) - m_lineHeight;
if ( sz_dec < 0 ) sz_dec = 0;
finalPos.y += y_adj;
finalPos.height -= (y_adj+sz_dec);
// STUPID HACK: wxTextCtrl has different indentation with different
// fonts, so this is to solve most common case (ie. using MS Shell Dlg 2
// or Tahoma - which are usually the same).
/*#ifdef __WXMSW__
wxString faceName = m_font.GetFaceName();
int textCtrlXAdjust = <API key>;
if ( (faceName == wxT("MS Shell Dlg 2") ||
faceName == wxT("Tahoma")) &&
m_font.GetWeight() != wxFONTWEIGHT_BOLD )
textCtrlXAdjust = 0;
#else*/
const int textCtrlXAdjust = <API key>;
//#endif
finalPos.x += textCtrlXAdjust;
finalPos.width -= textCtrlXAdjust;
ctrl->SetSize(finalPos);
}
// Control font changer helper.
void wxPropertyGrid::<API key>()
{
wxASSERT( m_wndPrimary );
m_wndPrimary->SetFont( m_captionFont );
}
wxWindow* wxPropertyGrid::<API key>( const wxPoint& pos,
const wxSize& sz,
const wxString& value,
wxWindow* secondary,
int extraStyle,
int maxLen )
{
int tcFlags = wxTE_PROCESS_ENTER | extraStyle;
if ( m_selected->HasFlag(wxPG_PROP_READONLY) )
tcFlags |= wxTE_READONLY;
wxPoint p(pos.x,pos.y);
wxSize s(sz.x,sz.y);
// Need to reduce width of text control on Mac
#if defined(__WXMAC__)
s.x -= 8;
#endif
// Take button into acccount
if ( secondary )
{
s.x -= (secondary->GetSize().x + <API key>);
m_iFlags &= ~(<API key>);
}
// If the height is significantly higher, then use border, and fill the rect exactly.
bool hasSpecialSize = false;
if ( (sz.y - m_lineHeight) > 5 )
hasSpecialSize = true;
#if <API key>
// Create clipper window
wxPGClipperWindow* wnd = new wxPGClipperWindow();
#if defined(__WXMSW__)
wnd->Hide();
#endif
wnd->Create(this,wxPG_SUBID1,p,s);
// This generates rect of the control inside the clipper window
if ( !hasSpecialSize )
wnd->GetControlRect(<API key>, <API key>, p, s);
else
wnd->GetControlRect(0, 0, p, s);
wxWindow* ctrlParent = wnd;
#else
wxWindow* ctrlParent = this;
if ( !hasSpecialSize )
tcFlags |= wxNO_BORDER;
#endif
wxTextCtrl* tc = new wxTextCtrl();
#if defined(__WXMSW__) && !<API key>
tc->Hide();
#endif
tc->Create(ctrlParent,wxPG_SUBID1,value, p, s,tcFlags);
#if <API key>
wxWindow* ed = wnd;
wnd->SetControl(tc);
#else
wxWindow* ed = tc;
#endif
// Center the control vertically
if ( !hasSpecialSize )
FixPosForTextCtrl(ed);
#ifdef __WXMSW__
ed->Show();
if ( secondary )
secondary->Show();
#endif
// Set maximum length
if ( maxLen > 0 )
tc->SetMaxLength( maxLen );
return (wxWindow*) ed;
}
wxWindow* wxPropertyGrid::<API key>( const wxPoint& pos, const wxSize& sz )
{
#ifdef __WXMAC__
// Decorations are chunky on Mac, and we can't make the button square, so
// do things a bit differently on this platform.
wxPoint p(pos.x+sz.x,
pos.y+<API key>);
wxSize s(25, -1);
wxButton* but = new wxButton();
but->Create(this,wxPG_SUBID2,wxT("..."),p,s,wxWANTS_CHARS);
// Now that we know the size, move to the correct position
p.x = pos.x + sz.x - but->GetSize().x - 2;
but->Move(p);
#else
wxSize s(sz.y-(wxPG_BUTTON_SIZEDEC*2)+(<API key>*2),
sz.y-(wxPG_BUTTON_SIZEDEC*2)+(<API key>*2));
// Reduce button width to lineheight
if ( s.x > m_lineHeight )
s.x = m_lineHeight;
wxPoint p(pos.x+sz.x-s.x,
pos.y+<API key>);
wxButton* but = new wxButton();
#ifdef __WXMSW__
but->Hide();
#endif
but->Create(this,wxPG_SUBID2,wxT("..."),p,s,wxWANTS_CHARS);
but->SetFont( m_captionFont );
#endif
if ( m_selected->HasFlag(wxPG_PROP_READONLY) )
but->Disable();
return but;
}
wxWindow* wxPropertyGrid::<API key>( const wxPoint& pos,
const wxSize& sz,
wxWindow** psecondary,
int limitedEditing,
wxPGProperty* property )
{
wxButton* but = (wxButton*)<API key>(pos,sz);
*psecondary = (wxWindow*)but;
if ( limitedEditing )
{
#ifdef __WXMSW__
// There is button Show in <API key> as well
but->Show();
#endif
return (wxWindow*) NULL;
}
wxString text;
if ( !(property->GetFlags() & <API key>) )
text = property->GetValueAsString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
return <API key>(pos,sz,text,but,property->m_maxLen);
}
wxPoint wxPropertyGrid::<API key>( wxPGProperty* p,
const wxSize& sz )
{
#if wxPG_SMALL_SCREEN
// On small-screen devices, always show dialogs with default position and size.
return wxDefaultPosition;
#else
int x = m_splitterx;
int y = p->m_y;
wxCHECK_MSG( y >= 0, wxPoint(-1,-1), wxT("invalid y?") );
wxCHECK_MSG( y < (int)m_bottomy, wxPoint(-1,-1), wxT("invalid y?") );
<API key>( &x, &y );
int sw = wxSystemSettings::GetMetric( ::wxSYS_SCREEN_X );
int sh = wxSystemSettings::GetMetric( ::wxSYS_SCREEN_Y );
int new_x;
int new_y;
if ( x > (sw/2) )
// left
new_x = x + (m_width-m_splitterx) - sz.x;
else
// right
new_x = x;
if ( y > (sh/2) )
// above
new_y = y - sz.y;
else
// below
new_y = y + m_lineHeight;
return wxPoint(new_x,new_y);
#endif
}
void wxPropertyGrid::SLAlloc( unsigned int itemcount, const wxChar** items )
{
wxArrayString& sl = m_sl;
unsigned int i;
unsigned int sl_oldcount = sl.GetCount();
if ( sl_oldcount > itemcount ) sl_oldcount = itemcount;
#if wxUSE_INTL
if ( !wxPGGlobalVars-><API key> )
{
#endif
for ( i=0; i<sl_oldcount; i++ )
sl.Item(i) = items[i];
for ( i=sl_oldcount; i<itemcount; i++ )
sl.Add ( items[i] );
#if wxUSE_INTL
}
else
{
for ( i=0; i<sl_oldcount; i++ )
sl.Item(i) = ::wxGetTranslation ( items[i] );
for ( i=sl_oldcount; i<itemcount; i++ )
sl.Add ( ::wxGetTranslation ( items[i] ) );
}
#endif
}
wxString& wxPropertyGrid::<API key>( wxString& dst_str, wxString& src_str )
{
if ( src_str.length() == 0 )
{
dst_str = src_str;
return src_str;
}
bool prev_is_slash = false;
wxString::const_iterator i = src_str.begin();
dst_str.clear();
for ( ; i != src_str.end(); i++ )
{
wxUniChar a = wxPGGetIterChar(src_str, i);
if ( a != wxT('\\') )
{
if ( !prev_is_slash )
{
dst_str << a;
}
else
{
if ( a == wxT('n') )
{
#ifdef __WXMSW__
dst_str << wxT('\n');
//dst_str << wxT('\10');
#else
dst_str << wxT('\n');
//dst_str << 10;
#endif
}
else if ( a == wxT('t') )
dst_str << wxT('\t');
else
dst_str << a;
}
prev_is_slash = false;
}
else
{
if ( prev_is_slash )
{
dst_str << wxT('\\');
prev_is_slash = false;
}
else
{
prev_is_slash = true;
}
}
}
return dst_str;
}
wxString& wxPropertyGrid::<API key>( wxString& dst_str, wxString& src_str )
{
if ( src_str.length() == 0 )
{
dst_str = src_str;
return src_str;
}
wxString::const_iterator i = src_str.begin();
wxChar prev_a = wxT('\0');
dst_str.clear();
for ( ; i != src_str.end(); i++ )
{
wxChar a = wxPGGetIterChar(src_str, i);
if ( a >= wxT(' ')
#if !wxUSE_UNICODE
|| a < 0
#endif
)
{
// This surely is not something that requires an escape sequence.
dst_str << a;
}
else
{
// This might need...
if ( a == wxT('\r') )
{
// DOS style line end.
// Already taken care below
//dst_str = wxT("\\n");
//src++;
}
else if ( a == wxT('\n') )
// UNIX style line end.
dst_str << wxT("\\n");
else if ( a == wxT('\t') )
// Tab.
dst_str << wxT('\t');
else
{
//wxLogDebug(wxT("WARNING: Could not create escape sequence for character #%i"),(int)a);
dst_str << a;
}
}
prev_a = a;
}
return dst_str;
}
// Item iteration macros
#define II_INVALID_I 0x00FFFFFF
#define <API key> \
<API key>* parent; \
unsigned int i; \
unsigned int iMax;
#define <API key> \
<API key>* parent; \
unsigned int i; \
unsigned int iMax;
#define <API key> \
parent = FROM_STATE(m_properties); \
i = 0;
#define ITEM_ITERATION_INIT(startparent,startindex) \
parent = startparent; \
i = (unsigned int)startindex; \
if ( parent == (<API key>*) NULL ) \
{ \
parent = FROM_STATE(m_properties); \
i = 0; \
}
#define <API key> \
unsigned char parent_expanded; \
do \
{ \
parent_expanded = (unsigned char)parent->m_expanded; \
if ( parent->m_parent && !parent->m_parent->m_expanded ) \
parent_expanded = 0; \
iMax = parent->GetCount(); \
while ( i < iMax ) \
{ \
wxPGProperty* p = parent->Item(i); \
int parenting = p->GetParentingType();
#define <API key> \
if ( parenting ) \
{ \
i = 0; \
parent = (<API key>*)p; \
if ( parent_expanded ) \
parent_expanded = (unsigned char)parent->m_expanded; \
else \
parent_expanded = 0; \
iMax = parent->GetCount(); \
} \
else \
i++; \
} \
i = parent->m_arrIndex + 1; \
parent = parent->m_parent; \
} \
while ( parent != NULL );
// DCAE = Don't care about parent_expanded (this is the least space hungry method).
#define <API key> \
do \
{ \
iMax = parent->GetCount(); \
while ( i < iMax ) \
{ \
wxPGProperty* p = parent->Item(i); \
int parenting = p->GetParentingType();
#define <API key> \
if ( parenting ) \
{ \
i = 0; \
parent = (<API key>*)p; \
iMax = parent->GetCount(); \
} \
else \
i++; \
} \
i = parent->m_arrIndex + 1; \
parent = parent->m_parent; \
} \
while ( parent != NULL );
// DCAE_ISP = Don't care about parent_expanded, Ignore sub-properties.
// Note that this treats fixed sub-properties same as sub-properties
// of wxParentProperty. Mode conversion requires this behaviour.
#define <API key> \
do \
{ \
iMax = parent->GetCount(); \
while ( i < iMax ) \
{ \
wxPGProperty* p = parent->Item(i); \
int parenting = p->GetParentingType();
#define <API key> \
if ( parenting > 0 ) \
{ \
i = 0; \
parent = (<API key>*)p; \
iMax = parent->GetCount(); \
} \
else \
i++; \
} \
i = parent->m_arrIndex + 1; \
parent = parent->m_parent; \
} \
while ( parent != (<API key>*) NULL );
// VO = Visible only (including those outside the scrolled section).
#define <API key> \
if ( (parent == FROM_STATE(m_properties) || parent->m_y >= 0) && parent->m_expanded ) \
{ \
do \
{ \
iMax = parent->GetCount(); \
while ( i < iMax ) \
{ \
wxPGProperty* p = parent->Item(i); \
if ( p->m_y >= 0 ) \
{ \
int parenting = p->GetParentingType();
#define <API key> \
if ( parenting && ((<API key>*)p)->m_expanded ) \
{ \
parent = (<API key>*)p; \
i = 0; \
break; \
} \
} \
i++; \
} \
if ( i >= iMax ) \
{ \
i = parent->m_arrIndex + 1; \
parent = parent->m_parent; \
} \
} \
while ( parent != (<API key>*) NULL ); \
}
// wxPropertyGrid visibility related methods
void wxPropertyGrid::CalculateYs( <API key>* startparent,
int startindex )
{
// Selection must be temporarily cleared during y-recalc
wxPGProperty* prevSelected = m_selected;
if ( prevSelected )
{
bool selRes = ClearSelection();
wxPG_CHECK_RET_DBG( selRes,
wxT("failed to deselect a property (editor probably had invalid value)") );
}
<API key>
#if <API key>
wxLogDebug(wxT("CalculateYs(startsfrom: %s[%i] ) "),
startparent?startparent->m_label.c_str():wxT("NULL"),
startindex);
#endif
ITEM_ITERATION_INIT(startparent,startindex)
wxASSERT( !m_frozen );
int cury = 0;
int lh = m_lineHeight;
if ( startparent != NULL )
cury = parent->Item(i)->m_y;
wxASSERT_MSG( cury >= 0, wxT("CalculateYs first item was not visible!!!") );
long hide_state = m_iFlags & wxPG_FL_HIDE_STATE;
bool inside_hidden_part = false;
//parent_expanded = (unsigned char)parent->m_expanded;
<API key>* nearest_expanded = (<API key>*) NULL;
// Find first visible and expanded parent.
while ( !parent->IsExpanded() ||
( (parent->m_flags & wxPG_PROP_HIDEABLE) && hide_state )
)
{
parent = parent->GetParent();
i = 0;
}
wxASSERT( parent );
//parent = nearest_expanded;
do
{
iMax = parent->GetCount();
if ( !inside_hidden_part )
{
while ( i < iMax )
{
wxPGProperty* p = parent->Item(i);
int parenting = p->GetParentingType();
if ( !(p->m_flags & wxPG_PROP_HIDEABLE) || (!hide_state) )
{
// item is visible (all parents are expanded, non-hideable or not in hide state)
p->m_y = (int)cury;
cury += lh;
}
else
{
p->m_y = -1;
}
if ( parenting )
{
<API key>* p2 = (<API key>*)p;
if ( !p2->m_expanded ||
( (p2->m_flags & wxPG_PROP_HIDEABLE) && hide_state )
)
{
inside_hidden_part = true;
nearest_expanded = parent;
}
parent = p2;
i = 0;
break;
}
i++;
}
}
else
{
while ( i < iMax )
{
wxPGProperty* p = parent->Item(i);
int parenting = p->GetParentingType();
p->m_y = -1;
if ( parenting )
{
parent = (<API key>*)p;
i = 0;
break;
}
i++;
}
}
if ( i >= iMax )
{
i = parent->m_arrIndex + 1;
parent = parent->m_parent;
if ( inside_hidden_part && parent == nearest_expanded )
{
inside_hidden_part = false;
}
}
}
while ( parent != (<API key>*) NULL );
m_bottomy = cury;
#if <API key>
wxLogDebug(wxT(" \\-> m_bottomy = %i"),(int)m_bottomy);
#endif
// Forces a new DoGetBestSize() call.
wxScrolledWindow::InvalidateBestSize();
// Visibles need to be recalculated *always* after y recalculation
// (but make sure it stays here, above <API key>).
CalculateVisibles( -1, true );
<API key>();
// Reselect
if ( prevSelected )
DoSelectProperty( prevSelected, wxPG_SEL_NONVISIBLE );
}
// Call when scroll position changes. Do not pre-fill m_prevVY.
void wxPropertyGrid::CalculateVisibles( int vy, bool full_recalc )
{
if ( vy < 0 )
{
int vx;
GetViewStart(&vx,&vy);
vy *= <API key>;
if ( full_recalc )
m_prevVY = -1;
}
// Control not yet properly built.
if ( vy >= (int)m_bottomy )
return;
if ( m_height < 0 )
return;
// Hide popup
// FIXME: Delete after transient popup support fully added
if ( m_wndPrimary && m_wndPrimary->IsKindOf(CLASSINFO(<API key>)) )
((<API key>*)m_wndPrimary)->HidePopup();
int vy2 = vy + m_height;
if ( vy2 > (int)m_bottomy )
vy2 = m_bottomy;
unsigned int arr_index = 0;
unsigned int vis_height = vy2-vy;
unsigned int new_item_count = vis_height/m_lineHeight;
if ( vis_height % m_lineHeight )
new_item_count++;
wxPGArrayProperty& arr = m_arrVisible;
arr.SetCount ( new_item_count );
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::CalculateVisibles ( vy=%i, vy2=%i, m_height=%i, newitemcount=%i, lineheight=%i )"),
(int)vy, (int)vy2, (int)m_height, (int)new_item_count, (int)m_lineHeight );
#endif
//wxASSERT( vy != m_prevVY );
wxASSERT( vy >= 0 );
if ( !new_item_count )
{
arr.Empty();
return;
}
<API key>
wxPGProperty* base = NULL;
// Will simpler operation be enough?
if ( m_prevVY >= 0 )
{
if ( m_calcVisHeight == m_height )
{
if ( m_iFlags & wxPG_FL_SCROLLED )
{
int diff = vy - m_prevVY;
if ( diff == m_lineHeight )
{
// Scrolled one down
base = DoGetItemAtY_Full( vy2 - 1 );
wxASSERT( base );
arr_index = new_item_count - 1;
for ( i=0; i<arr_index; i++ )
arr.Item(i) = arr.Item(i+1);
arr.Item(arr_index) = base;
base = (wxPGProperty*) NULL;
}
else if ( diff == -m_lineHeight )
{
// Scrolled one up
base = DoGetItemAtY_Full( vy );
wxASSERT( base );
vy2 = vy + m_lineHeight; // update visibility
for ( i=(new_item_count-1); i>arr_index; i
arr.Item(i) = arr.Item(i-1);
arr.Item(arr_index) = base;
base = (wxPGProperty*) NULL;
}
else
base = DoGetItemAtY_Full( vy );
}
else
base = DoGetItemAtY_Full( vy );
}
else
if ( m_prevVY == vy && !(m_iFlags & wxPG_FL_SCROLLED) )
{
if ( m_height > m_calcVisHeight )
{
// Increased height - add missing items
arr_index = (m_calcVisHeight-1)/m_lineHeight;
if ( arr_index >= new_item_count )
{
// Now, were probably below last item here
//if ( (vy+m_calcVisHeight) >= (int)m_bottomy )
base = NULL;
/*else
arr_index = arr.GetCount()-1;*/
}
else
{
base = (wxPGProperty*) arr.Item( arr_index );
}
}
else
{
// Decreased height - do nothing
//base = NULL;
}
}
else
base = DoGetItemAtY_Full( vy );
}
else
{
base = DoGetItemAtY_Full( vy );
}
if ( base )
{
ITEM_ITERATION_INIT(base->m_parent,base->m_arrIndex)
#if <API key>
wxLogDebug( wxT(" Starting at index %i"), (int)arr_index );
#endif
<API key>
//wxASSERT( p->m_y >= 0 );
// update visibility limit reached?
if ( p->m_y >= vy2 ) { parent = NULL; break; }
#ifdef __WXDEBUG__
if ( arr_index >= arr.GetCount() )
{
wxLogDebug(wxT(" wxPropertyGrid::CalculateVisibles Loop overflow (index=%i,vy+vis_height=%i,p->m_y=%i)"),
(int)arr_index,(int)(vy+vis_height),(int)p->m_y);
}
#endif
arr.Item(arr_index) = (void*)p;
arr_index++;
<API key>
}
// Adjust controls
/*if ( m_selected )
{
int adjust = prevVY - vy;
if ( adjust )
{
wxPoint cp(0,adjust);
if ( m_wndPrimary )
m_wndPrimary->Move ( m_wndPrimary->GetPosition() + cp );
if ( m_wndSecondary )
m_wndSecondary->Move ( m_wndSecondary->GetPosition() + cp );
}
}*/
m_iFlags &= ~(wxPG_FL_SCROLLED);
m_prevVY = vy;
m_calcVisHeight = m_height;
}
// This version uses the visible item cache.
wxPGProperty* wxPropertyGrid::DoGetItemAtY( int y )
{
//wxASSERT( m_prevVY >= 0 );
// Outside(check 1)?
if ( y >= (int)m_bottomy || y < 0 )
{
/*
#if __PAINT_DEBUGGING__
wxLogDebug(wxT("WARNING: DoGetItemAtY(a): y = %i"),y);
#endif
*/
return (wxPGProperty*) NULL;
}
int vx, vy;
GetViewStart(&vx,&vy);
vy*=<API key>;
// Need to recalculate visibility cache
// Note: need to check for y < m_prevVY is a hack.
if ( m_prevVY != vy ||y < m_prevVY ) //m_iFlags & wxPG_FL_SCROLLED ||
CalculateVisibles( vy, true );
// Outside(check 2)?
if ( y >= (vy+m_height) )
{
/*
#if __PAINT_DEBUGGING__
wxLogDebug(wxT("WARNING: DoGetItemAtY(b): y = %i"),y);
#endif
*/
return (wxPGProperty*) NULL;
}
unsigned int index = (unsigned int)((y - vy) / m_lineHeight);
// Consistency checks
if ( !m_arrVisible.GetCount() )
return (wxPGProperty*) NULL;
if ( index >= m_arrVisible.GetCount() )
{
#ifdef __WXDEBUG__
wxLogDebug(wxT(" index = %i"),(int)index);
wxLogDebug(wxT(" (height/lineheight+1) = %i"),(int)((m_height/m_lineHeight)+1));
wxLogDebug(wxT(" m_arrVisible.GetCount() = %i"),(int)m_arrVisible.GetCount());
// This was wxCHECK_MSG, but I don't want it to show, since it can happen from
// time to time, and I probably won't fix in the current version of wxPropertyGrid.
wxLogDebug( wxT("Not enough entries in m_arrVisible (y was < m_bottomy).") );
#endif
return (wxPGProperty*) NULL;
}
if ( index >= m_arrVisible.GetCount() )
{
index = m_arrVisible.GetCount()-1;
}
return (wxPGProperty*)m_arrVisible.Item(index);
}
// wxPropertyGrid graphics related methods
void wxPropertyGrid::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxPG_PAINT_DC_INIT()
// Don't paint after destruction has begun
if ( !(m_iFlags & wxPG_FL_INITIALIZED) )
return;
#if __PAINT_DEBUGGING__
wxLogDebug( wxT("wxPropertyGrid::OnPaint()") );
#endif
// Find out where the window is scrolled to
int vx,vy; // Top left corner of client
GetViewStart(&vx,&vy);
vy *= <API key>;
// Update everything inside the box
wxRect r = GetUpdateRegion().GetBox();
r.y += vy;
// Repaint this rectangle
//if ( r.height > 0 )
DrawItems ( dc, r.y, r.y + r.height,
#if wxPG_ALLOW_CLIPPING
NULL
#else
NULL
#endif
);
// We assume that the size set when grid is shown
// is what is desired.
m_iFlags |= <API key>;
}
// This is the one called by OnPaint event handler and others.
// topy and bottomy are already unscrolled
// Clears any area in coordinates that doesn't have items.
void wxPropertyGrid::DrawItems( wxDC& dc,
unsigned int topy,
unsigned int bottomy,
const wxRect* clipRect )
{
if ( m_frozen || m_height < 1 || bottomy < topy || !m_pState ) return;
#if __PAINT_DEBUGGING__
wxLogDebug(wxT("wxPropertyGrid::DrawItems ( %i -> %i, clipRect = 0x%X )"),topy,bottomy,
(unsigned int)clipRect);
#endif
// items added check
if ( FROM_STATE(m_itemsAdded) ) <API key>();
unsigned int vx, vy; // Top left corner of client
GetViewStart((int*)&vx,(int*)&vy);
vy *= <API key>;
unsigned int client_bottom = (unsigned int)m_height + vy;
// Clip topy and bottomy
if ( bottomy > client_bottom )
bottomy = client_bottom;
if ( topy < vy )
topy = vy;
#if __PAINT_DEBUGGING__
wxLogDebug(wxT(" \\--> ( final area %i -> %i )"),topy,bottomy);
#endif
// Determine first and last item to draw
// (don't draw if already over the top)
if ( topy < client_bottom && topy < m_bottomy && FROM_STATE(m_properties)->GetCount() > 0 )
{
wxPGProperty* firstItem = DoGetItemAtY(topy);
if ( firstItem == (wxPGProperty*) NULL )
{
#ifdef __WXDEBUG__
wxString msg;
msg.Printf(wxT("WARNING: wxPropertyGrid::DrawItems(): firstItem == NULL!"));
wxMessageBox(msg);
wxLogDebug(msg);
wxLogDebug(wxT(" More info: y: %i -> %i visible_window: %i -> %i"),
(int)topy,(int)bottomy,(int)vy,(int)client_bottom);
// This is here for debugging purposes.
DoGetItemAtY(topy);
#endif
return;
}
wxPGProperty* lastItem = (wxPGProperty*) NULL;
// lastItem may be NULL on call to DoDrawItems
// in this case lastItem will truly become the last item
if ( bottomy > topy && bottomy < m_bottomy )
{
lastItem = DoGetItemAtY(bottomy-1);
#if __PAINT_DEBUGGING__
wxLogDebug( wxT(" \\--> WARNING: lastItem acquisition failed (should not)!"));
#endif
}
DoDrawItems( dc, firstItem, lastItem, clipRect );
}
// Clear area beyond m_bottomy?
if ( bottomy > m_bottomy )
{
wxColour& bgc = <API key>;
//wxColour& bgc = wxColour(255,0,255);
dc.SetPen ( wxPen(bgc) );
dc.SetBrush ( wxBrush(bgc) );
unsigned int clear_top = m_bottomy;
if ( topy > clear_top ) clear_top = topy;
dc.DrawRectangle ( 0, clear_top, m_width, m_height-(clear_top-vy) );
}
}
#define <API key> \
unsigned int ind; \
wxPGProperty* p;
// UVC = Use Visibility Cache
// VISTART = index to first item from visibility cache to use.
// BOTTOMY = Logical y coordinate of last item to draw.
#define <API key>(VISTART,BOTTOMY) \
ind = VISTART; \
do \
{ \
p = (wxPGProperty*)m_arrVisible.Item(ind); \
ind++; \
int parenting = p->GetParentingType();
#define <API key>(BOTTOMY) \
} while ( p->m_y < BOTTOMY ); \
void wxPropertyGrid::DoDrawItems( wxDC& dcMain,
const wxPGProperty* firstItem,
const wxPGProperty* lastItem,
const wxRect* clipRect )
{
if ( m_frozen || m_height < 1 )
return;
//wxCHECK_RET( !FROM_STATE(m_itemsAdded), wxT("m_itemsAdded must be zero at this point") );
// items added check
if ( FROM_STATE(m_itemsAdded) ) <API key>();
wxCHECK_RET( firstItem != NULL, wxT("invalid first item") );
wxASSERT( FROM_STATE(m_properties->GetCount()) );
// Make sure visibility cache is up-to-date
int vy;
int vx;
GetViewStart(&vx,&vy);
vy*=<API key>;
if ( vy != m_prevVY )
CalculateVisibles(vy,true);
if ( vy != m_prevVY )
return;
// Determine last item, if not given (but requires clipRect).
if ( lastItem == NULL )
{
if ( clipRect != NULL )
{
unsigned int bottomy = clipRect->y + clipRect->height;
if ( bottomy <= (unsigned int)firstItem->m_y )
lastItem = firstItem;
}
if ( lastItem == NULL )
{
lastItem = DoGetItemAtY(vy+m_height-1);
if ( lastItem == NULL )
lastItem = GetLastItem(true);
}
}
DoDrawItems2(dcMain, firstItem, lastItem, clipRect);
}
// Uses three pass approach, so it is optimized for drawing
// multiple items at once.
// IMPORTANT NOTES:
// - Clipping rectangle must be of physical coordinates.
void wxPropertyGrid::DoDrawItems2( wxDC& dcMain,
const wxPGProperty* firstItem,
const wxPGProperty* lastItem,
const wxRect* clipRect ) const
{
int lh = m_lineHeight;
int vy;
int vx;
GetViewStart(&vx,&vy);
vy*=<API key>;
int firstItemTopY = firstItem->m_y;
int lastItemBottomY = lastItem->m_y+lh-1;
int yRelMod = 0;
// Entire range outside scrolled, visible area?
if ( firstItemTopY >= (vy+m_height) || lastItemBottomY <= vy )
return;
wxCHECK_RET( firstItemTopY < lastItemBottomY, wxT("invalid y values") );
wxDC* dcPtr;
#if wxPG_DOUBLE_BUFFER
wxMemoryDC* bufferDC = NULL;
const wxRect* blitClipRect = NULL;
int renderHeight = lastItem->m_y - firstItemTopY + m_lineHeight;
if ( !(GetExtraStyle() & <API key>) )
{
if ( !m_doubleBuffer )
return;
// Must fit to double-buffer
#ifdef __WXDEBUG__
if ( (lastItemBottomY - firstItemTopY) > m_doubleBuffer->GetHeight() )
{
wxString msg;
msg.Printf( wxT("wxPropertyGrid: DOUBLE-BUFFER TOO SMALL ( drawn %i vs db height %i vs client_height %i)!"),
(int)(lastItemBottomY - firstItemTopY),
(int)(m_doubleBuffer->GetHeight()),
(int)m_height );
wxLogError(msg);
wxLogDebug(msg);
}
#endif
bufferDC = new wxMemoryDC();
bufferDC->SelectObject( *m_doubleBuffer );
dcPtr = bufferDC;
blitClipRect = clipRect;
//if ( m_iFlags & wxPG_FL_CHANGED ||
// !(m_iFlags & <API key>) )
}
else
#endif
{
dcPtr = &dcMain;
}
wxDC& dc = *dcPtr;
#if __PAINT_DEBUGGING__
wxLogDebug(wxT(" -> DoDrawItems ( \"%s\" -> \"%s\", height=%i (ch=%i), clipRect = 0x%lX )"),
firstItem->GetLabel().c_str(),
lastItem->GetLabel().c_str(),
(int)(lastItemBottomY - firstItemTopY),
(int)m_height,
(unsigned long)clipRect );
#endif
wxPGPaintData paintdata;
wxRect r;
<API key>
// Get first and last indexes to visibility cache
unsigned int viStart = (firstItemTopY - vy) / lh;
int vi_end_y = lastItem->m_y;
if ( viStart >= m_arrVisible.GetCount() )
{
wxLogDebug(wxT("WARNING: viStart >= m_arrVisible.GetCount() ( %i >= %i )"),
(int)viStart, (int)m_arrVisible.GetCount() );
return;
}
#ifdef __WXDEBUG__
unsigned int viEnd = (lastItem->m_y - vy) / lh;
if ( viEnd >= m_arrVisible.GetCount() )
{
wxLogDebug(wxT("WARNING: viEnd >= m_arrVisible.GetCount() ( %i >= %i )"),
(int)viEnd, (int)m_arrVisible.GetCount() );
return;
}
#endif
int x = m_marginWidth;
int y;
long window_style = m_windowStyle;
int extraStyle = GetExtraStyle();
// With wxPG_DOUBLE_BUFFER, do double buffering
// - buffer's y = 0, so align cliprect and coordinates to that
#if wxPG_DOUBLE_BUFFER
if ( bufferDC )
{
wxRect cr2;
//yRelMod = firstItemTopY;
yRelMod = vy;
// clipRect conversion
if ( clipRect )
{
cr2 = *clipRect;
cr2.y -= yRelMod;
clipRect = &cr2;
}
//int renderHeight = lastItem->m_y - firstItemTopY + m_lineHeight;
//lastItemBottomY -= firstItemTopY;
//firstItemTopY = 0;
firstItemTopY -= vy;
lastItemBottomY -= vy;
}
#endif
const wxFont& normalfont = m_font;
bool reallyFocused = (m_iFlags & wxPG_FL_FOCUSED) ? true : false;
bool isEnabled = IsEnabled();
// Prepare some pens and brushes that are often changed to.
wxBrush marginBrush(m_colMargin);
wxPen marginPen(m_colMargin);
wxBrush capbgbrush(m_colCapBack,wxSOLID);
wxPen linepen(m_colLine,1,wxSOLID);
// pen that has same colour as text
wxPen outlinepen(m_colPropFore,1,wxSOLID);
if ( clipRect )
dc.SetClippingRegion( *clipRect );
// Clear margin with background colour
dc.SetBrush( marginBrush );
if ( !(window_style & wxPG_HIDE_MARGIN) )
{
dc.SetPen( *wxTRANSPARENT_PEN );
dc.DrawRectangle(-1,firstItemTopY-1,m_marginWidth+2,<API key>+3);
}
/*
// This colorizer helps to debug painting.
bool small_draw = false;
if ( renderHeight < (m_height-(lh*3)) )
{
if ( firstItem == lastItem )
{
bgbrush = wxBrush(wxColour(255,128,128));
linepen = wxPen(wxColour(128,0,255));
//boxbrush = wxBrush(wxColour(192,192,192));
}
else
{
bgbrush = wxBrush(wxColour(128,255,128));
linepen = wxPen(wxColour(0,0,255));
//boxbrush = wxBrush(wxColour(230,230,230));
}
small_draw = true;
}
*/
//dc.SetPen ( *wxTRANSPARENT_PEN );
//dc.SetFont(normalfont);
wxPGProperty* selected = m_selected;
/*#if <API key>
bool selected_painted = false;
#endif*/
// NOTE: Clipping and pen/brush switching are main reasons for multi-pass approach.
// zero'th pass: Wireframes.
// (this could be embedded in another loop)
dc.SetBrush( marginBrush );
unsigned long cur_first_ind = viStart;
unsigned long next_cur_first_ind = 0xFFFFFFFF;
<API key>* cur_category = (<API key>*) NULL;
int vcache_last_item_y = vy + m_height;
if ( vcache_last_item_y > (int)m_bottomy ) vcache_last_item_y = m_bottomy;
vcache_last_item_y -= lh;
<API key>(viStart,vi_end_y)
<API key>* parent = p->GetParent();
// Should not happen (but this is better than a crash)...
wxCHECK_RET( parent, wxT("NULL parent") );
// Does this wireframe end?
// Conditions:
// A) This is last item within its parent, and parent is category.
// B) Next is category.
// C) This is collapsed category.
// D) This is the last item drawn.
if ( p->m_y >= vi_end_y )
{
// This is the last item.
//wxLogDebug(wxT("--> last item"));
next_cur_first_ind = ind;
}
else if ( p->m_arrIndex >= (parent->GetCount()-1) && parent->GetParentingType() >= PT_CAPTION &&
( parenting <= 0 /*|| ((<API key>*)p)->GetCount() < 1*/ )
)
{
// This is last item within its parent, and parent is category, but this isn't
// an non-empty category.
//wxLogDebug(wxT("--> category ends"));
cur_category = (<API key>*)parent;
next_cur_first_ind = ind;
}
else if ( ((wxPGProperty*)m_arrVisible.Item(ind))->GetParentingType() >= PT_CAPTION )
{
// Next item is a category.
//wxLogDebug(wxT("--> next item is category"));
next_cur_first_ind = ind;
}
else if ( parenting > 0 &&
(!((<API key>*)p)->IsExpanded() ||
!((<API key>*)p)->GetCount()) )
{
// This is collapsed category.
//wxLogDebug(wxT("--> collapsed category"));
cur_category = (<API key>*)p;
next_cur_first_ind = ind;
}
// When new category begins or old ends, draw wireframe for items in-between
if ( next_cur_first_ind < 0xFFFFFF )
{
wxPGProperty* cur_first = (wxPGProperty*)m_arrVisible.Item(cur_first_ind);
<API key>* cur_last_item = (<API key>*)p;
if ( !cur_category )
{
if ( cur_first->GetParentingType() >= PT_CAPTION )
{
cur_category = (<API key>*)cur_first;
}
else if ( !(m_windowStyle & <API key>) )
{
cur_category = <API key>(cur_first);
/*if ( !cur_category )
cur_category = (<API key>*)FROM_STATE(m_properties);*/
}
}
int draw_top = cur_first->m_y - yRelMod;
int draw_bottom = cur_last_item->m_y + lh - yRelMod;
int frame_top = draw_top;
int frame_bottom = draw_bottom;
int margin_top = draw_top;
int margin_bottom = draw_bottom;
int ly = frame_top + lh - 1;
if ( cur_first->GetParentingType() >= PT_CAPTION )
{
<API key>* pc = ((<API key>*)cur_first);
frame_top += lh;
if ( !pc->IsExpanded() )
{
// Category collapsed.
frame_top = frame_bottom + 1;
}
}
int grey_x = x;
if ( cur_category /*!(window_style & <API key>)*/ )
grey_x += ((unsigned int)((cur_category->GetDepth()-1)*<API key>));
//wxLogDebug( wxT("wireframe: %s -> %s (grey_x:%i)"), cur_first->GetLabel().c_str(),
// cur_last_item->GetLabel().c_str(),((int)grey_x-x));
dc.SetPen( *wxTRANSPARENT_PEN );
// Clear extra margin area.
dc.DrawRectangle( x-1, margin_top, grey_x - x + 1, <API key> );
dc.SetPen( linepen );
if ( frame_bottom > frame_top )
{
//if ( cat_top < firstItemTopY )
// cat_top = firstItemTopY;
// Margin Edge
dc.DrawLine ( grey_x, frame_top, grey_x, frame_bottom );
// Splitter
dc.DrawLine ( m_splitterx, frame_top, m_splitterx, frame_bottom );
// Horizontal Lines
while ( ly < (frame_bottom-1) )
{
dc.DrawLine ( grey_x, ly, m_width, ly );
ly += lh;
}
}
int use_depth = grey_x; // Default is to simply tidy up this wireframe.
// Properly draw top line of next wireframe, if adjacent.
// Get next item.
wxPGProperty* next_item;
//if ( ind < m_arrVisible.GetCount() )
if ( cur_last_item->m_y < vcache_last_item_y )
{
next_item = (wxPGProperty*)m_arrVisible.Item(ind);
}
else
{
// Was not in visibility cache, so use clumsier method.
next_item = GetNeighbourItem(cur_last_item,true,1);
if (!next_item)
next_item = cur_last_item; // This will serve our purpose.
}
//wxLogDebug(wxT("next_item: %s"),next_item->GetLabel().c_str());
// Just take the depth and is-it-category out of it.
int next_parenting = next_item->GetParentingType();
int last_parenting = cur_last_item->GetParentingType();
// A) If both are categories, draw line with background colour.
// B) If only next is category, use its category's depth.
// C) If only last is category, use grey_x as depth.
// D) If neither is a category, use smaller.
if ( next_parenting > 0 )
{
// Next is category.
if ( last_parenting > 0 )
{
// Last is a category too - draw complete line with background colour.
dc.SetPen ( marginPen );
use_depth = x;
}
}
else
{
// Next is not a category.
<API key>* next_cat = <API key>(next_item);
int depth_next = x;
if ( next_cat && /*cur_category*/ !(window_style & <API key>) )
{
//wxLogDebug(wxT("next_item_cat: %s"),next_cat->GetLabel().c_str());
depth_next += ((unsigned int)((next_cat->GetDepth()-1)*<API key>));
}
if ( last_parenting <= 0 )
{
// Last is not a category - use lesser depth
if ( depth_next < grey_x )
use_depth = depth_next;
//wxLogDebug(wxT("- neither is category"));
}
else
{
// Last is a category
use_depth = depth_next;
//wxLogDebug(wxT("last only is category"));
}
}
//wxLogDebug(wxT("last_line_use_depth: %i"),(int)use_depth);
dc.DrawLine( use_depth, ly, m_width, ly );
cur_first_ind = next_cur_first_ind;
next_cur_first_ind = 0xFFFFFFFF;
//cur_first = (<API key>*)p;
cur_category = (<API key>*) NULL;
}
//cur_last_item = p;
<API key>(vi_end_y)
// First pass: Category background and text, Images, Label+value background.
//wxLogDebug(wxT(" \\--> first pass..."));
y = firstItemTopY;
dc.SetFont( m_captionFont );
dc.SetPen( *wxTRANSPARENT_PEN );
<API key>(viStart,vi_end_y)
y += m_spacingy;
int text_x = x + ((unsigned int)((p->GetDepth()-1)*<API key>));
if ( parenting > 0 )
{
dc.SetBrush( capbgbrush ); // Category label background colour.
// Category - draw background, text and possibly selection rectangle.
<API key>* pc = (<API key>*)p;
// Note how next separator line is overdrawn if next item is category .
int useLh = lh;
if ( ind < (m_arrVisible.GetCount()) &&
( ((wxPGProperty*)m_arrVisible[ind])->GetParentingType() <= 0 ) )
useLh -= 1;
if ( isEnabled && p->IsEnabled() )
dc.SetTextForeground( *(wxPGColour*)m_arrFgCols[pc->GetTextColIndex()] );
else
dc.SetTextForeground( m_colDisPropFore );
dc.DrawRectangle( text_x, y-m_spacingy, m_width-text_x, useLh );
dc.DrawText( pc->GetLabel(), text_x+wxPG_XBEFORETEXT, y );
// active caption gets nice dotted rectangle
if ( p == selected )
{
wxRect focusRect(text_x+<API key>,
<API key>,
pc->GetTextExtent()+(wxPG_CAPRECTXMARGIN*2),
m_fontHeight+(wxPG_CAPRECTYMARGIN*2));
wxPGDrawFocusRect(dc,focusRect);
dc.SetPen( *wxTRANSPARENT_PEN );
}
}
else
{
// Basic background colour.
dc.SetBrush( *(wxPGBrush*)m_arrBgBrushes[p->m_bgColIndex] );
//wxLogDebug(wxT("%s: %i"),p->m_label.c_str(),(int)p->m_depthBgCol);
int greyDepth = 0;
if ( !(window_style & <API key>) )
greyDepth = (((int)p->m_depthBgCol)-1) * <API key>;
// In two parts to retain splitter
if ( p == m_selected )
{
// Selected get different label background.
if ( reallyFocused )
dc.SetBrush( m_colSelBack );
else
dc.SetBrush( m_colLine );
dc.DrawRectangle( x+greyDepth+1, y-m_spacingy, <API key>, lh-1 );
}
else
{
dc.DrawRectangle( x+greyDepth+1, y-m_spacingy, <API key>, lh-1 );
}
dc.DrawRectangle( m_splitterx+1, y-m_spacingy, m_width-m_splitterx, lh-1 );
}
y += m_fontHeight+m_spacingy+1;
<API key>(vi_end_y)
dc.SetFont( normalfont );
// Second pass: Expander Buttons, Labels.
// Second pass happens entirely on the left side, so sometimes
// we can just skip it.
if ( clipRect == NULL || clipRect->x < m_splitterx )
{
//wxLogDebug(wxT(" \\--> second pass..."));
y = firstItemTopY;
r = wxRect(0,y,m_splitterx,lastItemBottomY);
dc.SetClippingRegion ( r );
dc.SetFont(normalfont);
<API key>(viStart,vi_end_y)
if ( isEnabled && (p->IsEnabled() || !(extraStyle & <API key>)) )
dc.SetTextForeground( *(wxPGColour*)m_arrFgCols[p->m_fgColIndex] );
else
dc.SetTextForeground( m_colDisPropFore );
// Expand/collapse button image.
if ( parenting != 0 &&
!(window_style & wxPG_HIDE_MARGIN) &&
((<API key>*)p)->GetChildCount() )
{
<API key>* pwc = (<API key>*)p;
int depth = p->m_depth - 1;
#ifdef wxPG_ICON_WIDTH
int imageX = m_gutterWidth + ( depth * <API key> );
#endif
y += m_buttonSpacingY;
#if (<API key>)
// Prepare rectangle to be used
r.x = imageX; r.y = y;
r.width = m_iconWidth; r.height = m_iconHeight;
#elif wxPG_ICON_WIDTH
// Drawing expand/collapse button manually
dc.SetPen(m_colPropFore);
if ( parenting > 0 )
{
dc.SetBrush(*wxTRANSPARENT_BRUSH);
}
else
{
dc.SetBrush(m_colPropBack);
}
dc.DrawRectangle( imageX, y, m_iconWidth, m_iconWidth );
int _y = y+(m_iconWidth/2);
dc.DrawLine(imageX+2,_y,imageX+m_iconWidth-2,_y);
#else
wxBitmap* bmp;
#endif
if ( pwc->m_expanded )
{
// wxRenderer functions are non-mutating in nature, so it
// should be safe to cast "const wxPropertyGrid*" to "wxWindow*".
// Hopefully this does not cause problems.
#if (<API key>)
wxRendererNative::Get().DrawTreeItemButton(
(wxWindow*)this,
dc,
r,
wxCONTROL_EXPANDED
);
#elif wxPG_ICON_WIDTH
#else
bmp = m_collbmp;
#endif
}
else
{
#if (<API key>)
wxRendererNative::Get().DrawTreeItemButton(
(wxWindow*)this,
dc,
r,
0
);
#elif wxPG_ICON_WIDTH
int _x = imageX+(m_iconWidth/2);
dc.DrawLine(_x,y+2,_x,y+m_iconWidth-2);
#else
bmp = m_expandbmp;
#endif
}
#if (<API key>)
#elif wxPG_ICON_WIDTH
#else
dc.DrawBitmap( *bmp, m_gutterWidth, y, true );
#endif
y -= m_buttonSpacingY;
}
y += m_spacingy;
if ( parenting <= 0 )
{
// Non-categories.
int text_x = x;
// Use basic depth if in non-categoric mode and parent is base array.
if ( !(window_style & <API key>) || p->GetParent() != FROM_STATE(m_properties) )
{
text_x += ((unsigned int)((p->m_depth-1)*<API key>));
}
/*
else
{
wxLogDebug( wxT("%s"), p->GetLabel().c_str() );
text_x = x;
}
*/
if ( p != selected )
{
dc.DrawText( p->m_label, text_x+wxPG_XBEFORETEXT, y );
}
else
{
// Selected gets different colour.
if ( reallyFocused )
dc.SetTextForeground( m_colSelFore );
dc.DrawText( p->m_label, text_x+wxPG_XBEFORETEXT, y );
}
}
else
{
/*// switch background colour
bgbrush.SetColour ( ((<API key>*)p)->m_colCellBg );
dc.SetBrush ( bgbrush );*/
}
y += m_fontHeight+m_spacingy+1;
<API key>(vi_end_y)
}
// Third pass: Values
dc.<API key>();
if ( clipRect )
{
// third pass happens entirely on the right side, so sometimes
// we can just skip it
if ( (clipRect->x + clipRect->width) < m_splitterx )
x = -1;
dc.SetClippingRegion ( *clipRect );
}
// This used with value drawer method.
wxRect valueRect(0,0,
m_width-(m_splitterx+wxPG_CONTROL_MARGIN),
m_fontHeight);
wxSize imageSize;
if ( x != -1 )
{
r.x = m_splitterx+1+wxPG_CONTROL_MARGIN;
r.width = <API key>;
//r.x = m_splitterx+<API key>;
//r.width = <API key>;
r.height = lh-1;
/*#if <API key>
const int vy2 = vy;
#endif*/
//wxLogDebug(wxT(" \\--> third pass..."));
// Altough this line may seem unnecessary, it isn't
dc.SetFont(normalfont);
dc.SetPen( *wxTRANSPARENT_PEN );
// Prepare paintdata.
paintdata.m_parent = this;
paintdata.m_choiceItem = -1; // Not drawing list item at this time.
y = firstItemTopY;
<API key>(viStart,vi_end_y)
if ( parenting <= 0 )
{
r.y = y;
y += m_spacingy;
// background
dc.SetBrush( *(wxPGBrush*)m_arrBgBrushes[p->m_bgColIndex] );
if ( isEnabled && p->IsEnabled() )
dc.SetTextForeground( *(wxPGColour*)m_arrFgCols[p->m_fgColIndex] );
else
dc.SetTextForeground( m_colDisPropFore );
// draw value string only if editor widget not open
// (exception: no primary editor widget or it is hidden)
if ( p != selected || !m_wndPrimary
// "if not primary shown" is required because
// primary is not usually shown during splitter
// movement.
|| m_dragStatus > 0
)
{
valueRect.x = m_splitterx+wxPG_CONTROL_MARGIN;
valueRect.y = y;
// Draw background
if ( p != selected )
{
dc.DrawRectangle( r );
}
else
{
if ( m_wndPrimary )
dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
else
dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
dc.DrawRectangle( r );
}
// Set bold font?
if ( p->m_flags & wxPG_PROP_MODIFIED && (window_style & wxPG_BOLD_MODIFIED) )
dc.SetFont( m_captionFont );
const wxPGEditor* editor = p->GetEditorClass();
bool fullPaint = false;
if ( p->m_flags & <API key> )
{
imageSize = p->GetImageSize();
wxRect imageRect(r.x + wxPG_CONTROL_MARGIN + <API key>,
r.y+<API key>,
<API key>,
r.height-(<API key>*2));
if ( imageSize.x == <API key> )
{
fullPaint = true;
imageRect.width = m_width - imageRect.x;
}
dc.SetPen( outlinepen );
paintdata.m_drawnWidth = imageRect.width;
if ( !(p->m_flags & <API key>) )
{
p->OnCustomPaint( dc, imageRect, paintdata );
}
else
{
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(imageRect);
}
dc.SetPen( *wxTRANSPARENT_PEN );
}
else
paintdata.m_drawnWidth = 0;
if ( paintdata.m_drawnWidth > 0 )
valueRect.x += paintdata.m_drawnWidth + <API key> + <API key>;
else
fullPaint = false;
if ( !fullPaint )
editor->DrawValue(dc,p,valueRect);
// Return original font?
if ( p->m_flags & wxPG_PROP_MODIFIED && (window_style & wxPG_BOLD_MODIFIED) )
dc.SetFont(normalfont);
}
else
{
if ( !(m_iFlags & <API key>) ||
m_iFlags & <API key> )
{
//wxLogDebug(wxT("Primary doesn't fill entire"));
dc.SetBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
dc.DrawRectangle( r );
}
if ( m_iFlags & <API key> )
{
wxRect imagerect(r.x + wxPG_CONTROL_MARGIN + <API key>,
r.y+<API key>,<API key>,
r.height-(<API key>*2));
dc.SetPen ( outlinepen );
if ( !(p->m_flags & <API key>) )
{
p->OnCustomPaint( dc, imagerect, paintdata );
}
else
{
dc.SetBrush(*wxWHITE_BRUSH);
dc.DrawRectangle(imagerect);
}
}
dc.SetPen( *wxTRANSPARENT_PEN );
}
y += m_fontHeight+m_spacingy + 1;
}
else
{
// caption item
y += lh;
}
//if ( y > lastItemBottomY ) { parent = NULL; break; }
<API key>(vi_end_y)
}
dc.<API key>(); // Is this really necessary?
#if wxPG_DOUBLE_BUFFER
//else wxLogDebug(wxT("Used Cache"));
if ( bufferDC )
{
if ( blitClipRect )
dcMain.SetClippingRegion( *blitClipRect );
//wxLogDebug(wxT(" \\--> (0,%i)"),(int)final_y);
dcMain.Blit ( 0, firstItem->m_y, m_width, renderHeight,
&dc, 0, firstItem->m_y-vy, wxCOPY );
//dcMain.Blit ( 0, 0, m_width, m_height,
// &dc, 0, 0, wxCOPY );
dcMain.<API key>(); // Is this really necessary?
delete bufferDC;
}
#endif
#if __PAINT_DEBUGGING__
wxLogDebug(wxT(" \\--> ends..."));
#endif
}
wxRect wxPropertyGrid::GetPropertyRect( const wxPGProperty* p1, const wxPGProperty* p2 ) const
{
wxRect r;
if ( m_width < 10 || m_height < 10 ||
!FROM_STATE(m_properties)->GetCount() ||
p1 == (wxPGProperty*) NULL )
return wxRect(0,0,0,0);
int vx,vy;
GetViewStart(&vx,&vy);
vy*=<API key>;
// Return rect which encloses the given property range
int visTop = p1->m_y;
int visBottom = m_bottomy;
if ( p2 )
visBottom = p2->m_y + m_lineHeight;
// If seleced property is inside the range, we'll extend the range to include
// control's size.
wxPGProperty* selected = m_selected;
if ( selected && selected->m_y >= visTop && selected->m_y < visBottom )
{
wxWindow* editor = GetEditorControl();
if ( editor )
{
int visBottom2 = selected->m_y + editor->GetSize().y;
if ( visBottom2 > visBottom )
visBottom = visBottom2;
}
}
return wxRect(0,visTop-vy,m_width,visBottom-visTop);
}
void wxPropertyGrid::DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 )
{
if ( m_frozen )
return;
if ( FROM_STATE(m_itemsAdded) )
<API key>();
wxRect r = GetPropertyRect(p1, p2);
if ( r.width > 0 )
RefreshRect(r);
}
// In addition to calling DoDrawItems directly, this is the
// only alternative for using wxClientDC - others just call
// RefreshRect.
void wxPropertyGrid::DrawItem( wxDC& dc, wxPGProperty* p )
{
wxCHECK_RET( p, wxT("invalid property id") );
// do not draw a single item if multiple pending
if ( FROM_STATE(m_itemsAdded) )
return;
if ( p->m_y < 0 )
return;
#if __PAINT_DEBUGGING__
wxLogDebug(wxT("wxPropertyGrid::DrawItem( %s )"), p->GetLabel().c_str() );
#endif
DoDrawItems( dc, p, p, NULL );
}
void wxPropertyGrid::RefreshProperty( wxPGProperty* p )
{
if ( p == m_selected )
DoSelectProperty(p, wxPG_SEL_FORCE);
DrawItemAndChildren(p);
}
void wxPropertyGrid::<API key>( wxPGProperty* p )
{
if ( m_frozen )
return;
// Draw item, children, and parent too, if it is not category
wxPGProperty* parent = p->GetParent();
while ( parent &&
parent->GetParentingType() < PT_NONE )
{
DrawItem(parent);
parent = parent->GetParent();
}
DrawItemAndChildren(p);
}
void wxPropertyGrid::DrawItemAndChildren( wxPGProperty* p )
{
wxCHECK_RET( p, wxT("invalid property id") );
// Do not draw if in non-visible page
if ( p->GetParentState() != m_pState )
return;
// do not draw a single item if multiple pending
if ( FROM_STATE(m_itemsAdded) || p->m_y < 0 || m_frozen )
return;
#if __PAINT_DEBUGGING__
wxLogDebug(wxT("wxPropertyGrid::DrawItemAndChildren( %s )"), p->GetLabel().c_str() );
#endif
// Update child control.
if ( m_selected && m_selected->GetParent() == p )
m_selected->UpdateControl(m_wndPrimary);
const wxPGProperty* lastDrawn = p-><API key>();
DrawItems(p, lastDrawn);
}
void wxPropertyGrid::Refresh( bool WXUNUSED(eraseBackground),
const wxRect *rect )
{
// Refresh implies forced redraw
//m_iFlags |= wxPG_FL_CHANGED;
wxWindow::Refresh(false,rect);
#if <API key>
// I think this really helps only GTK+1.2
if ( m_wndPrimary ) m_wndPrimary->Refresh();
if ( m_wndSecondary ) m_wndSecondary->Refresh();
#endif
}
/*
void wxPropertyGrid::RedrawAllVisible ()
{
// TODO: Is this safe?
//Update();
if ( m_frozen || !IsShown() )
return;
wxPG_CLIENT_DC_INIT()
#if __PAINT_DEBUGGING__
wxLogDebug( wxT("wxPropertyGrid::RedrawAllVisible()") );
#endif
int vx,vy; // Top left corner of client
GetViewStart(&vx,&vy);
vy *= <API key>;
int y1 = vy;
int y2 = y1 + m_height;
// Repaint this rectangle
DrawItems ( dc, y1, y2, (wxRect*) NULL );
}
*/
#if wxPG_HEAVY_GFX
void wxPropertyGrid::<API key>( wxDC&, int ) { }
#else
void wxPropertyGrid::<API key>( wxDC& dc, int x )
{
int vx, vy;
GetViewStart(&vx,&vy);
vy *= <API key>;
dc.SetLogicalTool(wxINVERT);
dc.<API key>();
dc.SetPen( m_splitterpen );
dc.DrawLine(x,vy,x,vy+m_height);
}
#endif
// wxPropertyGrid global operations
void wxPropertyGrid::Clear()
{
if ( m_selected )
{
bool selRes = DoSelectProperty(wxPGIdGen(NULL), wxPG_SEL_DELETING); // This must be before state clear
wxPG_CHECK_RET_DBG( selRes,
wxT("failed to deselect a property (editor probably had invalid value)") );
}
FROM_STATE(Clear());
m_propHover = NULL;
m_bottomy = 0;
m_prevVY = 0;
m_arrVisible.Empty();
<API key>();
// Need to clear some area at the end
if ( !m_frozen )
RefreshRect(wxRect(0, 0, m_width, m_height));
}
bool wxPropertyGrid::EnableCategories( bool enable )
{
if ( !ClearSelection() )
return false;
if ( enable )
{
// Enable categories
m_windowStyle &= ~(<API key>);
}
else
{
// Disable categories
m_windowStyle |= <API key>;
}
if ( !m_pState->EnableCategories(enable) )
return false;
if ( !m_frozen )
{
if ( m_windowStyle & wxPG_AUTO_SORT )
{
FROM_STATE(m_itemsAdded) = 1; // force
<API key>();
}
else
{
CalculateYs(NULL,-1);
//CalculateVisibles( -1 );
}
}
else
FROM_STATE(m_itemsAdded) = 1;
Refresh();
return true;
}
void wxPropertyGrid::SwitchState( wxPropertyGridState* pNewState )
{
wxASSERT( pNewState );
wxPGProperty* oldSelection = m_selected;
// Deselect
if ( m_selected )
{
bool selRes = ClearSelection();
wxPG_CHECK_RET_DBG( selRes,
wxT("failed to deselect a property (editor probably had invalid value)") );
}
m_pState->m_selected = oldSelection;
bool orig_mode = m_pState->IsInNonCatMode();
bool new_state_mode = pNewState->IsInNonCatMode();
m_pState = pNewState;
m_bottomy = 0; // This is necessary or y's won't get updated.
m_propHover = (wxPGProperty*) NULL;
// If necessary, convert state to correct mode.
if ( orig_mode != new_state_mode )
{
// This should refresh as well.
EnableCategories ( orig_mode?false:true );
}
else if ( !m_frozen )
{
// Refresh, if not frozen.
if ( FROM_STATE(m_itemsAdded) )
<API key>();
else
CalculateYs(NULL,-1);
// Reselect
if ( FROM_STATE(m_selected) )
DoSelectProperty( FROM_STATE(m_selected) );
//RedrawAllVisible();
Refresh();
}
else
m_pState->m_itemsAdded = 1;
}
void wxPropertyGrid::Sort( wxPGId id )
{
<API key>()
m_pState->Sort( p );
// Because order changed, Y's need to be changed as well
if ( p->GetParentState() == m_pState )
CalculateYs ( p->m_parent, p->m_arrIndex );
}
void wxPropertyGrid::Sort()
{
bool selRes = ClearSelection(); // This must be before state clear
wxPG_CHECK_RET_DBG( selRes,
wxT("failed to deselect a property (editor probably had invalid value)") );
m_pState->Sort();
CalculateYs( NULL, -1 );
}
// Call to SetSplitterPosition will always disable splitter auto-centering
// if parent window is shown.
void wxPropertyGrid::<API key>( int newxpos, bool refresh )
{
if ( ( newxpos < wxPG_DRAG_MARGIN ) )
return;
// ( m_width > wxPG_DRAG_MARGIN && newxpos > (<API key>) )
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::<API key> ( %i )"), newxpos );
#endif
#if wxPG_HEAVY_GFX
m_splitterx = newxpos;
m_fSplitterX = (float) newxpos;
if ( refresh )
{
if ( m_selected )
<API key>( m_splitterx, m_width );
Refresh();
//RedrawAllVisible(); // no flicker
}
#else
if ( !m_dragStatus )
{
// Only do this if this was not a call from HandleMouseUp
m_startingSplitterX = m_splitterx;
m_splitterx = newxpos;
m_fSplitterX = (float) newxpos;
}
// Clear old
if ( <API key> != -1 )
{
wxPG_CLIENT_DC_INIT()
<API key>( dc, <API key> );
<API key> = -1;
}
// Redraw only if drag really moved
if ( m_splitterx != m_startingSplitterX && refresh )
{
if ( m_selected)
<API key>( m_splitterx, m_width );
Update(); // This fixes a graphics-mess in wxMSW
Refresh();
//RedrawAllVisible(); // no flicker
}
#endif
// Don't allow initial splitter auto-positioning after this.
m_iFlags |= <API key>;
}
void wxPropertyGrid::CenterSplitter( bool <API key> )
{
SetSplitterPosition ( m_width/2, true );
if ( <API key> && ( m_windowStyle & <API key> ) )
m_iFlags &= ~(<API key>);
}
// Moves splitter so that all labels are visible, but just.
void wxPropertyGrid::SetSplitterLeft( bool subProps )
{
wxClientDC dc(this);
dc.SetFont(m_font);
int maxW = m_pState->GetLeftSplitterPos(dc, m_pState->m_properties, subProps );
if ( maxW > 0 )
SetSplitterPosition( maxW );
m_iFlags |= <API key>;
}
// wxPropertyGrid item iteration (GetNextProperty etc.) methods
// Returns nearest paint visible property (such that will be painted unless
// window is scrolled or resized). If given property is paint visible, then
// it itself will be returned
wxPGProperty* wxPropertyGrid::<API key>( wxPGProperty* p )
{
int vx,vy1;// Top left corner of client
GetViewStart(&vx,&vy1);
vy1 *= <API key>;
int vy2 = vy1 + m_height;
if ( (p->m_y + m_lineHeight) < vy1 )
{
// Too high
return DoGetItemAtY( vy1 );
}
else if ( p->m_y > vy2 )
{
// Too low
return DoGetItemAtY( vy2 );
}
// Itself paint visible
return p;
}
wxPGProperty* wxPropertyGrid::GetNeighbourItem( wxPGProperty* item,
bool need_visible,
int dir ) const
{
<API key>* parent = item->m_parent;
unsigned int indinparent = item->GetIndexInParent();
if ( dir > 0 )
{
if ( item->GetChildCount() == 0 ||
(!((<API key>*)item)->m_expanded && need_visible) )
{
// current item did not have any expanded children
if ( indinparent < (parent->GetCount()-1) )
{
// take next in parent's array
item = parent->Item(indinparent+1);
}
else
{
// no more in parent's array; move up until found;
<API key>* p2 = parent;
parent = parent->m_parent;
item = (wxPGProperty*) NULL;
while ( parent )
{
if ( p2->m_arrIndex < (parent->GetCount()-1) )
{
item = parent->Item(p2->m_arrIndex+1);
break;
}
p2 = parent;
parent = parent->m_parent;
}
}
}
else
{
// take first of current item's children
<API key>* p2 = (<API key>*)item;
item = p2->Item(0);
//indinparent = 0;
}
}
else
{
// items in array left?
if ( indinparent > 0 )
{
// take prev in parent's array
item = parent->Item(indinparent-1);
<API key>* pwc = (<API key>*)item;
// Recurse to it's last child
while ( item->GetParentingType() != 0 && pwc->GetCount() &&
( pwc->m_expanded || !need_visible )
)
{
item = pwc->Last();
pwc = (<API key>*)item;
}
}
else
{
// If we were at first, go to parent
item = parent;
}
}
if ( item == FROM_STATE(m_properties) )
return (wxPGProperty*) NULL;
// If item was hidden and need_visible, get next.
if ( (m_iFlags & wxPG_FL_HIDE_STATE) && need_visible && item )
{
if ( item->m_flags & wxPG_PROP_HIDEABLE )
{
// Speed-up: If parent is hidden as well, then skip to last child or to itself
if ( parent->m_flags & wxPG_PROP_HIDEABLE )
{
item = parent; // if dir up
if ( dir > 0 )
item = parent->Last(); // if dir down
}
return GetNeighbourItem ( item, need_visible, dir );
}
}
return item;
}
// This is used in DoDrawItems.
wxPGProperty* wxPropertyGrid::GetLastItem ( bool need_visible, bool allowSubprops )
{
if ( FROM_STATE(m_properties)->GetCount() < 1 )
return (wxPGProperty*) NULL;
wxPGProperty* p = FROM_STATE(m_properties)->Last();
int parenting = p->GetParentingType();
while ( parenting != 0 && ( allowSubprops || parenting >= PT_CAPTION ) )
{
<API key>* pwc = (<API key>*)p;
parenting = 0;
if ( pwc->GetCount() )
{
if ( (!need_visible || pwc->m_expanded) )
{
p = pwc->Last();
parenting = p->GetParentingType();
}
else
parenting = 0;
}
}
// If item was hidden and need_visible, get previous.
if ( (m_iFlags & wxPG_FL_HIDE_STATE) &&
need_visible &&
p && ( p->m_flags & wxPG_PROP_HIDEABLE )
)
return GetNeighbourItem( p, need_visible, -1 );
return p;
}
void wxPropertyGrid::SetButtonShortcut( int keycode, bool ctrlDown, bool altDown )
{
if ( keycode )
{
m_pushButKeyCode = keycode;
<API key> = ctrlDown ? 1 : 0;
<API key> = altDown ? 1 : 0;
}
else
{
m_pushButKeyCode = WXK_DOWN;
<API key> = 0;
<API key> = 1;
}
}
// Methods related to change in value, value modification and sending events
// commits any changes in editor of selected property
// return true if validation did not fail
// flags are same as with DoSelectProperty
bool wxPropertyGrid::<API key>( wxUint32 flags )
{
if ( m_wndPrimary && <API key>() &&
(m_iFlags & wxPG_FL_INITIALIZED) )
{
wxCHECK_MSG( m_selected, false, wxT("no selection") );
bool wasUnspecified = m_selected->IsValueUnspecified();
// JACS - necessary to avoid new focus being found spuriously within OnIdle
// due to another window getting focus
wxWindow* oldFocus = m_curFocused;
if ( !(flags & (wxPG_SEL_NOVALIDATE|wxPG_SEL_FORCE)) &&
!DoEditorValidate() )
{
if (oldFocus)
{
oldFocus->SetFocus();
m_curFocused = oldFocus;
}
return false;
}
// Save value (only if truly modified).
if ( !m_selected->GetEditorClass()-><API key>( m_selected, m_wndPrimary ) )
<API key>();
if ( m_selected->IsValueUnspecified() && !wasUnspecified && UsesAutoUnspecified() )
flags |= wxPG_SEL_SETUNSPEC;
DoPropertyChanged( m_selected, flags );
return true;
}
return true;
}
// flags are same as with DoSelectProperty
void wxPropertyGrid::DoPropertyChanged( wxPGProperty* p, unsigned int selFlags )
{
if ( m_processingEvent )
return;
#if <API key>
wxLogDebug(wxT("wxPropertyGrid::DoPropertyChanged( %s )"),p->GetLabel().c_str());
#endif
m_pState->m_anyModified = 1;
m_processingEvent = 1;
// No longer unspecified (but not if the value was set to unspecified by
// user modification)
if ( !(selFlags & wxPG_SEL_SETUNSPEC) )
<API key>(p);
if ( m_iFlags & <API key> )
{
m_iFlags &= ~(<API key>);
// Set as Modified (not if dragging just began)
if ( !(p->m_flags & wxPG_PROP_MODIFIED) )
{
p->m_flags |= wxPG_PROP_MODIFIED;
if ( p == m_selected && (m_windowStyle & wxPG_BOLD_MODIFIED) )
{
if ( m_wndPrimary )
<API key>();
}
}
wxPGProperty* curChild = p;
<API key>* curParent = p->m_parent;
// Also update parent(s), if any
// (but not if its wxCustomProperty)
while ( curParent &&
curParent->GetParentingType() < 0 /*&&
wxStrcmp(curParent->GetClassName(),wxT("wxCustomProperty")) != 0*/ )
{
// Set as Modified
if ( !(curParent->m_flags & wxPG_PROP_MODIFIED) )
{
curParent->m_flags |= wxPG_PROP_MODIFIED;
if ( curParent == m_selected && (m_windowStyle & wxPG_BOLD_MODIFIED) )
{
if ( m_wndPrimary )
<API key>();
}
}
curParent->ChildChanged( curChild );
DrawItem( curParent );
curChild = curParent;
curParent = curParent->GetParent();
}
// Draw the actual property
if ( ( p != m_selected ) || !m_wndPrimary ||
( p->GetParentingType() < 0 ) ||
( p->m_flags & <API key> ) )
{
DrawItemAndChildren( p );
}
if ( curChild != p && !(selFlags & wxPG_SEL_SETUNSPEC) )
//m_pState-><API key>(curChild,<API key>);
<API key>(curChild);
wxPGProperty* changedProperty;
// Call wx event handler for property (or its topmost parent, but only
// when dealing with legitemate sub-properties - see above).
if ( curChild->GetParentingType() != PT_CUSTOMPROPERTY )
changedProperty = curChild;
else
changedProperty = p;
// Maybe need to update control
#if <API key>
if ( m_wndPrimary ) m_wndPrimary->Refresh();
if ( m_wndSecondary ) m_wndSecondary->Refresh();
#endif
SendEvent( wxEVT_PG_CHANGED, changedProperty, selFlags );
}
m_processingEvent = 0;
}
// Runs wxValidator for the selected property
bool wxPropertyGrid::DoEditorValidate()
{
#if wxUSE_VALIDATORS
if ( m_iFlags & <API key> )
{
return false;
}
wxWindow* wnd = GetEditorControl();
wxValidator* validator = m_selected->GetValidator();
if ( validator && wnd )
{
// Use TextCtrl of ODComboBox instead
if ( wnd->IsKindOf(CLASSINFO(<API key>)) )
{
wnd = ((<API key>*)wnd)->GetTextCtrl();
if ( !wnd )
return true;
}
validator->SetWindow(wnd);
// Instead setting the flag after the failure, we set
// it before checking and then clear afterwards if things
// went fine. This trick is necessary since focus events
// may be triggered while in Validate.
m_iFlags |= <API key>;
if ( !validator->Validate(this) )
{
// If you don't want to display message multiple times per change,
// comment the following line.
m_iFlags &= ~(<API key>);
wxGetApp().<API key> = true;
return false;
}
wxGetApp().<API key> = false;
m_iFlags &= ~(<API key>);
}
#endif
return true;
}
#if wxUSE_VALIDATORS
bool <API key>::DoValidate( wxPropertyGrid* propGrid,
wxValidator* validator,
const wxString& value )
{
if ( !validator )
return true;
wxTextCtrl* tc = m_textCtrl;
if ( !tc )
{
{
tc = new wxTextCtrl( propGrid, wxPG_SUBID_TEMP1, wxEmptyString,
wxPoint(30000,30000));
tc->Hide();
}
m_textCtrl = tc;
}
//wxString oldValue = tc->GetValue();
tc->SetValue(value);
validator->SetWindow(tc);
bool res = validator->Validate(propGrid);
//tc->SetValue(oldValue);
return res;
}
#else
bool <API key>::DoValidate( wxPropertyGrid* WXUNUSED(propGrid),
wxValidator* WXUNUSED(validator),
const wxString& WXUNUSED(value) )
{
return true;
}
#endif
// NB: It may really not be wxCommandEvent - must check if necessary
// (usually not).
void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
{
wxPGProperty* selected = m_selected;
// Somehow, event is handled after property has been deselected.
// Possibly, but very rare.
if ( !selected )
return;
bool wasUnspecified = selected->IsValueUnspecified();
bool usesAutoUnspecified = UsesAutoUnspecified();
wxWindow* wnd = m_wndPrimary;
bool res1, res2;
m_iFlags &= ~(<API key>);
// First call editor class' event handler.
const wxPGEditor* editor = selected->GetEditorClass();
res1 = editor->OnEvent( this, selected, wnd, event );
if ( res1 )
{
// If changes, validate them
if ( DoEditorValidate() )
{
if ( editor-><API key>( selected, wnd ) )
{
}
else
{
// False alarm
res1 = false;
<API key>();
// However, even moot editing will clear the unspecified status
if ( wasUnspecified || !usesAutoUnspecified )
<API key>(selected);
}
}
else
{
res1 = false;
<API key>();
if ( wasUnspecified || !usesAutoUnspecified )
<API key>(selected);
return;
}
}
// Then the property's custom handler (must be always called).
res2 = selected->OnEvent( this, wnd, event );
if ( res1 || res2 )
{
// Setting this is not required if res was true, so we do it now.
m_iFlags |= <API key>;
int selFlags = ( !wasUnspecified && selected->IsValueUnspecified() && usesAutoUnspecified ) ? wxPG_SEL_SETUNSPEC : 0;
DoPropertyChanged(selected, selFlags);
}
else
// Let unhandled button click events go to the parent
if ( event.GetEventType() == <API key> )
{
wxCommandEvent evt(<API key>,GetId());
GetEventHandler()->AddPendingEvent(evt);
}
}
// When a property's value was modified internally (using SetValueFromString
// or SetValueFromInt, for example), then this should be called afterwards.
// NB: Avoid using this method, if possible.
void wxPropertyGrid::PropertyWasModified( wxPGProperty* p, int selFlags )
{
wxCHECK_RET( p, wxT("invalid property id") );
<API key>();
DoPropertyChanged(p, selFlags);
}
// wxPropertyGrid editor control helper methods
wxWindow* wxPropertyGrid::GetEditorControl() const
{
wxWindow* ctrl = m_wndPrimary;
if ( !ctrl )
return ctrl;
// If it's clipper window, return its child instead
#if <API key>
if ( ctrl->IsKindOf(CLASSINFO(wxPGClipperWindow)) )
{
return ((wxPGClipperWindow*)ctrl)->GetControl();
}
#endif
return ctrl;
}
// inline because it is used exactly once in the code
inline wxRect wxPropertyGrid::GetEditorWidgetRect( wxPGProperty* p )
{
//wxASSERT( p->m_y >= 0 ); // item is not visible
int itemy = p->m_y;
int vx,vy;// Top left corner of client
GetViewStart(&vx,&vy);
vy *= <API key>;
int cust_img_space = 0;
//m_iFlags &= ~(<API key>);
// TODO: If custom image detection changes from current, change this.
if ( m_iFlags & <API key> /*p->m_flags & <API key>*/ )
{
//m_iFlags |= <API key>;
int imwid = p->GetImageSize().x;
if ( imwid < 1 ) imwid = <API key>;
cust_img_space = imwid + <API key> + <API key>;
}
return wxRect
(
m_splitterx+cust_img_space+wxPG_XBEFOREWIDGET+wxPG_CONTROL_MARGIN+1,
itemy-vy,
<API key>,
m_lineHeight-1
);
}
// return size of custom paint image
wxSize wxPropertyGrid::GetImageSize( wxPGId id ) const
{
if ( wxPGIdIsOk(id) )
{
wxSize cis = wxPGIdToPtr(id)->GetImageSize();
if ( cis.x < 0 )
{
if ( cis.x <= -1 )
cis.x = <API key>;
}
if ( cis.y <= 0 )
{
if ( cis.y >= -1 )
cis.y = <API key>(m_lineHeight);
else
cis.y = -cis.y;
}
return cis;
}
// If called with NULL property, then return default image
// size for properties that use image.
return wxSize(<API key>,<API key>(m_lineHeight));
}
void wxPropertyGrid::<API key>( int newSplitterx, int newWidth )
{
wxASSERT( m_selected );
int secWid = 0;
if ( m_wndSecondary )
{
// if width change occurred, move secondary wnd by that amount
wxRect r = m_wndSecondary->GetRect();
secWid = r.width;
r.x = newWidth - secWid;
//r.y += yAdj;
m_wndSecondary->SetSize ( r );
// if primary is textctrl, then we have to add some extra space
#ifdef __WXMAC__
if ( m_wndPrimary )
#else
if ( m_wndPrimary && m_wndPrimary->IsKindOf(CLASSINFO(wxTextCtrl)) )
#endif
secWid += <API key>;
}
if ( m_wndPrimary )
{
wxRect r = m_wndPrimary->GetRect();
r.x = newSplitterx+m_ctrlXAdjust;
//r.y += yAdj;
r.width = newWidth - r.x - secWid;
m_wndPrimary->SetSize(r);
}
/*
int sec_wid = 0;
int vx, vy;
GetViewStart(&vx,&vy);
vy*=<API key>;
int propY = m_selected->m_y - vy;
if ( m_wndSecondary )
{
// if width change occurred, move secondary wnd by that amount
wxRect r = m_wndSecondary->GetRect();
int adjust = r.y % <API key>;
if ( adjust > (<API key>/2) )
adjust = adjust - <API key>;
int y = propY + adjust;
sec_wid = r.width;
m_wndSecondary->Move ( new_width-r.width,y );
// if primary is textctrl, then we have to add some extra space
if ( m_wndPrimary && m_wndPrimary->IsKindOf(CLASSINFO(wxTextCtrl)) )
sec_wid += <API key>;
}
if ( m_wndPrimary )
{
wxRect r = m_wndPrimary->GetRect();
int adjust = r.y % <API key>;
if ( adjust > (<API key>/2) )
adjust = adjust - <API key>;
wxLogDebug(wxT("adjust: %i"),adjust);
int y = propY + adjust;
m_wndPrimary->SetSize(
new_splitterx+m_ctrlXAdjust,
y,
new_width-(new_splitterx+m_ctrlXAdjust)-sec_wid,
r.height
);
}
*/
if ( m_wndSecondary )
m_wndSecondary->Refresh();
}
/*void wxPropertyGrid::<API key>( int cy )
{
if ( m_selected )
{
wxPoint cp(0,cy);
if ( m_wndPrimary )
m_wndPrimary->Move ( m_wndPrimary->GetPosition() + cp );
if ( m_wndSecondary )
m_wndSecondary->Move ( m_wndSecondary->GetPosition() + cp );
}
}*/
// takes scrolling into account
void wxPropertyGrid::<API key>( int* px, int* py )
{
int vx, vy;
GetViewStart(&vx,&vy);
vy*=<API key>;
vx*=<API key>;
*px -= vx;
*py -= vy;
ClientToScreen ( px, py );
}
// custom set cursor
void wxPropertyGrid::CustomSetCursor( int type, bool override )
{
if ( type == m_curcursor && !override ) return;
wxCursor* cursor = &wxPG_DEFAULT_CURSOR;
if ( type == wxCURSOR_SIZEWE )
cursor = m_cursorSizeWE;
SetCursor ( *cursor );
//if ( m_wndPrimary ) m_wndPrimary->SetCursor(wxNullCursor);
m_curcursor = type;
}
// wxPropertyGrid property selection
#define CONNECT_CHILD(EVT,FUNCTYPE,FUNC) \
wnd->Connect(id, EVT, \
(<API key>) (wxEventFunction) \
FUNCTYPE (&wxPropertyGrid::FUNC), \
NULL, this );
/*
class MyEvtHandler : public wxEvtHandler
{
public:
virtual bool ProcessEvent( wxEvent& event )
{
if ( event.GetEventType() == <API key> )
wxLogDebug(wxT("<API key>(id=%i)"),event.GetId());
else if ( event.GetEventType() == wxEVT_KEY_DOWN )
wxLogDebug(wxT("wxEVT_KEY_DOWN"));
event.Skip();
return wxEvtHandler::ProcessEvent(event);
}
};
*/
// Setups event handling for child control
void wxPropertyGrid::SetupEventHandling( wxWindow* argWnd, int id )
{
wxWindow* wnd = argWnd;
#if <API key>
// Pass real control instead of clipper window
if ( wnd->IsKindOf(CLASSINFO(wxPGClipperWindow)) )
{
wnd = ((wxPGClipperWindow*)argWnd)->GetControl();
}
#endif
if ( argWnd == m_wndPrimary )
{
CONNECT_CHILD(wxEVT_MOTION,(<API key>),OnMouseMoveChild)
CONNECT_CHILD(wxEVT_LEFT_UP,(<API key>),OnMouseUpChild)
CONNECT_CHILD(wxEVT_LEFT_DOWN,(<API key>),OnMouseClickChild)
//CONNECT_CHILD(wxEVT_LEFT_DCLICK,(<API key>),OnMouseClickChild)
CONNECT_CHILD(wxEVT_RIGHT_UP,(<API key>),<API key>)
CONNECT_CHILD(wxEVT_ENTER_WINDOW,(<API key>),OnMouseEntry)
CONNECT_CHILD(wxEVT_LEAVE_WINDOW,(<API key>),OnMouseEntry)
}
else
{
CONNECT_CHILD(<API key>,(<API key>),OnNavigationKey)
}
CONNECT_CHILD(wxEVT_KEY_DOWN,(wxCharEventFunction),OnChildKeyDown)
CONNECT_CHILD(wxEVT_KEY_UP,(wxCharEventFunction),OnChildKeyUp)
CONNECT_CHILD(wxEVT_KILL_FOCUS,(<API key>),OnFocusEvent)
}
void wxPropertyGrid::FreeEditors()
{
// Do not free editors immediately if processing events
if ( !m_windowsToDelete )
m_windowsToDelete = new wxArrayPtrVoid;
if ( m_wndSecondary )
{
m_windowsToDelete->push_back(m_wndSecondary);
m_wndSecondary->Hide();
m_wndSecondary = (wxWindow*) NULL;
}
if ( m_wndPrimary )
{
m_windowsToDelete->push_back(m_wndPrimary);
m_wndPrimary->Hide();
m_wndPrimary = (wxWindow*) NULL;
}
}
// Call with NULL to de-select property
bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
{
#if <API key>
if (p)
wxLogDebug(wxT("SelectProperty( %s (%s[%i]) )"),p->m_label.c_str(),
p->m_parent->m_label.c_str(),p->GetIndexInParent());
else
wxLogDebug(wxT("SelectProperty( NULL, -1 )"));
#endif
// Delete windows pending for deletion
if ( m_windowsToDelete && !m_processingEvent && m_windowsToDelete->size() )
{
unsigned int i;
for ( i=0; i<m_windowsToDelete->size(); i++ )
delete ((wxWindow*)((*m_windowsToDelete)[i]));
m_windowsToDelete->clear();
}
wxPGProperty* prev = m_selected;
// If we are frozen, then just set the values.
if ( m_frozen )
{
m_iFlags &= ~(<API key>);
m_editorFocused = 0;
m_selected = p;
FROM_STATE(m_selected) = p;
// If frozen, always free controls. But don't worry, as Thaw will
// recall SelectProperty to recreate them.
FreeEditors();
// Prevent any further selection measures in this call
p = (wxPGProperty*) NULL;
}
else
{
// Is it the same?
if ( m_selected == p && !(flags & wxPG_SEL_FORCE) )
{
// Only set focus if not deselecting
if ( p )
{
if ( flags & wxPG_SEL_FOCUS )
{
if ( m_wndPrimary )
{
m_wndPrimary->SetFocus();
m_editorFocused = 1;
}
}
else
{
wxScrolledWindow::SetFocus();
m_editorFocused = 0;
}
}
return true;
}
wxClientDC dc(this);
PrepareDC(dc);
// Don't put this earlier, due to return statements
m_iFlags |= <API key>;
// First, deactivate previous
if ( m_selected )
{
#if <API key>
wxLogDebug(wxT(" (closing previous (%s))"), m_selected->m_label.c_str() );
#endif
// Must double-check if this is an selected in case of forceswitch
if ( p != prev )
{
if ( !<API key>(flags) )
{
// Validation has failed, so we can't exit the previous editor
//::wxMessageBox(_("Please correct the value or press ESC to cancel the edit."),
// _("Invalid Value"),wxOK|wxICON_ERROR);
return false;
}
}
FreeEditors();
m_iFlags &= ~(<API key>|<API key>);
m_selected = (wxPGProperty*) NULL;
FROM_STATE(m_selected) = (wxPGProperty*) NULL;
// Make sure the previous selection is refreshed
// JACS: must use paint handler whenever possible
Refresh(false);
/*if ( m_iFlags & <API key> )
Refresh(false);
else if ( prev->m_y < (int)m_bottomy )
DoDrawItems( dc, prev, prev, NULL );
*/
m_iFlags &= ~(<API key>|<API key>);
}
// Then, activate the one given.
if ( p )
{
m_editorFocused = 0;
m_selected = p;
FROM_STATE(m_selected) = p;
m_iFlags |= <API key>;
if ( p != prev )
m_iFlags &= ~(<API key>);
//m_wndPrimary = (wxWindow*) NULL;
wxASSERT( m_wndPrimary == (wxWindow*) NULL );
// Do we need OnMeasureCalls?
wxSize imsz = p->GetImageSize();
if ( imsz.y < -1 )
m_iFlags |= <API key>;
// Is the entire cell/row custom painted?
if ( imsz.x == <API key> )
m_iFlags |= <API key>;
// Only create editor for non-disabled non-caption
if ( p->GetParentingType() <= 0 && !(p->m_flags & wxPG_PROP_DISABLED) )
{
// do this for non-caption items
// Do we need to paint the custom image, if any?
m_iFlags &= ~(<API key>);
if ( (p->m_flags & <API key>) &&
!p->GetEditorClass()-><API key>()
)
m_iFlags |= <API key>;
wxRect grect = GetEditorWidgetRect(p);
wxPoint good_pos = grect.GetPosition();
#if <API key>
int coord_adjust = m_height - good_pos.y;
good_pos.y += coord_adjust;
#endif
const wxPGEditor* editor = p->GetEditorClass();
wxCHECK_MSG(editor, false,
wxT("NULL editor class not allowed"));
#ifndef __WXPYTHON__
m_wndPrimary = editor->CreateControls(this,
p,
good_pos,
grect.GetSize(),
&m_wndSecondary);
#else
wxPGWindowPair wndPair = editor->CreateControls(this,
p,
good_pos,
grect.GetSize());
m_wndPrimary = wndPair.m_primary;
m_wndSecondary = wndPair.m_secondary;
#endif
// NOTE: It is allowed for m_wndPrimary to be NULL - in this case
// value is drawn as normal, and m_wndSecondary is assumed
// to be a right-aligned button that triggers a separate editor
// window.
if ( m_wndPrimary )
{
//wxLogDebug(wxT("%s Editor created for %s"),editor->GetName(),p->GetName().c_str());
// Set validator, if any
/*#if wxUSE_VALIDATORS
if ( validator ) m_wndPrimary->SetValidator(*validator);
#endif*/
if ( m_wndPrimary->GetSize().y > (m_lineHeight+6) )
m_iFlags |= <API key>;
// If it has modified status, use bold font
// (must be done before capturing m_ctrlXAdjust)
if ( (p->m_flags & wxPG_PROP_MODIFIED) && (m_windowStyle & wxPG_BOLD_MODIFIED) )
<API key>();
// Fix TextCtrl indentation
#if defined(__WXMSW__) && !defined(__WXWINCE__)
wxTextCtrl* tc = wxDynamicCast(m_wndPrimary, wxTextCtrl);
if ( tc )
::SendMessage(GetHwndOf(tc), EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0, 0));
#endif
// Store x relative to splitter (we'll need it).
m_ctrlXAdjust = m_wndPrimary->GetPosition().x - m_splitterx;
// Check if background clear is not necessary
wxPoint pos = m_wndPrimary->GetPosition();
if ( pos.x > (m_splitterx+1) || pos.y > p->m_y )
{
m_iFlags &= ~(<API key>);
}
m_wndPrimary->SetSizeHints(3,3);
#if <API key>
m_wndPrimary->Show(false);
m_wndPrimary->Freeze();
good_pos = m_wndPrimary->GetPosition();
good_pos.y -= coord_adjust;
m_wndPrimary->Move( good_pos );
#endif
SetupEventHandling(m_wndPrimary, wxPG_SUBID1);
// Focus and select all (wxTextCtrl, wxComboBox etc)
if ( flags & wxPG_SEL_FOCUS )
{
wxWindow* ctrl = m_wndPrimary;
ctrl->SetFocus();
#if <API key>
// Take into account textctrl in clipper window
if ( ctrl->IsKindOf(CLASSINFO(wxPGClipperWindow)) )
ctrl = ((wxPGClipperWindow*)ctrl)->GetControl();
#endif
p->GetEditorClass()->OnFocus(p,m_wndPrimary);
}
}
if ( m_wndSecondary )
{
m_wndSecondary->SetSizeHints(3,3);
#if <API key>
wxRect sec_rect = m_wndSecondary->GetRect();
sec_rect.y -= coord_adjust;
// Fine tuning required to fix "oversized"
// button disappearance bug.
if ( sec_rect.y < 0 )
{
sec_rect.height += sec_rect.y;
sec_rect.y = 0;
}
m_wndSecondary->SetSize( sec_rect );
#endif
m_wndSecondary->Show();
SetupEventHandling(m_wndSecondary,wxPG_SUBID2);
// If no primary editor, focus to button to allow
// it to interprete ENTER etc.
// NOTE: Due to problems focusing away from it, this
// has been disabled.
/*
if ( (flags & wxPG_SEL_FOCUS) && !m_wndPrimary )
m_wndSecondary->SetFocus();
*/
}
if ( flags & wxPG_SEL_FOCUS )
m_editorFocused = 1;
}
else
{
// wxGTK atleast seems to need this (wxMSW not)
SetFocus();
}
m_iFlags &= ~(<API key>);
//Update();
// If it's inside collapsed section, expand parent, scroll, etc.
// Also, if it was partially visible, scroll it into view.
int vx, vy;
GetViewStart(&vx,&vy);
vy*=<API key>;
int vy2 = vy + m_height;
if ( (p->m_y < vy ||
(p->m_y <= vy2 &&
(p->m_y+m_lineHeight) > vy2)) &&
!(flags & wxPG_SEL_NONVISIBLE) )
EnsureVisible( wxPGIdGen(p) );
if ( m_wndPrimary )
{
// Clear its background
// (why can't this be optimized by some other drawing?)
if ( !(m_iFlags & <API key>) )
{
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) );
dc.DrawRectangle(m_splitterx+1,p->m_y,
m_width-m_splitterx,m_lineHeight-1);
}
#if <API key>
m_wndPrimary->Thaw();
#endif
m_wndPrimary->Show(true);
}
DoDrawItems( dc, p, p, (const wxRect*) NULL );
}
}
#if wxUSE_STATUSBAR
// Show help text in status bar.
// (if found and grid not embedded in manager with help box and
// style <API key> is not used).
if ( !(GetExtraStyle() & <API key>) )
{
wxStatusBar* statusbar = (wxStatusBar*) NULL;
if ( !(m_iFlags & <API key>) )
{
wxFrame* frame = wxDynamicCast(::wxGetTopLevelParent(this),wxFrame);
if ( frame )
statusbar = frame->GetStatusBar();
}
if ( statusbar )
{
const wxString* pHelpString = (const wxString*) NULL;
if ( p && p->m_dataExt )
{
pHelpString = &p->m_dataExt->m_helpString;
if ( pHelpString->length() )
{
// Set help box text.
statusbar->SetStatusText( *pHelpString );
m_iFlags |= <API key>;
}
}
if ( (!pHelpString || !pHelpString->length()) &&
(m_iFlags & <API key>) )
{
// Clear help box - but only if it was written
// by us at previous time.
statusbar->SetStatusText( m_emptyString );
m_iFlags &= ~(<API key>);
}
}
}
#endif
m_iFlags &= ~(<API key>);
// call wx event handler (here so that it also occurs on deselection)
SendEvent( wxEVT_PG_SELECTED, m_selected, flags );
return true;
}
// This method is not inline because it called dozens of times
// (i.e. two-arg function calls create smaller code size).
bool wxPropertyGrid::ClearSelection()
{
return DoSelectProperty((wxPGProperty*)NULL);
}
// wxPropertyGrid expand/collapse state and priority (compact mode) related
bool wxPropertyGrid::_Collapse( wxPGProperty* p, bool sendEvents )
{
wxCHECK_MSG( p, false, wxT("invalid property id") );
<API key>* pwc = (<API key>*)p;
if ( pwc->GetParentingType() == 0 ) return false;
if ( !pwc->m_expanded ) return false;
// If active editor was inside collapsed section, then disable it
if ( m_selected && m_selected->IsSomeParent (p) )
{
if ( !ClearSelection() )
return false;
}
// Store <API key> flag 'cause we need to temporarily set it
wxUint32 old_flag = m_iFlags & <API key>;
m_iFlags |= <API key>;
// m_expanded must be set just before call to CalculateYs
pwc->m_expanded = 0;
// Redraw etc. only if collapsed was visible.
if (pwc->m_y >= 0 &&
!m_frozen &&
( pwc->GetParentingType() != 1 || !(m_windowStyle & <API key>) ) )
{
/*int y_adjust = 0;
if ( m_selected && m_selected->m_y > pwc->m_y )
{
wxPGProperty* next_vis = GetNeighbourItem(pwc,true,1);
wxASSERT( next_vis );
y_adjust = next_vis->m_y - pwc->m_y - m_lineHeight;
}*/
CalculateYs( pwc->m_parent, pwc->m_arrIndex );
// Fix control position.
/*if ( y_adjust )
<API key> ( -y_adjust );*/
// When item is collapsed so that scrollbar would move,
// graphics mess is about (unless we redraw everything).
Refresh();
}
// Clear <API key> flag if it wasn't set
m_iFlags = (m_iFlags & ~(<API key>)) | old_flag;
if ( sendEvents )
SendEvent( <API key>, p );
return true;
}
bool wxPropertyGrid::_Expand( wxPGProperty* p, bool sendEvents )
{
wxCHECK_MSG( p, false, wxT("invalid property id") );
<API key>* pwc = (<API key>*)p;
if ( pwc->GetParentingType() == 0 ) return false;
if ( pwc->m_expanded ) return false;
// Store <API key> flag 'cause we need to temporarily set it
wxUint32 old_flag = m_iFlags & <API key>;
m_iFlags |= <API key>;
// m_expanded must be set just before call to CalculateYs
pwc->m_expanded = 1;
// Redraw etc. only if expanded was visible.
if ( pwc->m_y >= 0 && !m_frozen &&
( pwc->GetParentingType() != 1 || !(m_windowStyle & <API key>) )
)
{
CalculateYs( pwc->m_parent, pwc->m_arrIndex );
/*int y_adjust = pwc->GetCount()*m_lineHeight;
// Fix widget position as well
if ( m_selected && m_selected->m_y > pwc->m_y )
<API key> ( y_adjust );*/
// Redraw
#if <API key>
Refresh();
#else
//<API key>(true)
//DrawItems( dc, pwc->m_y, m_bottomy );
DrawItems(pwc,(wxPGProperty*) NULL);
#endif
}
// Clear <API key> flag if it wasn't set
m_iFlags = (m_iFlags & ~(<API key>)) | old_flag;
if ( sendEvents )
SendEvent( <API key>, p );
return true;
}
bool wxPropertyGrid::Compact( bool compact )
{
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::Compact()") );
#endif
if ( compact )
{
if ( !(m_iFlags & wxPG_FL_HIDE_STATE) )
{
// Deselect selected if it was hideable
if ( m_selected && ( m_selected->m_flags & wxPG_PROP_HIDEABLE ) )
{
if ( !ClearSelection() )
return false;
}
m_iFlags |= wxPG_FL_HIDE_STATE;
if ( !m_frozen )
{
CalculateYs( NULL, -1 );
RedrawAllVisible();
}
}
}
else
{
if ( m_iFlags & wxPG_FL_HIDE_STATE )
{
m_iFlags &= ~(wxPG_FL_HIDE_STATE);
if ( !m_frozen )
{
CalculateYs( NULL, -1 );
RedrawAllVisible();
}
}
}
return true;
}
// Used by HideProperty as well
bool wxPropertyGrid::SetPropertyPriority( wxPGProperty* p, int priority )
{
/*
// Old code (Commented Aug-09-2007)
if ( m_frozen )
return m_pState->SetPropertyPriority(p,priority);
if ( (m_iFlags & wxPG_FL_HIDE_STATE) && m_selected &&
( m_selected == p || m_selected->IsSomeParent(p) )
)
{
if ( !ClearSelection() )
return false;
}
m_pState->SetPropertyPriority(p,priority);
if ( m_iFlags & wxPG_FL_HIDE_STATE )
{
CalculateYs(NULL,-1);
RedrawAllVisible();
}
return true;
*/
// Stefan Battmer:
// Changed in a way that this update is only forced when the
// properties new priority actually differs from the current
// priority to improve update speed
if ( p )
{
int oldPriority = ( p->IsFlagSet(wxPG_PROP_HIDEABLE) ) ? wxPG_LOW : wxPG_HIGH;
if( oldPriority != priority )
{
if ( m_frozen )
return m_pState->SetPropertyPriority(p,priority);
if ( (m_iFlags & wxPG_FL_HIDE_STATE) && m_selected &&
( m_selected == p || m_selected->IsSomeParent(p) )
)
{
if ( !ClearSelection() )
return false;
}
m_pState->SetPropertyPriority(p,priority);
if ( m_iFlags & wxPG_FL_HIDE_STATE )
{
CalculateYs(NULL,-1);
RedrawAllVisible();
}
return true;
}
}
return false;
}
// wxPropertyGrid size related methods
// This is called by CalculateYs (so those calling it won't need to call this)
void wxPropertyGrid::<API key>()
{
int x = m_width;
int y = m_bottomy;
//SetClientSize(x,y);
// Now adjust virtual size.
SetVirtualSize(x, y);
PGAdjustScrollbars(y);
// FIXME: Is this really needed? I mean, can't OnResize handle this?
int width, height;
GetClientSize(&width,&height);
if ( m_selected && width != m_width )
{
<API key>( m_splitterx, width );
}
m_width = width;
m_height = height;
}
void wxPropertyGrid::PGAdjustScrollbars( int y )
{
// Adjust scrollbars.
y += <API key>+2; // One more scrollbar unit + 2 pixels.
int y_amount = y/<API key>;
int y_pos = GetScrollPos( wxVERTICAL );
SetScrollbars( 0, <API key>, 0,
y_amount, 0, y_pos, true );
}
/*
bool wxPropertyGrid::DetectScrollbar()
{
// Call at every time scrollbar may have appeared/disappeared
// Returns true if scrollbar was toggled
bool toggled = false;
// Use functions instead of m_width for total independence
wxCoord width = GetSize().x;
wxCoord cwidth = GetClientSize().x;
if ( abs(width-cwidth) >= <API key> )
{
// There is a scrollbar.
if ( !(m_iFlags & <API key>) )
{
//wxLogDebug(wxT("Scrollbar Appeared"));
toggled = true;
m_iFlags |= <API key>;
}
}
else if ( m_iFlags & <API key> )
{
//wxLogDebug(wxT("Scrollbar Disappeared"));
toggled = true;
m_iFlags &= ~(<API key>);
}
return toggled;
}
*/
void wxPropertyGrid::OnResize( wxSizeEvent& event )
{
if ( !(m_iFlags & wxPG_FL_INITIALIZED) )
return;
if ( FROM_STATE(m_itemsAdded) && !m_frozen )
<API key>();
int width, height;
GetClientSize(&width,&height);
#if <API key>
wxLogDebug(wxT("wxPropertyGrid::OnResize ( %i, %i )"),width,height);
#endif
//int old_width = m_width;
//int old_height = m_height;
int old_fwidth = m_fWidth; // non-client width
int old_splitterx = m_splitterx;
int fwidth = event.GetSize().x;
m_fWidth = fwidth;
m_width = width;
m_height = height;
int widthDiff = fwidth - old_fwidth;
#if wxPG_DOUBLE_BUFFER
if ( !(GetExtraStyle() & <API key>) )
{
int dblh = (m_lineHeight*2);
if ( !m_doubleBuffer )
{
// Create double buffer bitmap to draw on, if none
int w = (width>250)?width:250;
int h = height + dblh;
h = (h>400)?h:400;
m_doubleBuffer = new wxBitmap ( w, h );
}
else
{
int w = m_doubleBuffer->GetWidth();
int h = m_doubleBuffer->GetHeight();
// Double buffer must be large enough
if ( w < width || h < (height+dblh) )
{
if ( w < width ) w = width;
if ( h < (height+dblh) ) h = height + dblh;
delete m_doubleBuffer;
m_doubleBuffer = new wxBitmap ( w, h );
}
}
}
// Consider full update on every resize
//m_iFlags |= wxPG_FL_CHANGED;
#endif
// Center splitter when...
// * always when propGrid not shown yet or its full size is not realized yet
// and then only if splitter's position was not pre-set
// * auto-centering is enabled and scrollbar was not toggled
// Need to center splitter?
//if ( width!=old_width )
{
bool needSplitterCheck = true;
//if ( !sb_vis_toggled )
{
if ( m_windowStyle & <API key> )
{
float centerX = (float)(width * 0.5);
float splitterX = (float)(m_fSplitterX + widthDiff * 0.5);
float deviation = fabs(centerX - splitterX);
//wxLogDebug(wxT("deviation: %.1f"),deviation);
// If deviated too far from the center, reset it
if ( deviation > 30.0 )
splitterX = centerX;
<API key>( (int)splitterX, false );
m_fSplitterX = splitterX; // needed to retain accuracy
needSplitterCheck = false;
}
else if ( !(m_iFlags & <API key>) )
{
long timeSinceCreation = (::<API key>() - m_timeCreated).ToLong();
if ( m_pState->m_properties->GetCount() || timeSinceCreation > 750 )
{
SetSplitterLeft( false );
needSplitterCheck = false;
}
else
{
<API key>( width / 2, false );
m_iFlags &= ~(<API key>);
needSplitterCheck = false;
}
}
}
if ( needSplitterCheck && (m_splitterx + wxPG_DRAG_MARGIN) > width )
{
long timeSinceCreation = (::<API key>() - m_timeCreated).ToLong();
if ( timeSinceCreation >= 750 )
{
<API key>( width - wxPG_DRAG_MARGIN - 1, false );
}
}
}
// Need to correct widget position?
if ( m_selected /*&& (width != old_width || sb_vis_toggled)*/ )
{
// Take splitter position change into account
<API key>( m_splitterx, width );
}
if ( !m_frozen )
{
// Need to recalculate visibles array?
//if ( height != old_height )
if ( height > m_calcVisHeight )
CalculateVisibles( -1, false );
/*if ( sb_vis_toggled )
{
Refresh();
}
else*/
if ( m_splitterx != old_splitterx )
{
Refresh();
/*if ( abs(height-old_height) < 100 )
{
Update(); // Necessary, atleast on wxMSW
RedrawAllVisible();
}
else
{
Refresh();
}*/
}
}
// Without this, virtual size (atleast under wxGTK) will be skewed
<API key>();
}
// wxPropertyGrid mouse event handling
// selFlags uses same values DoSelectProperty's flags
void wxPropertyGrid::SendEvent( int eventType, wxPGProperty* p, unsigned int selFlags )
{
// Send property grid event of specific type and with specific property
wxPropertyGridEvent evt( eventType, GetId() );
evt.SetPropertyGrid(this);
evt.SetEventObject(m_eventObject);
evt.SetProperty(p);
wxEvtHandler* evtHandler = GetEventHandler();
// Always need to process event immediately if the property in question is
// about to be deleted.
if ( (selFlags & wxPG_SEL_DELETING) ||
(GetExtraStyle() & <API key>) )
{
evtHandler->ProcessEvent(evt);
}
else
{
evt.SetPending(true);
evtHandler->AddPendingEvent(evt);
}
}
// Return false if should be skipped
bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &event )
{
bool res = true;
#if __MOUSE_DEBUGGING__
wxLogDebug( wxT(" \\--> HandleMouseClick") );
#endif
// Need to set focus?
if ( !(m_iFlags & wxPG_FL_FOCUSED) )
{
SetFocus();
}
if ( y < m_bottomy )
{
wxPGProperty* p = DoGetItemAtY(y);
if ( p )
{
int parenting = p->GetParentingType();
int depth = (int)p->GetDepth() - 1;
int marginEnds = m_marginWidth + ( depth * <API key> );
if ( x >= marginEnds )
{
// Outside margin.
if ( parenting > 0 )
{
// This is category.
<API key>* pwc = (<API key>*)p;
int text_x = m_marginWidth + ((unsigned int)((pwc->m_depth-1)*<API key>));
// Expand, collapse, activate etc. if click on text or left of splitter.
if ( x >= text_x
&&
( x < (text_x+pwc->GetTextExtent()+(wxPG_CAPRECTXMARGIN*2))
||
x < m_splitterx
)
)
{
if ( !DoSelectProperty( p ) )
return res;
// On double-click, expand/collapse.
if ( event.ButtonDClick() && !(m_windowStyle & wxPG_HIDE_MARGIN) )
{
if ( pwc->m_expanded ) _Collapse ( p, true );
else _Expand ( p, true );
}
}
}
else if ( x > (m_splitterx + <API key>) ||
x < (m_splitterx - <API key>) )
{
// Click on value.
unsigned int selFlag = 0;
if ( x > m_splitterx )
{
m_iFlags |= <API key>;
selFlag = wxPG_SEL_FOCUS;
}
if ( !DoSelectProperty( p, selFlag ) )
return res;
m_iFlags &= ~(<API key>);
if ( p->GetParentingType() < 0 )
// On double-click, expand/collapse.
if ( event.ButtonDClick() && !(m_windowStyle & wxPG_HIDE_MARGIN) )
{
<API key>* pwc = (<API key>*)p;
if ( pwc->m_expanded ) _Collapse ( p, true );
else _Expand ( p, true );
}
res = false;
}
else
{
// click on splitter
if ( !(m_windowStyle & <API key>) )
{
if ( event.GetEventType() == wxEVT_LEFT_DCLICK )
{
// Double-clicking the splitter causes auto-centering
CenterSplitter( true );
// TODO: Would this be more natural?
// .NET grid doesn't do it but maybe we should.
//CustomSetCursor ( wxCURSOR_ARROW );
}
else if ( m_dragStatus == 0 )
{
// Begin draggin the splitter
#if __MOUSE_DEBUGGING__
wxLogDebug( wxT(" dragging begins at splitter + %i"),
(int)(x - m_splitterx) );
#endif
if ( m_wndPrimary )
{
// Changes must be committed here or the
// value won't be drawn correctly
if ( !<API key>() )
return res;
m_wndPrimary->Show ( false );
}
BEGIN_MOUSE_CAPTURE
m_dragStatus = 1;
m_dragOffset = (unsigned char)(x - m_splitterx);
wxPG_CLIENT_DC_INIT()
#if <API key>
// Fixes button disappearance bug
if ( m_wndSecondary )
m_wndSecondary->Show ( false );
#endif
m_startingSplitterX = m_splitterx;
#if wxPG_HEAVY_GFX
#else
Update(); // clear graphics mess
<API key>( dc, m_splitterx );
<API key> = m_splitterx;
#endif
}
}
}
}
else
{
// Click on margin.
if ( parenting != 0 )
{
int nx = x + m_marginWidth - marginEnds; // Normalize x.
if ( (nx >= m_gutterWidth && nx < (m_gutterWidth+m_iconWidth)) )
{
int y2 = y - p->m_y;
if ( (y2 >= m_buttonSpacingY && y2 < (m_buttonSpacingY+m_iconHeight)) )
{
// On click on expander button, expand/collapse
if ( ((<API key>*)p)->m_expanded )
_Collapse ( p, true );
else
_Expand ( p, true );
}
}
}
}
}
}
return res;
}
bool wxPropertyGrid::<API key>( int WXUNUSED(x), unsigned int y,
wxMouseEvent& WXUNUSED(event) )
{
if ( y < m_bottomy )
{
// Select property here as well
wxPGProperty* p = m_propHover;
if ( p != m_selected )
DoSelectProperty( p );
// Send right click event.
SendEvent( <API key>, p );
return true;
}
return false;
}
bool wxPropertyGrid::<API key>( int WXUNUSED(x), unsigned int y,
wxMouseEvent& WXUNUSED(event) )
{
if ( y < m_bottomy )
{
// Select property here as well
wxPGProperty* p = m_propHover;
if ( p != m_selected )
DoSelectProperty( p );
// Send double-click event.
SendEvent( <API key>, m_propHover );
return true;
}
return false;
}
/*
// Splits text into lines so that each will have width less than arg maxWidth.
// * Returns string with line breaks inserted into appropriate positions.
// * Keeps words together.
// * Useful in conjunction with wxWindow::SetToolTip and wxDC::DrawLabel.
static wxString <API key>(wxDC& dc, const wxString& text, int lineWidth)
{
if ( !text.length() )
return text;
wxString resultLine;
wxArrayInt extents;
unsigned int index = 0;
unsigned int maxIndex = text.length() - 1;
unsigned int prevSplitIndex = 0;
unsigned int prevCanSplitIndex = 0;
int lineCheckWidth = lineWidth;
wxChar prevA = wxT('\0');
dc.<API key>(text,extents);
wxASSERT( text.length() == extents.GetCount() );
while ( index <= maxIndex )
{
const wxChar A = text[index];
if ( !wxIsalnum(prevA) )
{
// Can split here
prevCanSplitIndex = index;
}
else
{
// Can't split here
}
if ( ( (extents[index] >= lineCheckWidth || A == wxT('\n')) &&
index > prevCanSplitIndex ) ||
index == maxIndex )
{
// Need to split now
unsigned int useSplit = prevCanSplitIndex;
if ( useSplit <= prevSplitIndex ||
index >= maxIndex )
useSplit = index;
resultLine << text.Mid(prevSplitIndex,<API key>);
if ( index >= maxIndex )
break;
else
if ( A != wxT('\n') )
{
resultLine.Append(_T("\n"));
//resultLine.Append(text.Mid(useSplit,text.length()-useSplit));
//break;
}
prevSplitIndex = useSplit;
lineCheckWidth = extents[useSplit] + lineWidth;
//widSum = 0;
index = useSplit;
prevA = wxT('\0');
}
else
{
index++;
prevA = A;
}
}
return resultLine;
}
*/
#if <API key>
void wxPropertyGrid::SetToolTip( const wxString& tipString )
{
if ( tipString.length() )
{
//wxClientDC dc(this);
//wxString finalString = <API key>(dc,tipString,350);
//wxScrolledWindow::SetToolTip(finalString);
wxScrolledWindow::SetToolTip(tipString);
}
else
{
#if <API key>
wxScrolledWindow::SetToolTip( m_emptyString );
#else
wxScrolledWindow::SetToolTip( NULL );
#endif
}
}
#endif // #if <API key>
// Return false if should be skipped
bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, wxMouseEvent &event )
{
// Safety check (needed because mouse capturing may
// otherwise freeze the control)
if ( m_dragStatus > 0 && !event.Dragging() )
{
//wxLogDebug(wxT("MOUSE CAPTURE SAFETY RELEASE TRIGGERED"));
HandleMouseUp(x,y,event);
}
if ( m_dragStatus > 0 )
{
if ( x > (m_marginWidth + wxPG_DRAG_MARGIN) &&
x < (m_width - wxPG_DRAG_MARGIN) )
{
#if wxPG_HEAVY_GFX
int new_splitterx = x - m_dragOffset;
// Splitter redraw required?
if ( new_splitterx != m_splitterx )
{
if ( m_selected )
<API key>( new_splitterx, m_width );
// Move everything
m_splitterx = new_splitterx;
m_fSplitterX = (float) new_splitterx;
Update();
RedrawAllVisible();
}
#else
if ( x != m_splitterx )
{
<API key>(false)
if ( <API key> != -1 )
<API key>( dc, <API key> );
m_splitterx = x;
m_fSplitterX = (float) x;
<API key>( dc, x );
<API key> = x;
}
#endif
m_dragStatus = 2;
}
return false;
}
else
{
int ih = m_lineHeight;
int sy = y;
#if <API key>
wxPGProperty* prevHover = m_propHover;
unsigned char prevSide = m_mouseSide;
#endif
// On which item it hovers
if ( ( !m_propHover && y < m_bottomy)
||
( m_propHover && ( sy < m_propHover->m_y || sy >= (m_propHover->m_y+ih) ) )
)
{
// Mouse moves on another property
m_propHover = DoGetItemAtY(y);
// Send hover event
SendEvent( <API key>, m_propHover );
}
#if <API key>
// Store which side we are on
m_mouseSide = 0;
if ( x >= m_splitterx )
m_mouseSide = 2;
else if ( x >= m_marginWidth )
m_mouseSide = 1;
// If tooltips are enabled, show label or value as a tip
// in case it doesn't otherwise show in full length.
if ( m_windowStyle & wxPG_TOOLTIPS )
{
wxToolTip* tooltip = GetToolTip();
if ( m_propHover != prevHover || prevSide != m_mouseSide )
{
if ( m_propHover && m_propHover->GetParentingType() <= 0 )
{
if ( GetExtraStyle() & <API key> )
{
// Show help string as a tooltip
wxString tipString = m_propHover->GetHelpString();
SetToolTip(tipString);
}
else
{
// Show cropped value string as a tooltip
wxString tipString;
int space = 0;
if ( m_mouseSide == 1 )
{
tipString = m_propHover->m_label;
space = <API key>;
}
else if ( m_mouseSide == 2 )
{
tipString = m_propHover->GetDisplayedString();
space = m_width - m_splitterx;
if ( m_propHover->m_flags & <API key> )
space -= <API key> + <API key> + <API key>;
}
if ( space )
{
int tw, th;
GetTextExtent( tipString, &tw, &th, 0, 0, &m_font );
if ( tw > space )
{
SetToolTip( tipString );
}
}
else
{
if ( tooltip )
{
#if <API key>
wxScrolledWindow::SetToolTip( m_emptyString );
#else
wxScrolledWindow::SetToolTip( NULL );
#endif
}
}
}
}
else
{
if ( tooltip )
{
#if <API key>
wxScrolledWindow::SetToolTip( m_emptyString );
#else
wxScrolledWindow::SetToolTip( NULL );
#endif
}
}
}
}
#endif
if ( x > (m_splitterx + <API key>) ||
x < (m_splitterx - <API key>) ||
y >= m_bottomy ||
(m_windowStyle & <API key>) )
{
// hovering on something else
if ( m_curcursor != wxCURSOR_ARROW )
CustomSetCursor( wxCURSOR_ARROW );
}
else
{
// Do not allow splitter cursor on caption items.
// (also not if we were dragging and its started
// outside the splitter region)
if ( m_propHover &&
m_propHover->GetParentingType() <= 0 &&
!event.Dragging() )
{
// hovering on splitter
// NB: Condition disabled since MouseLeave event (from the editor control) cannot be
// reliably detected.
//if ( m_curcursor != wxCURSOR_SIZEWE )
CustomSetCursor( wxCURSOR_SIZEWE, true );
return false;
}
else
{
// hovering on something else
if ( m_curcursor != wxCURSOR_ARROW )
CustomSetCursor( wxCURSOR_ARROW );
}
}
}
return true;
}
// Also handles Leaving event
bool wxPropertyGrid::HandleMouseUp( int x, unsigned int y, wxMouseEvent &WXUNUSED(event) )
{
bool res = false;
#if __MOUSE_DEBUGGING__
wxLogDebug( wxT(" \\--> HandleMouseUp") );
#endif
// No event type check - basicly calling this method should
// just stop dragging.
//if( event.LeftUp() || event.Leaving() )
// Left up after dragged?
if ( m_dragStatus >= 1 )
{
// End Splitter Dragging
#if __MOUSE_DEBUGGING__
wxLogDebug( wxT(" dragging ends") );
#endif
// DO NOT ENABLE FOLLOWING LINE!
// (it is only here as a reminder to not to do it)
//m_splitterx = x;
#if wxPG_HEAVY_GFX
//Refresh();
#else
<API key>( -1 ); // -1 tells not to make change
// Hack to clear-up editor graphics mess (on wxMSW, atleast)
if ( m_selected )
DrawItem ( m_selected );
#endif
// Disable splitter auto-centering
m_iFlags |= <API key>;
// This is necessary to return cursor
END_MOUSE_CAPTURE
// Set back the default cursor, if necessary
if ( x > (m_splitterx + <API key>) ||
x < (m_splitterx - <API key>) ||
y >= m_bottomy )
{
CustomSetCursor( wxCURSOR_ARROW );
}
m_dragStatus = 0;
#if wxPG_HEAVY_GFX
// Control background needs to be cleared
if ( !(m_iFlags & <API key>) && m_selected )
DrawItem ( m_selected );
#endif
if ( m_wndPrimary )
{
m_wndPrimary->Show ( true );
}
#if <API key>
// Fixes button disappearance bug
if ( m_wndSecondary )
m_wndSecondary->Show ( true );
#endif
// This clears the focus.
m_editorFocused = 0;
}
return res;
}
bool wxPropertyGrid::OnMouseCommon( wxMouseEvent& event, int* px, int* py )
{
int ux, uy;
<API key>( event.m_x, event.m_y, &ux, &uy );
// Hide popup on clicks
// FIXME: Not necessary after transient window implemented
if ( event.GetEventType() != wxEVT_MOTION )
if ( m_wndPrimary && m_wndPrimary->IsKindOf(CLASSINFO(<API key>)) )
{
((<API key>*)m_wndPrimary)->HidePopup();
}
//if (printmsg) wxLogDebug( wxT("On") wxT(#func) wxT("( %i, %i )"),(int)ux,(int)uy );
wxRect r;
wxWindow* wnd = m_wndPrimary;
if ( wnd )
r = wnd->GetRect();
if ( wnd == (wxWindow*) NULL || m_dragStatus ||
(
ux <= (m_splitterx + <API key>) ||
event.m_y < r.y ||
event.m_y >= (r.y+r.height)
)
)
{
*px = ux;
*py = uy;
return true;
}
else
{
if ( m_curcursor != wxCURSOR_ARROW ) CustomSetCursor ( wxCURSOR_ARROW );
}
return false;
}
void wxPropertyGrid::OnMouseClick( wxMouseEvent &event )
{
int x, y;
if ( OnMouseCommon( event, &x, &y ) )
{
HandleMouseClick(x,y,event);
}
event.Skip();
}
void wxPropertyGrid::OnMouseRightClick( wxMouseEvent &event )
{
int x, y;
<API key>( event.m_x, event.m_y, &x, &y );
<API key>(x,y,event);
event.Skip();
}
void wxPropertyGrid::OnMouseDoubleClick( wxMouseEvent &event )
{
// Always run standard mouse-down handler as well
OnMouseClick(event);
int x, y;
<API key>( event.m_x, event.m_y, &x, &y );
<API key>(x,y,event);
event.Skip();
}
void wxPropertyGrid::OnMouseMove( wxMouseEvent &event )
{
int x, y;
if ( OnMouseCommon ( event, &x, &y ) )
{
HandleMouseMove(x,y,event);
}
event.Skip();
}
void wxPropertyGrid::OnMouseUp( wxMouseEvent &event )
{
int x, y;
if ( OnMouseCommon ( event, &x, &y ) )
{
HandleMouseUp(x,y,event);
}
event.Skip();
}
void wxPropertyGrid::OnMouseEntry( wxMouseEvent &event )
{
// This may get called from child control as well, so event's
// mouse position cannot be relied on.
//int x = event.m_x;
//int y = event.m_y;
if ( event.Entering() )
{
if ( !(m_iFlags & <API key>) )
{
#if __MOUSE_DEBUGGING__
wxLogDebug(wxT("Mouse Enters Window"));
#endif
//SetCursor ( *wxSTANDARD_CURSOR );
// TODO: Fix this (detect parent and only do
// cursor trick if it is a manager).
wxASSERT( GetParent() );
GetParent()->SetCursor(wxNullCursor);
m_iFlags |= <API key>;
//if ( m_wndPrimary ) m_wndPrimary->Show ( true );
}
else
GetParent()->SetCursor(wxNullCursor);
}
else if ( event.Leaving() )
{
// Without this, wxSpinCtrl editor will sometimes have wrong cursor
SetCursor( wxNullCursor );
// Get real cursor position
wxPoint pt = ScreenToClient(::wxGetMousePosition());
if ( ( pt.x <= 0 || pt.y <= 0 || pt.x >= m_width || pt.y >= m_height ) )
{
//if ( <API key>() )
{
if ( (m_iFlags & <API key>) )
{
#if __MOUSE_DEBUGGING__
wxLogDebug(wxT("Mouse Leaves Window"));
#endif
m_iFlags &= ~(<API key>);
//if ( m_wndPrimary ) m_wndPrimary->Show ( false );
}
if ( m_dragStatus )
wxPropertyGrid::HandleMouseUp ( -1, 10000, event );
}
}
else
{
/*#if <API key>
// cursor must be reset because EVT_MOTION handler is not there to do it
if ( m_curcursor != wxCURSOR_ARROW ) CustomSetCursor ( wxCURSOR_ARROW );
#endif*/
}
}
event.Skip();
}
// if (printmsg) wxLogDebug( wxT("On") wxT(#func) wxT("Child ( %i, %i )"),(int)event.m_x,(int)event.m_y );
// Common code used by various OnMouseXXXChild methods.
bool wxPropertyGrid::OnMouseChildCommon( wxMouseEvent &event, int* px, int *py )
{
wxWindow* topCtrlWnd = (wxWindow*)event.GetEventObject();
wxASSERT( topCtrlWnd );
int x, y;
event.GetPosition(&x,&y);
#if <API key>
// Take clipper window into account
if (topCtrlWnd->GetPosition().x < 1 &&
!topCtrlWnd->IsKindOf(CLASSINFO(wxPGClipperWindow)))
{
topCtrlWnd = topCtrlWnd->GetParent();
wxASSERT( topCtrlWnd->IsKindOf(CLASSINFO(wxPGClipperWindow)) );
x -= ((wxPGClipperWindow*)topCtrlWnd)->GetXClip();
y -= ((wxPGClipperWindow*)topCtrlWnd)->GetYClip();
}
#endif
wxRect r = topCtrlWnd->GetRect();
if ( !m_dragStatus &&
x > (m_splitterx-r.x+<API key>) &&
y >= 0 && y < r.height \
)
{
if ( m_curcursor != wxCURSOR_ARROW ) CustomSetCursor ( wxCURSOR_ARROW );
event.Skip();
}
else
{
<API key>( event.m_x + r.x, event.m_y + r.y, \
px, py );
return true;
}
return false;
}
/*void wxPropertyGrid::OnMouseEntryChild ( wxMouseEvent &event )
{
wxLogDebug(wxT("Entering/Leaving Child..."));
event.Skip();
}*/
void wxPropertyGrid::OnMouseClickChild( wxMouseEvent &event )
{
int x,y;
if ( OnMouseChildCommon(event,&x,&y) )
{
bool res = HandleMouseClick(x,y,event);
if ( !res ) event.Skip();
/*if ( event.GetEventType() == wxEVT_LEFT_DCLICK )
{
<API key>( x, y, event );
event.Skip();
}*/
}
}
void wxPropertyGrid::<API key>( wxMouseEvent &event )
{
int x,y;
wxASSERT( m_wndPrimary );
// These coords may not be exact (about +-2),
// but that should not matter (right click is about item, not position).
wxPoint pt = m_wndPrimary->GetPosition();
<API key>( event.m_x + pt.x, event.m_y + pt.y, &x, &y );
wxASSERT( m_selected );
m_propHover = m_selected;
bool res = <API key>(x,y,event);
if ( !res ) event.Skip();
}
void wxPropertyGrid::OnMouseMoveChild( wxMouseEvent &event )
{
int x,y;
if ( OnMouseChildCommon(event,&x,&y) )
{
bool res = HandleMouseMove(x,y,event);
if ( !res ) event.Skip();
}
}
void wxPropertyGrid::OnMouseUpChild( wxMouseEvent &event )
{
int x,y;
if ( OnMouseChildCommon(event,&x,&y) )
{
bool res = HandleMouseUp(x,y,event);
if ( !res ) event.Skip();
}
}
// wxPropertyGrid keyboard event handling
void wxPropertyGrid::<API key>( int dir )
{
<API key> evt;
evt.SetFlags(<API key>::FromTab|
(dir?<API key>::IsForward:
<API key>::IsBackward));
evt.SetEventObject(this);
GetEventHandler()->AddPendingEvent(evt);
}
void wxPropertyGrid::HandleKeyEvent(wxKeyEvent &event)
{
// Handles key event when editor control is not focused.
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::HandleKeyEvent(%i)"),(int)event.GetKeyCode() );
#endif
wxASSERT( !m_frozen );
if ( m_frozen )
return;
// Travelsal between items, collapsing/expanding, etc.
int keycode = event.GetKeyCode();
if ( keycode == WXK_TAB )
{
<API key>( event.ShiftDown()?0:1 );
return;
}
// Ignore Alt and Control when they are down alone
if ( keycode == WXK_ALT ||
keycode == WXK_CONTROL )
{
event.Skip();
return;
}
if ( m_selected )
{
// Show dialog?
if ( <API key>(event) )
return;
wxPGProperty* p = m_selected;
int selectDir = -2;
if ( p->GetParentingType() != 0 &&
!(p->m_flags & wxPG_PROP_DISABLED)
)
{
//<API key>* pwc = (<API key>*)p;
if ( keycode == WXK_LEFT )
{
if ( (m_windowStyle & wxPG_HIDE_MARGIN) || Collapse ( p ) )
keycode = 0;
}
else if ( keycode == WXK_RIGHT )
{
if ( (m_windowStyle & wxPG_HIDE_MARGIN) || Expand ( p ) )
keycode = 0;
}
}
if ( keycode )
{
if ( keycode == WXK_UP || keycode == WXK_LEFT )
{
selectDir = 0;
}
else if ( keycode == WXK_DOWN || keycode == WXK_RIGHT )
{
selectDir = 1;
}
else
{
event.Skip();
}
}
if ( selectDir >= -1 )
{
p = GetNeighbourItem( p, true, selectDir );
if ( p )
DoSelectProperty(p);
}
}
else
{
// If nothing was selected, select the first item now
// (or navigate out of tab).
if ( keycode != WXK_ESCAPE )
{
wxPGProperty* p = GetFirst();
if ( p ) DoSelectProperty(p);
}
}
}
// Potentially handles a keyboard event for editor controls.
// Returns false if event should *not* be skipped (on true it can
// be optionally skipped).
// Basicly, false means that SelectProperty was called (or was about
// to be called, if canDestroy was false).
bool wxPropertyGrid::HandleChildKey( wxKeyEvent& event, bool canDestroy )
{
int keycode = event.GetKeyCode();
bool res = true;
#if <API key>
wxLogDebug( wxT("wxPropertyGrid::HandleChildKey(%i)"),(int)event.GetKeyCode() );
#endif
// Unfocus?
if ( keycode == WXK_ESCAPE )
{
// Esc cancels any changes
<API key>();
wxPGProperty* p = m_selected;
res = false;
if ( canDestroy )
{
DoSelectProperty( (wxPGProperty*)NULL, wxPG_SEL_NOVALIDATE );
DoSelectProperty( p );
}
}
return res;
}
void wxPropertyGrid::OnKey( wxKeyEvent &event )
{
// Events to editor controls should get relayed here.
wxWindow* focused = wxWindow::FindFocus();
//wxLogDebug(wxT("OnKey"));
if ( m_wndPrimary &&
(focused==m_wndPrimary
|| m_editorFocused
#if <API key>
|| ((m_wndPrimary->IsKindOf(CLASSINFO(wxPGClipperWindow))) &&
((wxPGClipperWindow*)m_wndPrimary)->GetControl() == focused)
#endif
) )
{
// Child key must be processed here, since it can
// destroy the control which is referred by its own
// event handling.
HandleChildKey( event, true );
}
else
HandleKeyEvent( event );
}
void wxPropertyGrid::OnKeyUp(wxKeyEvent &event)
{
m_keyComboConsumed = 0;
event.Skip();
}
void wxPropertyGrid::OnNavigationKey( <API key>& event )
{
// Ignore events that occur very close to focus set
if ( m_iFlags & <API key> )
{
m_iFlags &= ~(<API key>);
event.Skip();
return;
}
wxPGProperty* next = (wxPGProperty*) NULL;
int dir = event.GetDirection()?1:0;
if ( m_selected )
{
if ( dir == 1 && (m_wndPrimary || m_wndSecondary) )
{
wxWindow* focused = wxWindow::FindFocus();
wxWindow* wndToCheck = GetEditorControl();
// ODComboBox focus goes to its text ctrl, so we need to use it instead
if ( wndToCheck && wndToCheck->IsKindOf(CLASSINFO(<API key>)) )
{
wxTextCtrl* comboTextCtrl = ((<API key>*)wndToCheck)->GetTextCtrl();
if ( comboTextCtrl )
wndToCheck = comboTextCtrl;
}
/*
// Because of problems navigating from wxButton, do not go to it.
if ( !wndToCheck )
{
// No primary, use secondary
wndToCheck = m_wndSecondary;
}
// If it has editor button, focus to it after the primary editor.
// NB: Doesn't work since wxButton on wxMSW doesn't seem to propagate
// key events (yes, I'm using wxWANTS_CHARS with it, and yes I
// have somewhat debugged in window.cpp itself).
else if ( focused == wndToCheck &&
m_wndSecondary &&
!(GetExtraStyle() & <API key>) )
{
wndToCheck = m_wndSecondary;
wxLogDebug(wxT("Exp1"));
}
*/
if ( focused != wndToCheck &&
wndToCheck )
{
wndToCheck->SetFocus();
// Select all text in wxTextCtrl etc.
if ( m_wndPrimary && wndToCheck == m_wndPrimary )
m_selected->GetEditorClass()->OnFocus(m_selected,wndToCheck);
m_editorFocused = 1;
next = m_selected;
}
}
if ( !next )
{
next = GetNeighbourItem(m_selected,true,dir);
if ( next )
{
// This allows preventing NavigateOut to occur
DoSelectProperty( next, wxPG_SEL_FOCUS );
}
}
}
if ( !next )
event.Skip();
}
bool wxPropertyGrid::<API key>( wxKeyEvent &event )
{
int keycode = event.GetKeyCode();
// Does the keycode trigger button?
if ( keycode == m_pushButKeyCode &&
m_wndSecondary &&
(!<API key> || event.AltDown()) &&
(!<API key> || event.ControlDown()) )
{
m_keyComboConsumed = 1;
wxCommandEvent evt(<API key>,m_wndSecondary->GetId());
GetEventHandler()->AddPendingEvent(evt);
return true;
}
return false;
}
void wxPropertyGrid::OnChildKeyDown( wxKeyEvent &event )
{
int keycode = event.GetKeyCode();
// Ignore Alt and Control when they are down alone
if ( keycode == WXK_ALT ||
keycode == WXK_CONTROL )
{
event.Skip();
return;
}
if ( <API key>(event) )
return;
// Since event handling may destroy the control which
// triggered this event, we need to send it separately
// to the wxPropertyGrid itself. Also, to allow pushed
// event handler to grab ENTER, ESC and such, this
// has been changed to add all keys as events.
if ( HandleChildKey(event,false) == true )
event.Skip();
GetEventHandler()->AddPendingEvent(event);
}
void wxPropertyGrid::OnChildKeyUp( wxKeyEvent &event )
{
m_keyComboConsumed = 0;
GetEventHandler()->AddPendingEvent(event);
event.Skip();
}
// wxPropertyGrid miscellaneous event handling
void wxPropertyGrid::OnIdle( wxIdleEvent& WXUNUSED(event) )
{
// Check if the focus is in this control or one of its children
wxWindow* newFocused = wxWindow::FindFocus();
if ( newFocused != m_curFocused )
HandleFocusChange( newFocused );
}
// Called by focus event handlers. newFocused is the window that becomes focused.
void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused )
{
unsigned int oldFlags = m_iFlags;
//wxLogDebug(wxT("HandleFocusChange: %s"),newFocused?newFocused->GetClassInfo()->GetClassName():wxT("NULL"));
m_iFlags &= ~(wxPG_FL_FOCUSED);
wxWindow* parent = newFocused;
// This must be one of nextFocus' parents.
while ( parent )
{
// Use m_eventObject, which is either wxPropertyGrid or
// <API key>, as appropriate.
if ( parent == m_eventObject )
{
m_iFlags |= wxPG_FL_FOCUSED;
break;
}
parent = parent->GetParent();
}
m_curFocused = newFocused;
if ( (m_iFlags & wxPG_FL_FOCUSED) !=
(oldFlags & wxPG_FL_FOCUSED) )
{
// On each focus kill, mark the next nav key event
// to be ignored (can't do on set focus since the
// event would occur before it).
if ( !(m_iFlags & wxPG_FL_FOCUSED) )
{
m_iFlags |= <API key>;
// Need to store changed value
<API key>();
}
else
{
/*
//
// Preliminary code for tab-order respecting
// tab-traversal (but should be moved to
// OnNav handler)
//
wxWindow* prevFocus = event.GetWindow();
wxWindow* useThis = this;
if ( m_iFlags & wxPG_FL_IN_MANAGER )
useThis = GetParent();
if ( prevFocus &&
prevFocus->GetParent() == useThis->GetParent() )
{
wxList& children = useThis->GetParent()->GetChildren();
wxNode* node = children.Find(prevFocus);
if ( node->GetNext() &&
useThis == node->GetNext()->GetData() )
DoSelectProperty(GetFirst());
else if ( node->GetPrevious () &&
useThis == node->GetPrevious()->GetData() )
DoSelectProperty(GetLastProperty());
}
*/
m_iFlags &= ~(<API key>);
}
// Redraw selected
if ( m_selected && (m_iFlags & wxPG_FL_INITIALIZED) )
DrawItem( m_selected );
}
}
void wxPropertyGrid::OnFocusEvent( wxFocusEvent& event )
{
#if 1
if ( event.GetEventType() == wxEVT_SET_FOCUS )
HandleFocusChange((wxWindow*)event.GetEventObject());
// Line changed to "else" when applying patch #1675902
//else if ( event.GetWindow() )
else
HandleFocusChange(event.GetWindow());
event.Skip();
#else
unsigned int oldFlags = m_iFlags;
// Determine the current focus state
if ( event.GetEventType() == wxEVT_SET_FOCUS ||
event.GetEventType() == wxEVT_CHILD_FOCUS )
{
m_iFlags |= wxPG_FL_FOCUSED;
}
else
{
wxWindow* nextFocus = event.GetWindow();
m_iFlags &= ~(wxPG_FL_FOCUSED);
wxWindow* parent = nextFocus;
//wxLogDebug(wxT("KillFocus: %s"),parent->GetClassInfo()->GetClassName());
// This must be one of nextFocus' parents.
while ( parent )
{
if ( parent == this )
{
m_iFlags |= wxPG_FL_FOCUSED;
break;
}
parent = parent->GetParent();
}
}
if ( (m_iFlags & wxPG_FL_FOCUSED) !=
(oldFlags & wxPG_FL_FOCUSED) )
{
// On each focus kill, mark the next nav key event
// to be ignored (can't do on set focus since the
// event would occur before it).
if ( !(m_iFlags & wxPG_FL_FOCUSED) )
{
m_iFlags |= <API key>;
// Need to store changed value
<API key>();
}
else
{
/*
//
// Preliminary code for tab-order respecting
// tab-traversal (but should be moved to
// OnNav handler)
//
wxWindow* prevFocus = event.GetWindow();
wxWindow* useThis = this;
if ( m_iFlags & wxPG_FL_IN_MANAGER )
useThis = GetParent();
if ( prevFocus &&
prevFocus->GetParent() == useThis->GetParent() )
{
wxList& children = useThis->GetParent()->GetChildren();
wxNode* node = children.Find(prevFocus);
if ( node->GetNext() &&
useThis == node->GetNext()->GetData() )
DoSelectProperty(GetFirst());
else if ( node->GetPrevious () &&
useThis == node->GetPrevious()->GetData() )
DoSelectProperty(GetLastProperty());
}
*/
m_iFlags &= ~(<API key>);
}
// Redraw selected
if ( m_selected && (m_iFlags & wxPG_FL_INITIALIZED) )
DrawItem( m_selected );
}
event.Skip();
#endif
}
void wxPropertyGrid::OnChildFocusEvent( wxChildFocusEvent& event )
{
HandleFocusChange((wxWindow*)event.GetEventObject());
event.Skip();
}
void wxPropertyGrid::OnScrollEvent( wxScrollWinEvent &event )
{
m_iFlags |= wxPG_FL_SCROLLED;
event.Skip();
}
void wxPropertyGrid::OnCaptureChange( <API key>& WXUNUSED(event) )
{
if ( m_iFlags & <API key> )
{
#if __MOUSE_DEBUGGING__
wxLogDebug( wxT("wxPropertyGrid: mouse capture lost") );
#endif
m_iFlags &= ~(<API key>);
}
}
// Property text-based storage
#define <API key> 8
// <API key> array
static const wxChar* <API key>[<API key>] =
{
wxT("Modified"),
wxT("Disabled"),
wxT("LowPriority"),
(const wxChar*) NULL, // <API key> is auto-generated flag
wxT("LimitedEditing"),
wxT("Unspecified"),
(const wxChar*) NULL, // Special flags cannot be stored as-is
(const wxChar*) NULL
};
wxString wxPGProperty::GetAttributes( unsigned int flagmask )
{
wxASSERT(this);
wxString s;
unsigned int i;
unsigned int flags = ((unsigned int)m_flags) &
flagmask &
~(<API key> |
<API key> |
<API key>);
if ( !flags )
return wxEmptyString;
for ( i=0; i<<API key>; i++ )
{
if ( flags & (1<<i) )
{
s.append( <API key>[i] );
flags &= ~(1<<i);
if ( !flags )
break;
s.append(wxT(", "));
}
}
return s;
}
void wxPGProperty::SetAttributes( const wxString& attributes )
{
wxASSERT(this);
size_t i;
<API key>(attributes,wxT(','))
for (i=0;i<<API key>;i++)
{
const wxChar* flagText = <API key>[i];
if ( flagText && token == flagText )
{
m_flags |= ( 1<<i );
break;
}
}
<API key>()
}
// Returns name of property without 'Property' at the end, and 'wx'
// in the beginning (if any).
wxString <API key>::<API key>( wxPGId id )
{
<API key>(wxEmptyString)
if ( p->GetParentingType() != 1 )
{
const wxChar* src = p->GetClassName();
wxString s;
if ( src[0] == wxT('w') && src[1] == wxT('x') )
s = &src[2];
else
s = src;
wxASSERT( (((int)s.length())-8) > 0 );
s.Truncate(s.length()-8);
//s.LowerCase();
return s;
}
return wxT("Category");
}
wxPGId <API key>::GetPropertyByNameA( wxPGPropNameStr name ) const
{
wxPGId id = GetPropertyByName(name);
wxASSERT_MSG(wxPGIdIsOk(id),wxString::Format(wxT("no property with name '%s'"),name.c_str()));
return id;
}
// VariantDatas
#if <API key>
<API key>(<API key>, wxVariantData)
<API key>(wxPGVariantDataSize, wxVariantData)
<API key>(<API key>, wxVariantData)
<API key>(<API key>, wxVariantData)
<API key>(<API key>, wxVariantData)
#ifdef __WXPYTHON__
<API key>(<API key>, wxVariantData)
#endif
#endif
// Value type related methods (should all be pretty much static).
wxPGValueType::~wxPGValueType()
{
}
<API key> wxPGValueType::GetCustomTypeName() const
{
return GetTypeName();
}
// Implement default types.
<API key>(wxString,wxStringProperty,<API key>,GetString,wxEmptyString)
<API key>(long,wxIntProperty,wxPGTypeName_long,GetLong,(long)0)
<API key>(double,wxFloatProperty,wxPGTypeName_double,GetDouble,0.0)
<API key>(wxArrayString,<API key>,<API key>,GetArrayString,wxArrayString())
// Bool is a special case... thanks to the C++'s bool vs int vs long inconsistency issues.
const wxPGValueType *wxPGValueType_bool = (wxPGValueType *) NULL;
class <API key> : public wxPGValueType
{
public:
virtual <API key> GetTypeName() const { return wxPGTypeName_long; }
virtual <API key> GetCustomTypeName() const { return wxPGTypeName_bool; }
virtual wxPGVariant GetDefaultValue() const { return wxPGVariant((long)0); }
virtual wxVariant GenerateVariant( wxPGVariant value, const wxString& name ) const
{ return wxVariant ( value.GetBool(), name ); }
virtual wxPGProperty* GenerateProperty( const wxString& label, const wxString& name ) const
{
return wxPG_NEWPROPERTY(Bool,label,name,false);
}
virtual void SetValueFromVariant( wxPGProperty* property, wxVariant& value ) const
{
#if defined(__WXDEBUG__) || defined(__WXPYTHON__)
wxCHECK_RET( wxStrcmp(wxPGTypeName_bool,value.GetType().c_str()) == 0,
wxT("SetValueFromVariant: wxVariant type mismatch.") );
#endif
property->DoSetValue(value.GetBool()?(long)1:(long)0);
}
};
// Implement nonetype.
const wxPGValueType *wxPGValueType_none = (wxPGValueType*) NULL;
class <API key> : public wxPGValueType
{
public:
virtual <API key> GetTypeName() const { return wxT("null"); }
virtual wxPGVariant GetDefaultValue() const { return wxPGVariant((long)0); }
virtual wxVariant GenerateVariant( wxPGVariant, const wxString& name ) const
{ return wxVariant( (long)0, name ); }
virtual wxPGProperty* GenerateProperty( const wxString&, const wxString& ) const
{ return (wxPGProperty*) NULL; }
virtual void SetValueFromVariant( wxPGProperty*, wxVariant& ) const
{ }
};
// Implement void* type.
const wxPGValueType *wxPGValueType_void = (wxPGValueType*) NULL;
class <API key> : public wxPGValueType
{
public:
virtual <API key> GetTypeName() const { return wxPGTypeName_void; }
virtual wxPGVariant GetDefaultValue() const { return wxPGVariant((void*)NULL); }
virtual wxVariant GenerateVariant( wxPGVariant value, const wxString& name ) const
{ return wxVariant( <API key>(value), name ); }
virtual wxPGProperty* GenerateProperty( const wxString&, const wxString& ) const
{ return (wxPGProperty*) NULL; }
virtual void SetValueFromVariant( wxPGProperty* property, wxVariant& value ) const
{
#if defined(__WXDEBUG__) || defined(__WXPYTHON__)
wxCHECK_RET( wxStrcmp(GetTypeName(),value.GetType().c_str()) == 0,
wxT("SetValueFromVariant: wxVariant type mismatch.") );
#endif
property->DoSetValue(value.GetVoidPtr());
}
};
#ifdef __WXPYTHON__
// Implement PyObject* type.
const wxPGValueType *<API key> = (wxPGValueType*) NULL;
class <API key> : public wxPGValueType
{
public:
virtual <API key> GetTypeName() const { return wxT("PyObject"); }
virtual wxPGVariant GetDefaultValue() const
{
return wxVariant( new <API key>(Py_None) );
}
virtual wxVariant GenerateVariant( wxPGVariant value, const wxString& name ) const
{
value.SetName( name );
return value; // Can be done since under wxPython, wxPGVariant is wxVariant
}
virtual wxPGProperty* GenerateProperty( const wxString&, const wxString& ) const
{
return (wxPGProperty*) NULL;
}
virtual void SetValueFromVariant( wxPGProperty* property, wxVariant& value ) const
{
#if defined(__WXDEBUG__) || defined(__WXPYTHON__)
wxCHECK_RET( wxStrcmp(GetTypeName(),value.GetType().c_str()) == 0,
wxT("SetValueFromVariant: wxVariant type mismatch.") );
#endif
property->DoSetValue(value);
}
};
#endif // __WXPYTHON__
// Registers all default value types
void wxPropertyGrid::<API key>()
{
<API key>( none );
<API key>( wxString );
<API key>( long );
<API key>( bool );
<API key>( double );
<API key>( void );
<API key>( wxArrayString );
#ifdef __WXPYTHON__
<API key>( PyObject );
#endif
}
// noDefCheck = true prevents infinite recursion.
wxPGValueType* wxPropertyGrid::RegisterValueType( wxPGValueType* valueclass, bool noDefCheck, const wxString& className )
{
wxASSERT( valueclass );
<API key>()
if ( !noDefCheck && wxPGGlobalVars->m_dictValueType.empty() )
<API key>();
wxString temp_str;
<API key> name_ = valueclass->GetType();
const wxChar* name = wxPG_TO_WXCHAR_PTR(name_);
wxPGValueType* p_at_slot = (wxPGValueType*) wxPGGlobalVars->m_dictValueType[name];
if ( !p_at_slot )
{
wxPGGlobalVars->m_dictValueType[name] = (void*) valueclass;
#if <API key>
wxPGGlobalVars-><API key>[className] = (void*) valueclass;
#else
wxUnusedVar(className);
#endif
return valueclass;
}
// Delete given object instance, but only if it wasn't the same as in the hashmap.
if ( p_at_slot != valueclass )
{
delete valueclass;
}
return p_at_slot;
}
/*
* <API key>
*/
//<API key>(<API key>, wxVariantData)
<API key>::<API key>()
: wxVariantData()
{
}
<API key>::~<API key>()
{
}
#if wxUSE_STD_IOSTREAM
bool <API key>::Write(wxSTD ostream&) const
{
// Not implemented
return true;
}
#endif
bool <API key>::Write(wxString&) const
{
// Not implemented
return true;
}
#if wxUSE_STD_IOSTREAM
bool <API key>::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
return false;
}
#endif
bool <API key>::Read(wxString& WXUNUSED(str))
{
// Not implemented
return false;
}
// Editor class specific.
// noDefCheck = true prevents infinite recursion.
wxPGEditor* wxPropertyGrid::RegisterEditorClass( wxPGEditor* editorclass,
const wxString& name,
bool noDefCheck )
{
wxASSERT( editorclass );
<API key>()
if ( !noDefCheck && wxPGGlobalVars->m_mapEditorClasses.empty() )
<API key>();
wxPGGlobalVars->m_mapEditorClasses[name] = (void*)editorclass;
return editorclass;
}
// Registers all default editor classes
void wxPropertyGrid::<API key>()
{
<API key>( TextCtrl );
<API key>( Choice );
<API key>( ComboBox );
<API key>( TextCtrlAndButton );
#if <API key>
<API key>( CheckBox );
#endif
<API key>( ChoiceAndButton );
// Register SpinCtrl etc. editors before use
<API key>();
}
wxPGEditor* <API key>::GetEditorByName( const wxString& editor_name )
{
wxPGEditor* editor = (wxPGEditor*) wxPGGlobalVars->m_mapEditorClasses[editor_name];
wxASSERT_MSG( editor,
wxT("unregistered editor name") );
return editor;
}
// wxPGStringTokenizer
// Needed to handle C-style string lists (e.g. "str1" "str2")
wxPGStringTokenizer::wxPGStringTokenizer( const wxString& str, wxChar delimeter )
: m_str(&str), m_curPos(str.begin()), m_delimeter(delimeter)
{
}
wxPGStringTokenizer::~wxPGStringTokenizer()
{
}
bool wxPGStringTokenizer::HasMoreTokens()
{
const wxString& str = *m_str;
//wxASSERT_MSG( m_curPos != str.end(), wxT("Do not call wxPGStringTokenizer methods after HasMoreTokens has returned false."));
wxString::const_iterator i = m_curPos;
wxUniChar delim = m_delimeter;
wxUniChar a;
wxUniChar prev_a = wxT('\0');
bool inToken = false;
while ( i != str.end() )
{
a = wxPGGetIterChar(str, i);
if ( !inToken )
{
if ( a == delim )
{
inToken = true;
m_readyToken.clear();
}
}
else
{
if ( prev_a != wxT('\\') )
{
if ( a != delim )
{
if ( a != wxT('\\') )
m_readyToken << a;
}
else
{
//wxLogDebug(m_readyToken);
i++;
m_curPos = i;
return true;
}
prev_a = a;
}
else
{
m_readyToken << a;
prev_a = wxT('\0');
}
}
i++;
}
m_curPos = str.end();
if ( inToken )
return true;
return false;
/*
const wxChar* ptr = m_curPos;
const wxChar* ptr_end = &m_str->c_str()[m_str->length()];
size_t store_index = 0xFFFFFFFF;
#if !wxUSE_STL
wxChar* store_ptr_base = (wxChar*) NULL;
#endif
wxChar delim = m_delimeter;
wxChar a = *ptr;
wxChar prev_a = 0;
while ( a )
{
if ( store_index == 0xFFFFFFFF )
{
if ( a == delim )
{
size_t req_len = ptr_end-ptr+1;
#if wxUSE_STL
if ( m_readyToken.length() < req_len )
m_readyToken.resize( req_len, wxT(' ') );
#else
store_ptr_base = m_readyToken.GetWriteBuf( req_len );
#endif
store_index = 0;
prev_a = 0;
}
}
else
{
if ( prev_a != wxT('\\') )
{
if ( a != delim )
{
if ( a != wxT('\\') )
{
#if wxUSE_STL
m_readyToken[store_index] = a;
#else
store_ptr_base[store_index] = a;
#endif
store_index++;
}
}
else
{
#if wxUSE_STL
m_readyToken[store_index] = 0;
m_readyToken.resize(store_index,wxT(' '));
#else
store_ptr_base[store_index] = 0;
m_readyToken.UngetWriteBuf( store_index );
#endif
m_curPos = ptr+1;
return true;
}
prev_a = a;
}
else
{
#if wxUSE_STL
m_readyToken[store_index] = a;
#else
store_ptr_base[store_index] = a;
#endif
store_index++;
prev_a = 0;
}
}
ptr++;
a = *ptr;
}
#if !wxUSE_STL
if ( store_index != 0xFFFFFFFF )
m_readyToken.UngetWriteBuf( store_index );
#endif
m_curPos = (const wxChar*) NULL;
return false;
*/
}
wxString wxPGStringTokenizer::GetNextToken()
{
//wxASSERT_MSG( m_curPos != m_str->end(), wxT("Do not call wxPGStringTokenizer methods after HasMoreTokens has returned false."));
return m_readyToken;
}
// wxPGChoicesData
wxPGChoicesData::wxPGChoicesData()
{
m_refCount = 1;
}
wxPGChoicesData::~wxPGChoicesData()
{
}
// wxPGChoices
void wxPGChoices::Add( const wxChar* label, int value )
{
EnsureData();
if ( value != wxPG_INVALID_VALUE && m_data->m_arrLabels.GetCount() == m_data->m_arrValues.GetCount() )
m_data->m_arrValues.Add( value );
else if ( m_data->m_arrValues.GetCount() > 0 )
m_data->m_arrValues.Add( 0 );
m_data->m_arrLabels.Add ( label );
}
#if wxCHECK_VERSION(2,9,0)
void wxPGChoices::Insert( const wxString& label, int index, int value )
#else
void wxPGChoices::Insert( const wxChar* label, int index, int value )
#endif
{
EnsureData();
if ( value != wxPG_INVALID_VALUE && m_data->m_arrLabels.GetCount() == m_data->m_arrValues.GetCount() )
m_data->m_arrValues.Insert( value, index );
else if ( m_data->m_arrValues.GetCount() > 0 )
m_data->m_arrValues.Insert( 0, index );
m_data->m_arrLabels.Insert( label, index );
}
void wxPGChoices::AddAsSorted( const wxString& label, int value )
{
//wxASSERT_MSG( IsOk(),
// wxT("do not add items to invalid wxPGChoices") );
EnsureData();
size_t index = 0;
wxArrayString& labels = m_data->m_arrLabels;
wxArrayInt& values = m_data->m_arrValues;
while ( index < labels.GetCount() )
{
int cmpRes = labels[index].Cmp(label);
if ( cmpRes > 0 )
break;
index++;
}
if ( value != wxPG_INVALID_VALUE &&
labels.GetCount() == values.GetCount() )
values.Insert ( value, index );
labels.Insert ( label, index );
}
void wxPGChoices::Add( const wxChar** labels, const long* values )
{
//wxASSERT_MSG( IsOk(),
// wxT("do not add items to invalid wxPGChoices") );
EnsureData();
unsigned int itemcount = 0;
const wxChar** p = &labels[0];
while ( *p ) { p++; itemcount++; }
wxArrayString& i_labels = m_data->m_arrLabels;
wxArrayInt& i_values = m_data->m_arrValues;
unsigned int i;
for ( i = 0; i < itemcount; i++ )
{
i_labels.Add ( labels[i] );
}
if ( values )
{
for ( i = 0; i < itemcount; i++ )
{
i_values.Add ( values[i] );
}
}
}
void wxPGChoices::Add( const wxArrayString& arr, const long* values )
{
//wxASSERT_MSG( IsOk(),
// wxT("do not add items to invalid wxPGChoices") );
EnsureData();
wxArrayString& labels = m_data->m_arrLabels;
wxArrayInt& i_values = m_data->m_arrValues;
unsigned int i;
unsigned int itemcount = arr.GetCount();
for ( i = 0; i < itemcount; i++ )
{
labels.Add ( arr[i] );
}
if ( values )
{
for ( i = 0; i < itemcount; i++ )
i_values.Add ( values[i] );
}
}
void wxPGChoices::Add( const wxArrayString& arr, const wxArrayInt& arrint )
{
//wxASSERT_MSG( IsOk(),
// wxT("do not add items to invalid wxPGChoices") );
EnsureData();
wxArrayString& labels = m_data->m_arrLabels;
wxArrayInt& values = m_data->m_arrValues;
unsigned int i;
unsigned int itemcount = arr.GetCount();
for ( i = 0; i < itemcount; i++ )
{
labels.Add ( arr[i] );
}
if ( &arrint && arrint.GetCount() )
for ( i = 0; i < itemcount; i++ )
{
values.Add ( arrint[i] );
}
}
void wxPGChoices::AssignData( wxPGChoicesData* data )
{
Free();
if ( data != <API key> )
{
m_data = data;
data->m_refCount++;
}
}
void wxPGChoices::Init()
{
m_data = <API key>;
}
void wxPGChoices::Free()
{
if ( m_data != <API key> )
{
m_data->m_refCount
if ( m_data->m_refCount < 1 )
delete m_data;
m_data = <API key>;
}
}
// wxPropertyGridEvent
<API key>(wxPropertyGridEvent, wxCommandEvent)
DEFINE_EVENT_TYPE( wxEVT_PG_SELECTED )
DEFINE_EVENT_TYPE( wxEVT_PG_CHANGED )
DEFINE_EVENT_TYPE( <API key> )
DEFINE_EVENT_TYPE( <API key> )
DEFINE_EVENT_TYPE( <API key> )
DEFINE_EVENT_TYPE( <API key> )
DEFINE_EVENT_TYPE( <API key> )
DEFINE_EVENT_TYPE( <API key> )
wxPropertyGridEvent::wxPropertyGridEvent(wxEventType commandType, int id)
: wxCommandEvent(commandType,id)
{
m_property = NULL;
m_pending = false;
}
wxPropertyGridEvent::wxPropertyGridEvent(const wxPropertyGridEvent& event)
: wxCommandEvent(event)
{
m_eventType = event.GetEventType();
m_eventObject = event.m_eventObject;
m_pg = event.m_pg;
m_property = event.m_property;
m_pending = false;
}
wxPropertyGridEvent::~wxPropertyGridEvent()
{
}
wxEvent* wxPropertyGridEvent::Clone() const
{
return new wxPropertyGridEvent( *this );
}
// <API key>
// - common methods for wxPropertyGrid and <API key> -
void <API key>::<API key>( wxPGId id, int attrid,
wxVariant& value, long argFlags )
{
<API key>()
p->SetAttribute(attrid,value);
if ( ( argFlags & wxPG_RECURSE ) && p->GetParentingType() != 0 )
{
<API key>* pwc = (<API key>*)p;
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
<API key>(pwc->Item(i),attrid,value,argFlags);
}
}
void wxPropertyGrid::<API key>( int attrid, wxVariant value )
{
<API key>(GetRoot(),attrid,value,wxPG_RECURSE);
}
void <API key>::SetBoolChoices( const wxChar* true_choice,
const wxChar* false_choice )
{
<API key>()
wxPGGlobalVars->m_boolChoices[0] = false_choice;
wxPGGlobalVars->m_boolChoices[1] = true_choice;
}
wxPGChoices gs_emptyChoices;
wxPGChoices& <API key>::GetPropertyChoices( wxPGId id )
{
<API key>(gs_emptyChoices)
wxPGChoiceInfo ci;
ci.m_choices = (wxPGChoices*) NULL;
p->GetChoiceInfo(&ci);
if ( !ci.m_choices )
return gs_emptyChoices;
return *ci.m_choices;
}
wxPGChoices& <API key>::GetPropertyChoices( wxPGPropNameStr name )
{
<API key>(gs_emptyChoices)
return GetPropertyChoices(wxPGIdGen(p));
}
wxPGId <API key>::DoGetPropertyByName( wxPGPropNameStr name ) const
{
return m_pState-><API key>(name);
}
wxPGId <API key>::GetPropertyByName( wxPGPropNameStr name,
wxPGPropNameStr subname ) const
{
wxPGId id = DoGetPropertyByName(name);
<API key>* pwc = (<API key>*) wxPGIdToPtr(id);
if ( !pwc || !pwc->GetParentingType() )
return wxNullProperty;
return wxPGIdGen(pwc->GetPropertyByName(subname));
}
// Since GetPropertyByName is used *a lot*, this makes sense
// since non-virtual method can be called with less code.
wxPGId <API key>::GetPropertyByName( wxPGPropNameStr name ) const
{
wxPGId id = DoGetPropertyByName(name);
if ( wxPGIdIsOk(id) )
return id;
// Check if its "Property.SubProperty" format
int pos = name.Find(wxT('.'));
if ( pos <= 0 )
return id;
return GetPropertyByName(name.substr(0,pos),
name.substr(pos+1,name.length()-pos-1));
}
bool <API key>::HideProperty( wxPGId id, bool hide )
{
// Hiding properties requires that we are always in the compact mode
m_pState->GetGrid()->Compact(true);
return SetPropertyPriority(id,hide?wxPG_LOW:wxPG_HIGH);
}
// Used by HideProperty as well
bool <API key>::SetPropertyPriority( wxPGId id, int priority )
{
<API key>(false)
wxPropertyGrid* pg = m_pState->GetGrid();
if ( pg == p->GetGrid() )
return pg->SetPropertyPriority(p,priority);
else
m_pState->SetPropertyPriority(p,priority);
return true;
}
bool <API key>::<API key>( wxPGId id, int maxLen )
{
<API key>(false)
wxPropertyGrid* pg = m_pState->GetGrid();
p->m_maxLen = (short) maxLen;
// Adjust control if selected currently
if ( pg == p->GetGrid() && p == m_pState->GetSelection() )
{
wxWindow* wnd = pg->GetEditorControl();
wxTextCtrl* tc = wxDynamicCast(wnd,wxTextCtrl);
if ( tc )
tc->SetMaxLength( maxLen );
else
// Not a text ctrl
return false;
}
return true;
}
// <API key> methods
#define IMPLEMENT_GET_VALUE(T,TRET,BIGNAME,DEFRETVAL) \
TRET <API key>::GetPropertyValueAs##BIGNAME( wxPGId id ) wxPG_GETVALUE_CONST \
{ \
<API key>(DEFRETVAL) \
if ( p->GetValueTypePtr()->GetTypeName() != wxPGTypeName_
{ \
wxPGGetFailed(p,wxPGTypeName_
return (TRET)DEFRETVAL; \
} \
return (TRET)wxPGVariantTo##BIGNAME(p->DoGetValue()); \
}
// String is different than others.
wxString <API key>::<API key>( wxPGId id ) wxPG_GETVALUE_CONST
{
<API key>(wxEmptyString)
return p->GetValueAsString(wxPG_FULL_VALUE);
}
IMPLEMENT_GET_VALUE(long,long,Long,0)
IMPLEMENT_GET_VALUE(long,bool,Bool,false)
IMPLEMENT_GET_VALUE(double,double,Double,0.0)
IMPLEMENT_GET_VALUE(void,void*,VoidPtr,NULL)
#ifdef __WXPYTHON__
IMPLEMENT_GET_VALUE(PyObject,PyObject*,PyObject,Py_None)
#endif
#if !<API key>
IMPLEMENT_GET_VALUE(wxArrayString,const wxArrayString&,ArrayString,*((wxArrayString*)NULL))
#endif
// wxObject is different than others.
const wxObject* <API key>::<API key>( wxPGId id ) wxPG_GETVALUE_CONST
{
<API key>((const wxObject*)NULL)
<API key> typestr = p->GetValueTypePtr()->GetTypeName();
if ( typestr[0] != wxT('w') || typestr[1] != wxT('x') )
{
wxPGGetFailed(p,wxT("wxObject"));
return (const wxObject*) NULL;
}
return (const wxObject*)<API key>(p->DoGetValue());
}
bool <API key>::IsPropertyExpanded( wxPGId id )
{
<API key>(false)
<API key>* pwc = (<API key>*)p;
if ( pwc->GetParentingType() == 0 )
return false;
return pwc->IsExpanded();
}
// returns value type class for type name
wxPGValueType* <API key>::GetValueType(const wxString &type)
{
wxPGHashMapS2P::iterator it;
it = wxPGGlobalVars->m_dictValueType.find(type);
if ( it != wxPGGlobalVars->m_dictValueType.end() )
return (wxPGValueType*) it->second;
return (wxPGValueType*) NULL;
}
#if <API key>
wxPGValueType* <API key>::GetValueTypeByName(const wxString &className)
{
wxPGHashMapS2P::iterator it;
it = wxPGGlobalVars-><API key>.find(className);
if ( it != wxPGGlobalVars-><API key>.end() )
return (wxPGValueType*) it->second;
return (wxPGValueType*) NULL;
}
#endif
wxPGProperty* <API key>::<API key>(const wxString &valuetype,
const wxString &label,
const wxString &name)
{
wxPGHashMapS2P::iterator it;
it = wxPGGlobalVars->m_dictValueType.find(valuetype);
if ( it != wxPGGlobalVars->m_dictValueType.end() )
{
wxPGValueType* vt = (wxPGValueType*) it->second;
wxPGProperty* p = vt->GenerateProperty(label,name);
#ifdef __WXDEBUG__
if ( !p )
{
wxLogDebug(wxT("WARNING: <API key> generated NULL property for ValueType \"%s\""),valuetype.c_str());
return (wxPGProperty*) NULL;
}
#endif
return p;
}
wxLogDebug(wxT("WARNING: No value type registered with name \"%s\""),valuetype.c_str());
return (wxPGProperty*) NULL;
}
wxPGProperty* <API key>::<API key>(const wxString &classname,
const wxString &label,
const wxString &name)
{
wxPGHashMapS2P* cis =
(wxPGHashMapS2P*) &wxPGGlobalVars-><API key>;
const wxString* pClassname = &classname;
wxString s;
// Translate to long name, if necessary
if ( (pClassname->GetChar(0) != wxT('w') || pClassname->GetChar(1) != wxT('x')) &&
pClassname->Find(wxT("Property")) < 0 )
{
if ( classname != wxT("Category") )
s.Printf(wxT("wx%sProperty"),pClassname->c_str());
else
s = wxT("wxPropertyCategory");
pClassname = &s;
}
wxPGHashMapS2P::iterator it;
it = cis->find(*pClassname);
if ( it != cis->end() )
{
<API key>* pci = (<API key>*) it->second;
wxPGProperty* p = pci->m_constructor(label,name);
return p;
}
wxLogError(wxT("No such property class: %s"),pClassname->c_str());
return (wxPGProperty*) NULL;
}
// lazy way to prevent <API key> infinite recursion
static int <API key> = 0;
bool <API key>::<API key>( const wxChar* name,
<API key>* classinfo )
{
<API key>()
// Standard classes must be registered first!
if ( !<API key> &&
wxPGGlobalVars-><API key>.empty()
)
<API key>();
wxPGHashMapS2P::iterator it;
it = wxPGGlobalVars-><API key>.find(name);
// only register if not registered already
if ( it == wxPGGlobalVars-><API key>.end() )
{
wxPGGlobalVars-><API key>[name] = classinfo;
return true;
}
wxLogDebug(wxT("WARNING: Property class named \"%s\" was already registered."),name);
return false;
}
static void <API key>()
{
if ( <API key> )
return;
<API key> = 1; // no need to reset this
<API key>(wxStringProperty);
<API key>(wxIntProperty);
<API key>(wxUIntProperty);
<API key>(wxFloatProperty);
<API key>(wxBoolProperty);
<API key>(wxEnumProperty);
<API key>(wxFlagsProperty);
<API key>(<API key>);
<API key>(wxPropertyCategory);
<API key>(wxParentProperty);
<API key>(wxCustomProperty);
// TODO: Are these really "standard" ?
<API key>(<API key>);
<API key>(wxFileProperty);
<API key>(wxDirProperty);
#ifdef __WXPYTHON__
<API key>::<API key>();
#endif
}
// wxPropertyGridState
// reset helper macro
#undef FROM_STATE
#define FROM_STATE(A) A
// wxPropertyGridState item iteration methods
// Skips categories and sub-properties (unless in wxCustomProperty/wxParentProperty).
wxPGId wxPropertyGridState::GetFirstProperty() const
{
if ( !m_properties->GetCount() ) return wxPGIdGen((wxPGProperty*)NULL);
wxPGProperty* p = m_properties->Item(0);
int parenting = p->GetParentingType();
if ( parenting > 0 )
return GetNextProperty ( wxPGIdGen(p) );
return wxPGIdGen(p);
}
// Skips categories and sub-properties (unless in wxParentProperty).
wxPGId wxPropertyGridState::GetNextProperty( wxPGId id ) const
{
<API key>(wxNullProperty)
<API key>* pwc = (<API key>*)p;
// Go with first child?
int parenting = pwc->GetParentingType();
if ( parenting == 0 || parenting == -1 || !pwc->GetCount() )
{
<API key>* parent = pwc->m_parent;
// As long as last item, go up and get parent' sibling
while ( pwc->m_arrIndex >= (parent->GetCount()-1) )
{
pwc = parent;
if ( pwc == m_properties ) return wxPGIdGen((wxPGProperty*)NULL);
parent = parent->m_parent;
}
pwc = (<API key>*)parent->Item(pwc->m_arrIndex+1);
// Go with the next sibling of parent's parent?
}
else
{
// Yes...
pwc = (<API key>*)pwc->Item(0);
}
// If it's category or parentproperty, then go recursive
parenting = pwc->GetParentingType();
if ( parenting > PT_NONE )
return GetNextProperty( wxPGIdGen(pwc) );
return wxPGIdGen(pwc);
}
wxPGId wxPropertyGridState::GetNextSibling( wxPGId id )
{
<API key>(wxNullProperty)
<API key>* parent = p->m_parent;
size_t next_ind = p->m_arrIndex + 1;
if ( next_ind >= parent->GetCount() ) return wxPGIdGen((wxPGProperty*)NULL);
return wxPGIdGen(parent->Item(next_ind));
}
wxPGId wxPropertyGridState::GetPrevSibling( wxPGId id )
{
<API key>(wxNullProperty)
size_t ind = p->m_arrIndex;
if ( ind < 1 ) return wxPGIdGen((wxPGProperty*)NULL);
return wxPGIdGen(p->m_parent->Item(ind-1));
}
// Skips categories and sub-properties (unless in wxParentProperty).
wxPGId wxPropertyGridState::GetPrevProperty( wxPGId id ) const
{
<API key>(wxNullProperty)
<API key>* p2 = (<API key>*) p;
<API key>* parent = p2->m_parent;
// Is there a previous sibling?
if ( p2->m_arrIndex > 0 )
{
// There is!
p2 = (<API key>*)parent->Item ( p2->m_arrIndex-1 );
int parenting = p2->GetParentingType();
// Do we return it's last child?
while ( (parenting > 0 || parenting == PT_CUSTOMPROPERTY) && p2->GetCount() )
{
p2 = (<API key>*)p2->Last();
parenting = p2->GetParentingType();
}
}
else if ( parent != m_properties )
// Return parent if it isnt' the root
p2 = parent;
else
return wxPGIdGen((wxPGProperty*)NULL);
// Skip category and parentproperty.
int parenting = p2->GetParentingType();
if ( parenting > PT_NONE )
return GetPrevProperty ( wxPGIdGen(p2) );
return wxPGIdGen(p2);
}
wxPGId wxPropertyGridState::GetFirstCategory() const
{
//if ( IsInNonCatMode() )
// return wxPGIdGen((wxPGProperty*)NULL);
wxPGProperty* found = (wxPGProperty*)NULL;
size_t i;
for ( i=0; i<m_regularArray.GetCount(); i++ )
{
wxPGProperty* p = m_regularArray.Item(i);
if ( p->GetParentingType() > 0 )
{
found = p;
break;
}
}
return wxPGIdGen(found);
}
wxPGId wxPropertyGridState::GetNextCategory( wxPGId id ) const
{
<API key>(wxNullProperty)
<API key>* current = (<API key>*)p;
wxCHECK_MSG( !IsInNonCatMode() || current->GetParentingType() == 1, wxPGIdGen((wxPGProperty*)NULL),
wxT("GetNextCategory should not be called with non-category argument in non-categoric mode.") );
<API key>* parent = current->m_parent;
wxPGProperty* found = (wxPGProperty*) NULL;
size_t i;
// Find sub-category, if any.
if ( current->GetParentingType() > 0 )
{
// Find first sub-category in current's array.
for ( i = 0; i<current->GetCount(); i++ )
{
wxPGProperty* p = current->Item(i);
if ( p->GetParentingType() > 0 )
{
found = p;
break;
}
}
if ( found )
return wxPGIdGen(found);
}
// Find next category in parent's array.
// (and go up in hierarchy until one found or
// top is reached).
do
{
for ( i = current->m_arrIndex+1; i<parent->GetCount(); i++ )
{
wxPGProperty* p = parent->Item(i);
if ( p->GetParentingType() > 0 )
{
found = p;
break;
}
}
current = parent;
parent = parent->m_parent;
} while ( !found && parent );
return wxPGIdGen(found);
}
// wxPropertyGridState GetPropertyXXX methods
wxPGId wxPropertyGridState::GetPropertyByLabel( const wxString& label,
<API key>* parent ) const
{
size_t i;
if ( !parent ) parent = (<API key>*) &m_regularArray;
for ( i=0; i<parent->GetCount(); i++ )
{
wxPGProperty* p = parent->Item(i);
if ( p->m_label == label )
return wxPGIdGen(p);
// Check children recursively.
if ( p->GetParentingType() != 0 )
{
p = wxPGIdToPtr(GetPropertyByLabel(label,(<API key>*)p));
if ( p )
return wxPGIdGen(p);
}
}
return wxPGIdGen((wxPGProperty*) NULL);
}
wxPGId wxPropertyGridState::<API key>( wxPGPropNameStr name ) const
{
wxPGHashMapS2P::const_iterator it;
it = m_dictName.find(name);
if ( it != m_dictName.end() )
return wxPGIdGen( (wxPGProperty*) it->second );
return wxPGIdGen( (wxPGProperty*) NULL );
}
// wxPropertyGridState global operations
bool wxPropertyGridState::EnableCategories( bool enable )
{
<API key>
if ( enable )
{
// Enable categories
if ( !IsInNonCatMode() )
return false;
m_properties = &m_regularArray;
// fix parents, indexes, and depths
<API key>
<API key>
p->m_arrIndex = i;
p->m_parent = parent;
// If parent was category, and this is not,
// then the depth stays the same.
if ( parent->GetParentingType() == 1 &&
p->GetParentingType() <= 0 )
p->m_depth = parent->m_depth;
else
p->m_depth = parent->m_depth + 1;
<API key>
}
else
{
// Disable categories
if ( IsInNonCatMode() )
return false;
// Create array, if necessary.
if ( !m_abcArray )
InitNonCatMode();
m_properties = m_abcArray;
// fix parents, indexes, and depths
<API key>
//<API key>
<API key>
p->m_arrIndex = i;
p->m_parent = parent;
p->m_depth = parent->m_depth + 1;
//<API key>
<API key>
}
return true;
}
static int wxPG_SortFunc(void **p1, void **p2)
{
wxPGProperty *pp1 = *((wxPGProperty**)p1);
wxPGProperty *pp2 = *((wxPGProperty**)p2);
return pp1->GetLabel().compare( pp2->GetLabel() );
}
void wxPropertyGridState::Sort( wxPGProperty* p )
{
if ( !p )
p = (wxPGProperty*)m_properties;
wxCHECK_RET( p->GetParentingType() != 0,
wxT("cannot sort non-parenting property") );
<API key>* pwc = (<API key>*)p;
// Can only sort items with children
if ( pwc->m_children.GetCount() < 1 )
return;
pwc->m_children.Sort( wxPG_SortFunc );
// Fix indexes
pwc-><API key>();
}
void wxPropertyGridState::Sort()
{
Sort( m_properties );
// Sort categories as well
if ( !IsInNonCatMode() )
{
size_t i;
for ( i=0;i<m_properties->GetCount();i++)
{
wxPGProperty* p = m_properties->Item(i);
if ( p->GetParentingType() > 0 )
Sort ( p );
}
}
}
bool wxPropertyGridState::ExpandAll( unsigned char doExpand )
{
<API key>
bool isGrid = m_pPropGrid->GetState() == this;
if ( isGrid &&
m_selected &&
m_selected->GetParent() != m_properties )
{
if ( !m_pPropGrid->ClearSelection() )
return false;
}
if ( !doExpand )
{
if ( isGrid )
{
if ( !m_pPropGrid->ClearSelection() )
return false;
}
else m_selected = (wxPGProperty*) NULL;
}
<API key>
<API key>
if ( parenting != 0 )
((<API key>*)p)->m_expanded = doExpand;
<API key>
if ( m_pPropGrid->GetState() == this )
{
m_pPropGrid->CalculateYs((<API key>*)NULL,-1);
m_pPropGrid->RedrawAllVisible();
}
return true;
}
// Used by SetSplitterLeft
int wxPropertyGridState::GetLeftSplitterPos(wxClientDC& dc,
<API key>* pwc,
bool subProps)
{
wxPropertyGrid* pg = m_pPropGrid;
size_t i;
int maxW = 0;
int w, h;
for ( i=0; i<pwc->GetCount(); i++ )
{
wxPGProperty* p = pwc->Item(i);
if ( p->GetParentingType() <= 0 )
{
dc.GetTextExtent( p->GetLabel(), &w, &h );
w += pg->m_marginWidth + ( ((int)p->m_depth-1) * pg-><API key> ) + (wxPG_XBEFORETEXT*2);
if ( w > maxW )
maxW = w;
}
if ( p->GetParentingType() &&
( subProps || p->GetParentingType() > 0 ) )
{
w = GetLeftSplitterPos( dc, (<API key>*) p, subProps );
if ( w > maxW )
maxW = w;
}
}
return maxW;
}
// wxPropertyGridState property value setting and getting
void wxPropertyGridState::SetPropVal( wxPGProperty* p, const wxPGVariant& value )
{
p->DoSetValue(value);
if ( m_selected==p && this==m_pPropGrid->GetState() )
p->UpdateControl(m_pPropGrid->m_wndPrimary);
}
bool wxPropertyGridState::ClearPropertyValue( wxPGProperty* p )
{
if ( p )
{
const wxPGValueType* valueclass = p->GetValueTypePtr();
if ( valueclass != wxPG_VALUETYPE_PTR(none) )
{
// wnd_primary has to be given so the editor control can be updated as well.
SetPropVal(p,valueclass->GetDefaultValue());
return true;
}
}
return false;
}
bool wxPropertyGridState::SetPropertyValue( wxPGProperty* p,
const wxPGValueType* typeclass,
const wxPGVariant& value )
{
if ( p )
{
if ( p->GetValueTypePtr()->GetTypeName() == typeclass->GetTypeName() )
{
<API key>(p);
SetPropVal(p,value);
return true;
}
<API key> ( p, typeclass->GetTypeName(), wxT("Set") );
}
return false;
}
bool wxPropertyGridState::SetPropertyValue( wxPGProperty* p, const wxChar* typestring, const wxPGVariant& value )
{
if ( p )
{
if ( wxStrcmp(p->GetValueTypePtr()->GetCustomTypeName(),typestring) == 0 )
{
// wnd_primary has to be given so the control can be updated as well.
SetPropVal(p,value);
return true;
}
<API key> ( p, typestring, wxT("Set") );
}
return false;
}
bool wxPropertyGridState::<API key>( wxPGProperty* p, const wxString& value )
{
if ( p )
{
int flags = wxPG_REPORT_ERROR|wxPG_FULL_VALUE;
<API key>(p);
if ( p->GetMaxLength() <= 0 )
p->SetValueFromString( value, flags );
else
p->SetValueFromString( value.Mid(0,p->GetMaxLength()), flags );
if ( m_selected==p && this==m_pPropGrid->GetState() )
p->UpdateControl(m_pPropGrid->m_wndPrimary);
return true;
}
return false;
}
bool wxPropertyGridState::SetPropertyValue( wxPGProperty* p, wxVariant& value )
{
if ( p )
{
<API key>(p);
p->GetValueTypePtr()->SetValueFromVariant(p,value);
if ( m_selected==p && this==m_pPropGrid->GetState() )
p->UpdateControl(m_pPropGrid->m_wndPrimary);
return true;
}
return false;
}
bool wxPropertyGridState::<API key>( wxPGProperty* p, wxObject* value )
{
if ( p )
{
if ( wxStrcmp( p->GetValueTypePtr()->GetTypeName(),
value->GetClassInfo()->GetClassName()
) == 0
)
{
<API key>(p);
// wnd_primary has to be given so the control can be updated as well.
SetPropVal(p,<API key>(value));
return true;
}
<API key> ( p, wxT("wxObject"), wxT("Set") );
}
return false;
}
void wxPropertyGridState::<API key>( wxPGProperty* p )
{
wxCHECK_RET( p, wxT("invalid property id") );
if ( !(p->m_flags & <API key>) )
{
// Flag should be set first - editor class methods may need it
p->m_flags |= <API key>;
wxASSERT( m_pPropGrid );
if ( m_pPropGrid->GetState() == this )
{
if ( m_pPropGrid->m_selected == p && m_pPropGrid->m_wndPrimary )
{
p->GetEditorClass()-><API key>(m_pPropGrid->m_wndPrimary);
}
}
if ( p->GetParentingType() != 0 )
{
<API key>* pwc = (<API key>*)p;
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
<API key>( pwc->Item(i) );
}
}
}
// wxPropertyGridState property operations
void wxPropertyGridState::<API key>( wxPGProperty* p, bool limit )
{
if ( p )
{
if ( limit )
p->m_flags |= wxPG_PROP_NOEDITOR;
else
p->m_flags &= ~(wxPG_PROP_NOEDITOR);
}
}
void wxPropertyGridState::ClearModifiedStatus( wxPGProperty* p )
{
<API key>* pwc = (<API key>*)p;
if ( p->m_flags & wxPG_PROP_MODIFIED )
{
p->m_flags &= ~(wxPG_PROP_MODIFIED);
if ( m_pPropGrid->GetState() == this )
{
// Clear active editor bold
if ( p == m_selected && m_pPropGrid->m_wndPrimary )
m_pPropGrid->m_wndPrimary->SetFont( m_pPropGrid->GetFont() );
m_pPropGrid->DrawItem( p );
}
}
if ( pwc->GetParentingType() != 0 )
{
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
ClearModifiedStatus( pwc->Item(i) );
}
}
bool wxPropertyGridState::Collapse( wxPGProperty* p )
{
wxCHECK_MSG( p, false, wxT("invalid property id") );
<API key>* pwc = (<API key>*)p;
if ( pwc->GetParentingType() == 0 ) return false;
if ( !pwc->m_expanded ) return false;
// m_expanded must be set just before call to CalculateYs
pwc->m_expanded = 0;
return true;
}
bool wxPropertyGridState::Expand( wxPGProperty* p )
{
wxCHECK_MSG( p, false, wxT("invalid property id") );
<API key>* pwc = (<API key>*)p;
if ( pwc->GetParentingType() == 0 ) return false;
if ( pwc->m_expanded ) return false;
// m_expanded must be set just before call to CalculateYs
pwc->m_expanded = 1;
return true;
}
bool wxPropertyGridState::DoSelectProperty( wxPGProperty* p, unsigned int flags )
{
if ( this == m_pPropGrid->GetState() )
return m_pPropGrid->DoSelectProperty( p, flags );
m_selected = p;
return true;
}
void wxPropertyGridState::SetPropertyLabel( wxPGProperty* p, const wxString& newlabel )
{
wxCHECK_RET(p, wxT("invalid property id"));
p->SetLabel(newlabel);
if ( m_pPropGrid->GetWindowStyleFlag() & wxPG_AUTO_SORT )
Sort(p->GetParent());
}
bool wxPropertyGridState::SetPropertyPriority( wxPGProperty* p, int priority )
{
int parenting = p->GetParentingType();
if ( priority == wxPG_HIGH ) p->ClearFlag( wxPG_PROP_HIDEABLE );
else p->SetFlag( wxPG_PROP_HIDEABLE );
if ( parenting != 0 )
{
<API key>* pwc = (<API key>*)p;
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
SetPropertyPriority(pwc->Item(i),priority);
}
return true;
}
void wxPropertyGridState::<API key>( wxPGProperty* p, long flags )
{
p->m_flags |= flags;
if ( p->GetParentingType() != 0 )
{
<API key>* pwc = (<API key>*)p;
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
<API key> ( pwc->Item(i), flags );
}
}
void wxPropertyGridState::<API key>( wxPGProperty* p, long flags )
{
p->m_flags &= ~(flags);
if ( p->GetParentingType() != 0 )
{
<API key>* pwc = (<API key>*)p;
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
<API key> ( pwc->Item(i), flags );
}
}
bool wxPropertyGridState::EnableProperty( wxPGProperty* p, bool enable )
{
if ( p )
{
if ( enable )
{
if ( !(p->m_flags & wxPG_PROP_DISABLED) )
return false;
// Enabling
p->m_flags &= ~(wxPG_PROP_DISABLED);
}
else
{
if ( p->m_flags & wxPG_PROP_DISABLED )
return false;
// Disabling
p->m_flags |= wxPG_PROP_DISABLED;
}
if ( p->GetParentingType() == 0 )
return true;
// Apply same to sub-properties as well
<API key>* pwc = (<API key>*)p;
size_t i;
for ( i = 0; i < pwc->GetCount(); i++ )
EnableProperty ( pwc->Item(i), enable );
return true;
}
return false;
}
// wxPropertyGridState wxVariant related routines
// Returns list of wxVariant objects (non-categories and non-sub-properties only).
// Never includes sub-properties (unless they are parented by wxParentProperty).
wxVariant wxPropertyGridState::GetPropertyValues( const wxString& listname,
wxPGId baseparent,
long flags ) const
{
<API key>
<API key>* pwc = (<API key>*)wxPGIdToPtr(baseparent);
// Root is the default base-parent.
if ( !pwc )
pwc = m_properties;
wxVariantList temp_list;
wxVariant v( temp_list, listname );
if ( flags & wxPG_KEEP_STRUCTURE )
{
wxASSERT( (pwc->GetParentingType() < -1) || (pwc->GetParentingType() > 0) );
size_t i;
for ( i=0; i<pwc->GetCount(); i++ )
{
wxPGProperty* p = pwc->Item(i);
int parenting = p->GetParentingType();
if ( parenting == 0 || parenting == -1 )
{
v.Append( p->GetValueAsVariant() );
}
else
{
v.Append( GetPropertyValues(p->m_name,wxPGIdGen(p),wxPG_KEEP_STRUCTURE) );
}
}
}
else
{
ITEM_ITERATION_INIT((<API key>*)wxPGIdToPtr(baseparent),0)
<API key>
// Use a trick to ignore wxParentProperty itself, but not its sub-properties.
if ( parenting == PT_CUSTOMPROPERTY )
{
parenting = PT_CAPTION;
}
else if ( parenting <= 0 )
{
v.Append ( p->GetValueAsVariant() );
}
<API key>
}
return v;
}
void wxPropertyGridState::SetPropertyValues( const wxVariantList& list, wxPGId default_category )
{
unsigned char origFrozen = 1;
if ( m_pPropGrid->GetState() == this )
{
origFrozen = m_pPropGrid->m_frozen;
if ( !origFrozen ) m_pPropGrid->Freeze();
}
<API key>* use_category = (<API key>*)wxPGIdToPtr(default_category);
if ( !use_category )
use_category = (<API key>*)m_properties;
// Let's iterate over the list of variants.
wxVariantList::const_iterator node;
//for ( wxVariantList::Node *node = list.GetFirst(); node; node = node->GetNext() )
for ( node = list.begin(); node != list.end(); node++ )
{
wxVariant *current = (wxVariant*)*node;
// Make sure it is wxVariant.
wxASSERT( current );
wxASSERT( wxStrcmp(current->GetClassInfo()->GetClassName(),wxT("wxVariant")) == 0 );
if ( current->GetName().length() > 0 )
{
wxPGId foundProp = <API key>(current->GetName());
if ( wxPGIdIsOk(foundProp) )
{
wxPGProperty* p = wxPGIdToPtr(foundProp);
const wxPGValueType* vtype = p->GetValueTypePtr();
// If it was a list, we still have to go through it.
if ( current->GetType() == wxT("list") )
{
SetPropertyValues( current->GetList(),
wxPGIdGen(
p->GetParentingType()>0?p:((wxPGProperty*)NULL)
) );
}
else
{
#ifdef __WXDEBUG__
if ( current->GetType() != vtype->GetTypeName() &&
current->GetType() != vtype->GetCustomTypeName() )
{
wxLogDebug(wxT("wxPropertyGridState::SetPropertyValues Warning: Setting value of property \"%s\" from variant"),
p->m_name.c_str());
wxLogDebug(wxT(" but variant's type name (%s) doesn't match either base type name (%s) nor custom type name (%s)."),
#ifndef __WXPYTHON__
current->GetType().c_str(),vtype->GetTypeName(),vtype->GetCustomTypeName());
#else
current->GetType().c_str(),vtype->GetTypeName().c_str(),vtype->GetCustomTypeName().c_str());
#endif
}
#endif
vtype->SetValueFromVariant(p,*current);
}
}
else
{
// Is it list?
if ( current->GetType() != wxT("list") )
{
// Not.
AppendIn(use_category,current->GetName(),wxPG_LABEL,(wxVariant&)*current);
}
else
{
// Yes, it is; create a sub category and append contents there.
wxPGId newCat = DoInsert(use_category,-1,new <API key>(current->GetName(),wxPG_LABEL));
SetPropertyValues( current->GetList(), newCat );
}
}
}
}
if ( !origFrozen )
{
m_pPropGrid->Thaw();
if ( this == m_pPropGrid->GetState() )
{
m_selected->UpdateControl(m_pPropGrid->m_wndPrimary);
}
}
}
// wxPropertyGridState property adding and removal
// Call for after sub-properties added with AddChild
void <API key>::<API key>()
{
// TODO: When in 1.0.5, move extra stuff from AddChild to here.
wxPropertyGridState* state = GetParentState();
wxASSERT(state);
if ( !GetCount() )
return;
wxByte depth = m_depth + 1;
wxByte depthBgCol = m_depthBgCol;
wxByte inheritFlags = m_flags & <API key>;
wxByte bgColIndex = m_bgColIndex;
wxByte fgColIndex = m_fgColIndex;
// Set some values to the children
size_t i = 0;
<API key>* nparent = this;
while ( i < nparent->GetCount() )
{
wxPGProperty* np = nparent->Item(i);
np->m_flags |= inheritFlags; // Hideable also if parent.
np->m_depth = depth;
np->m_depthBgCol = depthBgCol;
np->m_bgColIndex = bgColIndex;
np->m_fgColIndex = fgColIndex;
// Also handle children of children
if ( np->GetParentingType() != 0 &&
((<API key>*)np)->GetCount() > 0 )
{
nparent = (<API key>*) np;
i = 0;
// Init
nparent->m_expanded = 0;
nparent->m_parentState = state;
depth++;
}
else
{
// Next sibling
i++;
}
// After reaching last sibling, go back to processing
// siblings of the parent
while ( i >= nparent->GetCount() )
{
// Exit the loop when top parent hit
if ( nparent == this )
break;
depth
i = nparent->GetArrIndex() + 1;
nparent = nparent->GetParent();
}
}
}
// Call after fixed sub-properties added/removed after creation.
// if oldSelInd >= 0 and < new max items, then selection is
// moved to it. Note: oldSelInd -2 indicates that this property
// should be selected.
void <API key>::SubPropsChanged( int oldSelInd )
{
wxPropertyGridState* state = GetParentState();
wxPropertyGrid* grid = state->GetGrid();
<API key>();
wxPGProperty* sel = (wxPGProperty*) NULL;
if ( oldSelInd >= (int)m_children.GetCount() )
oldSelInd = (int)m_children.GetCount() - 1;
if ( oldSelInd >= 0 )
sel = (wxPGProperty*) m_children[oldSelInd];
else if ( oldSelInd == -2 )
sel = this;
if ( sel )
state->DoSelectProperty(sel);
if ( state == grid->GetState() )
{
if ( m_expanded )
grid->CalculateYs( GetParent(), m_arrIndex );
grid->Refresh();
}
}
int wxPropertyGridState::PrepareToAddItem( wxPGProperty* property,
<API key>* scheduledParent )
{
wxPropertyGrid* propGrid = m_pPropGrid;
wxASSERT( propGrid );
int parenting = property->GetParentingType();
// This will allow better behaviour.
if ( scheduledParent == m_properties )
scheduledParent = (<API key>*) NULL;
if ( parenting > 0 )
{
/*
if ( scheduledParent )
wxLogDebug(wxT("scheduledParent= %s, %i"),
scheduledParent->GetName().c_str(), (int)scheduledParent->GetParentingType());
*/
// Parent of a category must be either root or another category
// (otherwise Bad Things might happen).
wxASSERT_MSG( scheduledParent == (<API key>*) NULL ||
scheduledParent == m_properties ||
scheduledParent->GetParentingType() > 0,
wxT("Parent of a category must be either root or another category."));
/*
wxASSERT_MSG( m_properties == &m_regularArray,
wxT("Do not add categories in non-categoric mode!"));
*/
// If we already have category with same name, delete given property
// and use it instead as most recent caption item.
wxPGId found_id = <API key>( property->GetName() );
if ( wxPGIdIsOk(found_id) )
{
<API key>* pwc = (<API key>*)wxPGIdToPtr(found_id);
if ( pwc->GetParentingType() > 0 ) // Must be a category.
{
delete property;
m_currentCategory = pwc;
return 2; // Tells the caller what we did.
}
}
}
#ifdef __WXDEBUG__
// Warn for identical names in debug mode.
if ( property->GetName().length() &&
wxPGIdIsOk(<API key>(property->GetName())) &&
(!scheduledParent || scheduledParent->GetParentingType() >= 1) )
wxLogError(wxT("wxPropertyGrid: Warning - item with name \"%s\" already exists."),
property->GetName().c_str());
#endif
// Make sure nothing is selected.
if ( propGrid && propGrid->m_selected )
{
bool selRes = propGrid->ClearSelection();
wxPG_CHECK_MSG_DBG( selRes,
-1,
wxT("failed to deselect a property (editor probably had invalid value)") );
}
property->m_y = -1;
if ( scheduledParent )
{
// Use parent's colours.
property->m_bgColIndex = scheduledParent->m_bgColIndex;
property->m_fgColIndex = scheduledParent->m_fgColIndex;
}
// If in hideable adding mode, or if assigned parent is hideable, then
// make this one hideable.
if (
( scheduledParent && (scheduledParent->m_flags & wxPG_PROP_HIDEABLE) ) ||
( propGrid && (propGrid->m_iFlags & <API key>) )
)
property->SetFlag ( wxPG_PROP_HIDEABLE );
// Set custom image flag.
int custImgHeight = property->GetImageSize().y;
if ( custImgHeight < 0 /*|| custImgHeight > 1*/ )
{
property->m_flags |= <API key>;
}
if ( propGrid->GetWindowStyleFlag() & <API key> )
property->m_flags |= wxPG_PROP_NOEDITOR;
if ( parenting < 1 )
{
// This is not a category.
wxASSERT_MSG( property->GetEditorClass(), wxT("Editor class not initialized!") );
// Depth.
unsigned char depth = 1;
if ( scheduledParent )
{
depth = scheduledParent->m_depth;
if ( scheduledParent->GetParentingType() != PT_CAPTION )
depth++;
}
property->m_depth = depth;
unsigned char greyDepth = depth;
if ( scheduledParent )
{
<API key>* pc;
if ( scheduledParent->GetParentingType() >= PT_CAPTION )
pc = (<API key>*)scheduledParent;
else
// This conditional compile is necessary to
// bypass some compiler bug.
pc = wxPropertyGrid::<API key>(scheduledParent);
if ( pc )
greyDepth = (unsigned char)pc->GetDepth();
else
greyDepth = scheduledParent->m_depthBgCol;
}
property->m_depthBgCol = greyDepth;
// Add children to <API key>.
if ( parenting < PT_NONE )
{
<API key>* pwc = (<API key>*)property;
pwc->m_parentState = this;
pwc->m_expanded = 0; // Properties with children are not expanded by default.
if ( propGrid && propGrid->GetWindowStyleFlag() & wxPG_HIDE_MARGIN )
pwc->m_expanded = 1; // ...unless it cannot not be expanded.
if ( pwc->GetCount() )
{
pwc-><API key>();
}
// If children were added prior to append, then this is considered
// a "fixed" parent (otherwise the PT_CUSTOMPROPERTY is set, see below,
// to mark it as customizable).
/*if ( pwc->GetCount() )
{
pwc-><API key>();
}
else
{
pwc->m_parentingType = PT_CUSTOMPROPERTY;
}*/
}
}
else
{
// This is a category.
// depth
unsigned char depth = 1;
if ( scheduledParent )
{
depth = scheduledParent->m_depth + 1;
}
property->m_depth = depth;
property->m_depthBgCol = depth;
m_currentCategory = (<API key>*)property;
<API key>* pc = (<API key>*)property;
pc->m_parentState = this;
// Calculate text extent for caption item.
pc->CalculateTextExtent(propGrid,propGrid->GetCaptionFont());
}
return parenting;
}
void <API key>::BeginAddChildren( wxPGId id )
{
<API key>* pwc = (<API key>*) wxPGIdToPtr(id);
wxCHECK_RET( pwc, wxT("NULL property") );
wxCHECK_RET( pwc->GetParentingType() == PT_FIXEDCHILDREN, wxT("only call on properties with fixed children") );
pwc->m_parentingType = PT_CUSTOMPROPERTY;
}
void <API key>::EndAddChildren( wxPGId id )
{
<API key>* pwc = (<API key>*) wxPGIdToPtr(id);
wxCHECK_RET( pwc, wxT("NULL property") );
wxCHECK_RET( pwc->GetParentingType() == PT_CUSTOMPROPERTY, wxT("only call on properties for which BeginAddChildren was called prior") );
pwc->m_parentingType = PT_FIXEDCHILDREN;
}
wxPGId wxPropertyGridState::Append( wxPGProperty* property )
{
<API key>* cur_cat = m_currentCategory;
if ( property->GetParentingType() > 0 )
cur_cat = (<API key>*) NULL;
return DoInsert( cur_cat, -1, property );
}
wxPGId wxPropertyGridState::DoInsert( <API key>* parent, int index, wxPGProperty* property )
{
if ( !parent )
parent = m_properties;
wxPropertyGrid* propGrid = m_pPropGrid;
wxCHECK_MSG( parent->GetParentingType() != PT_NONE,
wxNullProperty,
wxT("this parent cannot accomodate children") );
wxCHECK_MSG( parent->GetParentingType() != PT_FIXEDCHILDREN,
wxNullProperty,
wxT("when adding properties to fixed parents, use BeginAddChildren and EndAddChildren.") );
int parenting = PrepareToAddItem( property, (<API key>*)parent );
// This type of invalid parenting value indicates we should exit now, returning
// id of most recent category.
if ( parenting > PT_CAPTION )
return wxPGIdGen(m_currentCategory);
// Note that item must be added into current mode later.
// If parent is wxParentProperty, just stick it in...
// If parent is root (m_properties), then...
// In categoric mode: Add as last item in m_abcArray (if not category).
// Add to given index in m_regularArray.
// In non-cat mode: Add as last item in m_regularArray.
// Add to given index in m_abcArray.
// If parent is category, then...
// 1) Add to given category in given index.
// 2) Add as last item in m_abcArray.
int parents_parenting = parent->GetParentingType();
if ( parents_parenting < 0 )
{
// Parent is wxParentingProperty: Just stick it in...
parent->AddChild2( property, index );
}
else
{
// Parent is Category or Root.
if ( m_properties == &m_regularArray )
{
// Categorized mode
// Only add non-categories to m_abcArray.
if ( m_abcArray && parenting <= 0 )
m_abcArray->AddChild2( property, -1, false );
// Add to current mode.
parent->AddChild2( property, index );
}
else
{
// Non-categorized mode.
if ( parent != m_properties )
// Parent is category.
parent->AddChild2( property, index, false );
else
// Parent is root.
m_regularArray.AddChild2( property, -1, false );
// Add to current mode (no categories).
if ( parenting <= 0 )
m_abcArray->AddChild2( property, index );
}
}
// category stuff
if ( parenting > PT_NONE )
{
// This is a category caption item.
// Last caption is not the bottom one (this info required by append)
<API key> = 0;
}
// Only add name to hashmap if parent is root or category
if ( parent->GetParentingType() >= PT_CAPTION && property->m_name.length() )
m_dictName[property->m_name] = (void*) property;
m_itemsAdded = 1;
if ( propGrid )
propGrid->m_bottomy = 0; // this signals y recalculation
return wxPGIdGen(property);
}
wxPGId wxPropertyGridState::AppendIn( <API key>* pwc,
const wxString& label,
const wxString& propname,
wxVariant& value )
{
wxPGProperty* p = <API key>::
<API key>(value.GetType(),label,propname);
if ( p )
{
p->GetValueTypePtr()->SetValueFromVariant(p,value);
return DoInsert(pwc,-1,p);
}
return wxPGIdGen((wxPGProperty*)NULL);
}
void wxPropertyGridState::DoDelete( wxPGProperty* item )
{
wxCHECK_RET( item != &m_regularArray && item != m_abcArray,
wxT("wxPropertyGrid: Do not attempt to remove the root item.") );
size_t i;
int parenting = item->GetParentingType();
unsigned int indinparent = item->GetIndexInParent();
<API key>* pwc = (<API key>*)item;
wxCHECK_RET( item->GetParent()->GetParentingType() != -1,
wxT("wxPropertyGrid: Do not attempt to remove sub-properties.") );
if ( parenting > 0 )
{
// deleting a category
// erase category entries from the hash table
for ( i=0; i<pwc->GetCount(); i++ )
{
wxPGProperty* sp = pwc->Item( i );
if ( sp->GetName().Len() ) m_dictName.erase( wxPGNameConv(sp->GetName()) );
}
if ( pwc == m_currentCategory )
m_currentCategory = (<API key>*) NULL;
if ( m_abcArray )
{
// Remove children from non-categorized array.
for ( i=0; i<pwc->GetCount(); i++ )
{
wxPGProperty * p = pwc->Item( i );
wxASSERT( p != NULL );
if ( p->GetParentingType() <= PT_NONE )
m_abcArray->m_children.Remove( (void*)p );
}
if ( IsInNonCatMode() )
m_abcArray-><API key>();
}
}
if ( !IsInNonCatMode() )
{
// categorized mode - non-categorized array
// Remove from non-cat array, but only if parent is in it
if ( parenting <= 0 && item->GetParent()->GetParentingType() == PT_CAPTION )
{
if ( m_abcArray )
{
m_abcArray->m_children.Remove( item );
}
}
// categorized mode - categorized array
item->m_parent->m_children.RemoveAt(indinparent);
item->m_parent-><API key>(/*indinparent*/);
}
else
{
// non-categorized mode - categorized array
// We need to find location of item.
<API key>* cat_parent = &m_regularArray;
int cat_index = m_regularArray.GetCount();
size_t i;
for ( i = 0; i < m_regularArray.GetCount(); i++ )
{
wxPGProperty* p = m_regularArray.Item(i);
if ( p == item ) { cat_index = i; break; }
if ( p->GetParentingType() > 0 )
{
int subind = ((<API key>*)p)->Index(item);
if ( subind != wxNOT_FOUND )
{
cat_parent = ((<API key>*)p);
cat_index = subind;
break;
}
}
}
cat_parent->m_children.RemoveAt(cat_index);
// non-categorized mode - non-categorized array
if ( parenting <= 0 )
{
wxASSERT( item->m_parent == m_abcArray );
item->m_parent->m_children.RemoveAt(indinparent);
item->m_parent-><API key>(indinparent);
}
}
if ( item->GetName().Len() ) m_dictName.erase( wxPGNameConv(item->GetName()) );
#ifdef __WXPYTHON__
// For some reason, Py_DECREF always crashes, even though we make
// matching Py_INCREF call in propgrid_cbacks.cpp. Maybe refcount is decremented
// somewhere automatically? Unlikely though...
//if ( item->m_scriptObject )
// Py_DECREF( item->m_scriptObject );
#endif
// We can actually delete it now
delete item;
m_itemsAdded = 1; // Not a logical assignment (but required nonetheless).
if ( this == m_pPropGrid->GetState() )
{
//m_pPropGrid->m_clearThisMany = 1;
m_pPropGrid->m_bottomy = 0; // this signals y recalculation
}
}
// wxPropertyGridState init etc.
void wxPropertyGridState::InitNonCatMode()
{
<API key>
if ( !m_abcArray )
{
m_abcArray = new <API key>();
m_abcArray->SetParentState(this);
m_abcArray->m_expanded = <API key>;
}
// Must be called when FROM_STATE(m_properties) still points to regularArray.
<API key>* oldProperties = m_properties;
// Must use temp value in FROM_STATE(m_properties) for item iteration loop
// to run as expected.
m_properties = &m_regularArray;
// Copy items.
<API key>
<API key>
if ( parenting < 1 &&
( parent == m_properties || parent->GetParentingType() > 0 ) )
{
m_abcArray->AddChild2 ( p );
p->m_parent = &FROM_STATE(m_regularArray);
}
//else wxLogDebug("OUT: %s",p->m_label.c_str());
<API key>
m_properties = oldProperties;
}
void wxPropertyGridState::Clear()
{
m_regularArray.Empty();
if ( m_abcArray )
m_abcArray->Empty();
m_dictName.clear();
m_currentCategory = (<API key>*) NULL;
<API key> = 1;
m_itemsAdded = 0;
m_selected = (wxPGProperty*) NULL;
}
wxPropertyGridState::wxPropertyGridState()
{
m_pPropGrid = (wxPropertyGrid*) NULL;
m_regularArray.SetParentState(this);
m_properties = &m_regularArray;
m_abcArray = (<API key>*) NULL;
m_currentCategory = (<API key>*) NULL;
m_selected = (wxPGProperty*) NULL;
<API key> = 1;
m_itemsAdded = 0;
m_anyModified = 0;
}
wxPropertyGridState::~wxPropertyGridState()
{
delete m_abcArray;
}
// <API key>
void <API key>::Init( wxPropertyGrid* pg, wxPGId popRoot )
{
<API key>()
m_propGrid = pg;
m_popRoot = popRoot;
wxPGGlobalVars->m_offline++;
}
<API key>::~<API key>()
{
// Free unused sets of choices
wxPGHashMapP2P::iterator it;
for( it = m_dictIdChoices.begin(); it != m_dictIdChoices.end(); ++it )
{
wxPGChoicesData* data = (wxPGChoicesData*) it->second;
data->m_refCount
if ( data->m_refCount < 1 )
delete data;
}
wxPGGlobalVars->m_offline
}
bool <API key>::HasChoices( wxPGChoicesId id ) const
{
wxPGHashMapP2P::const_iterator it = m_dictIdChoices.find(id);
return ( it != m_dictIdChoices.end() );
}
bool <API key>::BeginChildren()
{
if ( wxPGIdIsOk(m_lastProperty) &&
wxPGIdToPtr(m_lastProperty)-><API key>() )
{
wxLogDebug(wxT("New Parent: %s"),wxPGIdToPtr(m_lastProperty)->GetLabel().c_str());
m_curParent = m_lastProperty;
return true;
}
return false;
}
void <API key>::AddChoices(wxPGChoicesId choicesId,
const wxArrayString& choiceLabels,
const wxArrayInt& choiceValues)
{
#ifdef __WXDEBUG__
// Make sure the id is not used yet
wxPGHashMapP2P::iterator it = m_dictIdChoices.find(choicesId);
wxCHECK_RET( it == m_dictIdChoices.end(),
wxT("added set of choices to same id twice (use HasChoices if necessary)") );
#endif
wxCHECK_RET( choicesId != (wxPGChoicesId)0,
wxT("choicesId must not be 0/NULL"));
wxPGChoices chs(choiceLabels,choiceValues);
wxPGChoicesData* data = chs.ExtractData();
m_dictIdChoices[choicesId] = (void*) data;
// Artifically reduce refcount to 0 (since nothing uses it yet)
//data->m_refCount = 0;
}
wxPGId <API key>::DoAppend(wxPGProperty* p,
const wxString& value,
const wxString& attributes,
wxPGChoicesId choicesId,
const wxArrayString& choiceLabels,
const wxArrayInt& choiceValues)
{
wxASSERT( m_propGrid );
// Make sure m_curParent is ok
if ( !wxPGIdIsOk(m_curParent) )
{
if ( !wxPGIdIsOk(m_popRoot) )
m_popRoot = m_propGrid->GetRoot();
m_curParent = m_popRoot;
}
if ( p )
{
// Set choices
if ( choicesId )
{
wxPGHashMapP2P::iterator it = m_dictIdChoices.find(choicesId);
wxPGChoices chs;
if ( it != m_dictIdChoices.end() )
{
// Already found
wxPGChoicesData* foundData = (wxPGChoicesData*) it->second;
chs.AssignData(foundData);
}
else
{
chs.Set(choiceLabels,choiceValues);
m_dictIdChoices[choicesId] = (void*) chs.GetData();
}
p->SetChoices(chs);
}
// Value setter must be before append
if ( value.length() )
{
p->SetValueFromString(value,wxPG_FULL_VALUE);
}
// Set attributes
if ( attributes.length() )
wxPropertyGrid::<API key>(p,attributes);
// Append to grid
m_propGrid->AppendIn(m_curParent,p);
m_lastProperty = p;
}
return wxPGIdGen(p);
}
wxPGId <API key>::AppendByClass(const wxString& classname,
const wxString& label,
const wxString& name,
const wxString& value,
const wxString& attributes,
wxPGChoicesId choicesId,
const wxArrayString& choiceLabels,
const wxArrayInt& choiceValues)
{
wxPGProperty* p = m_propGrid-><API key>(classname,label,name);
return DoAppend(p,value,attributes,choicesId,choiceLabels,choiceValues);
}
wxPGId <API key>::AppendByType(const wxString& valuetype,
const wxString& label,
const wxString& name,
const wxString& value,
const wxString& attributes,
wxPGChoicesId choicesId,
const wxArrayString& choiceLabels,
const wxArrayInt& choiceValues)
{
wxPGProperty* p = m_propGrid-><API key>(valuetype,label,name);
return DoAppend(p,value,attributes,choicesId,choiceLabels,choiceValues);
} |
package org.qi4j.library.struts2.util;
import static java.lang.Character.isLowerCase;
import static java.lang.Character.toLowerCase;
public final class ClassNames
{
private ClassNames()
{
}
public static String <API key>( Class<?> type )
{
return ClassNames.<API key>( type, ClassNameFilters.passThruFilter );
}
public static String <API key>( Class<?> type, ClassNameFilter filter )
{
return ClassNames.<API key>( filter.filter( type.getSimpleName() ) );
}
public static String <API key>( String name )
{
StringBuilder sb = new StringBuilder( name.length() );
sb.append( toLowerCase( name.charAt( 0 ) ) );
for( int i = 1; i < name.length(); i++ )
{
char c = name.charAt( i );
if( isLowerCase( c ) )
{
sb.append( c );
}
else
{
sb.append( '.' );
sb.append( toLowerCase( c ) );
}
}
return sb.toString();
}
} |
# Writing new tests
The Envoy integration test framework is designed to make it simple to test <API key>
communication. In the common case, one
- Sends a request from downstream through Envoy
- Verifies the request is received upstream, and possibly inspects elements of the headers or body
- Sends a response from upstream through Envoy
- Verifies the request is received downstream, again possibly inspecting headers and body
For the simplest variant of this, one could do the following.
c++
// start Envoy, set up the fake upstreams.
initialize();
codec_client_ = makeHttpConnection(<API key>((lookupPort("http"))));
// Create some request headers.
Http::TestHeaderMapImpl request_headers{{":method", "GET"},
{":path", "/test/long/url"},
{":scheme", "http"},
{":authority", "host"}};
// Send the request headers from the client, wait until they are received upstream. When they
// are received, send the default response headers from upstream and wait until they are
// received at by client
<API key>(request_headers, 0, <API key>, 0);
// Verify the proxied request was received upstream, as expected.
EXPECT_TRUE(upstream_request_->complete());
EXPECT_EQ(0U, upstream_request_->bodyLength());
// Verify the proxied response was received downstream, as expected.
EXPECT_TRUE(response_->complete());
EXPECT_STREQ("200", response_->headers().Status()->value().c_str());
EXPECT_EQ(0U, response_->body().size());
Once you have the basic end-to-end test, it is fairly straight forward to modify it to test more
interesting corner cases. There are existing tests which send requests with bodies, have
downstream or upstream disconnect or time out, send multiple simultaneous requests on the same
connection, etc. Given that many of the disconnect/timeout cases are covered, a common case for
testing is covering a newly added configuration option.
Most of Envoy's tests have been migrated from using [`json flatfiles`](../config/integration/) to
using a basic configuration defined as `basic_config` in [`config/utility.cc`](../config/utility.cc).
This configuration may be modified before the call to `initialize()`.
The [`ConfigHelper`](../config/utility.h) has utilities for common alterations such as:
c++
// Set the default protocol to HTTP2
<API key>(Http::CodecClient::Type::HTTP2);
or
c++
// Add a buffering filter on the request path
config_helper_.addFilter(ConfigHelper::<API key>);
For other edits which are less likely reusable, one can add config modifiers. Config modifiers
allow arbitrary modification of Envoy’s configuration just before Envoy is brought up. One can add
a config modifier to alter the bootstrap proto, one which affects the first `<API key>`
object in the config, or mix and match. Config modifiers are operated on in the order they are
added, so one could, for example, modify the default `<API key>`, duplicate the listening
config, and then change the first `<API key>` to be different from the second.
An example of modifying the bootstrap proto to overwrite runtime defaults:
c++
config_helper_.addRuntimeOverride("Foo", "bar");
});
An example of modifying `<API key>` to change Envoy’s HTTP/1.1 processing:
c++
config_helper_.addConfigModifier([&](envoy::extensions::filters::network::<API key>::v3::<API key>& hcm) -> void {
envoy::api::v2::core::<API key> options;
options.<API key>()->set_value(true);
hcm.<API key>()->CopyFrom(options);
};);
An example of modifying `<API key>` to add an additional upstream
cluster:
c++
config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) {
bootstrap.<API key>()->set_cluster_name("ratelimit");
auto* ratelimit_cluster = bootstrap.<API key>()->add_clusters();
ratelimit_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]);
ratelimit_cluster->set_name("ratelimit");
ratelimit_cluster-><API key>();
});
In addition to the existing test framework, which allows for carefully timed interaction and ordering of events between downstream, Envoy, and Upstream, there is now an “autonomous” framework which simplifies the common case where the timing is not essential (or bidirectional streaming is desired). When AutonomousUpstream is used, by setting `<API key> = true` before `initialize()`, upstream will by default create <API key> for each incoming connection and AutonomousStreams for each incoming stream. By default, the streams will respond to each complete request with “200 OK” and 10 bytes of payload, but this behavior can be altered by setting various request headers, as documented in [`autonomous_upstream.h`](autonomous_upstream.h)
# Extending the test framework
The Envoy integration test framework is most definitely a work in progress.
When encountering features which do not exist (actions for the autonomous
backend, testing new sections of configuration) please use your best judgement
if the changes will be needed by one specific test file, or will be likely
reused in other integration tests. If it's likely be reused, please add the
appropriate functions to existing utilities or add new test utilities. If it's
likely a one-off change, it can be scoped to the existing test file.
# Debugging integration tests
The Envoy integration test framework is generally designed to fast-fail when
things go wrong, with an explanatory message such as
"Timed out waiting for new connection."
but it's not always clear what the underlying cause is. Because there are many
Envoy components under test, often the best tool for debugging is to try to get
a run of the test with `--test_arg="-l debug"`, or `--test_arg="-l trace"` ideally
with a clean run (if it's a code change which caused test breakage) or a comparable
test (if it's a new test failing). Looking at the conn_manager_impl.cc
logs, router.cc logs, and fake_upstream.cc logs, can often give you a feel for
what unexpected event is occurring. If that doesn't help, following the GDB
instructions to run the test in a debugger or sprinkling cerrs around are both often helpful.
# Deflaking tests
The instructions below assume the developer is running tests natively with bazel
rather than in docker. For developers using docker the best workaround today is
to replace `//test/...` on the relevant `ci/do_ci.sh`with the command lines
referenced below and remember to back those changes out before sending the fix
upstream!
## Reproducing test flakes
The first step of fixing test flakes is reproducing the test flake. In general
if you have written a test which flakes, you can start by running
``
bazel test [test_name] --runs_per_test=1000
``
Which runs the full test many times. If this works, great! If not, it's worth
trying to stress your system more by running more tests in parallel, by setting
`--jobs` and `--local_resources.`
Once you've managed to reproduce a failure it may be beneficial to limit your
test run to the specific failing test(s) with `--gtest_filter`. This may cause
the test to flake less often (i.e. if two tests are interfering with each other,
scoping to your specific test name may harm rather than help reproducibility.)
but if it works it lets you iterate faster.
Another helpful tip for debugging is turn turn up Envoy trace logs with
`--test_arg="-l trace"`. Again if the test failure is due to a race, this may make
it harder to reproduce, and it may also hide any custom logging you add, but it's a
handy thing to know of to follow the general flow.
The full command might look something like
bazel test //test/integration:<API key> \
--test_arg=--gtest_filter="IpVersions/<API key>.<API key>/IPv6" \
--jobs 60 --local_test_jobs=60 --runs_per_test=1000 --test_arg="-l trace"
## Debugging test flakes
Once you've managed to reproduce your test flake, you get to figure out what's
going on. If your failure mode isn't documented below, ideally some combination
of cerr << logging and trace logs will help you sort out what is going on (and
please add to this document as you figure it out!)
## Unexpected disconnects
As commented in `HttpIntegrationTest::<API key>()`, the
tear-down sequence between upstream, Envoy, and client is somewhat sensitive to
ordering. If a given unit test does not use the provided member variables, for
example opens multiple client or upstream connections, the test author should be
aware of test best practices for clean-up which boil down to "Clean up upstream
first".
Upstream connections run in their own threads, so if the client disconnects with
open streams, there's a race where Envoy detects the disconnect, and kills the
corresponding upstream stream, which is indistinguishable from an unexpected
disconnect and triggers test failure. Because the client is run from the main
thread, if upstream is closed first, the client will not detect the inverse
close, so no test failure will occur.
## Unparented upstream connections
The most common failure mode here is if the test adds additional fake
upstreams for *DS connections (ADS, EDS etc) which are not properly shut down
(for a very sensitive test framework)
The failure mode here is that during test teardown one closes the DS connection
and then shuts down Envoy. Unfortunately as Envoy is running in its own thread,
it will try to re-establish the *DS connection, sometimes creating a connection
which is then "unparented". The solution here is to explicitly allow Envoy
reconnects before closing the connection, using
`my_ds_upstream_-><API key>(true);` |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module ReconciliationUI
class Application < Rails::Application |
# AUTOGENERATED FILE
FROM balenalib/isg-503-debian:buster-run
# remove several traces of debian python
RUN apt-get purge -y python.*
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# install python dependencies
RUN apt-get update && apt-get install -y --<API key> \
ca-certificates \
netbase \ |
package es.seastorm.dragonwars.client;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.<API key>;
import es.seastorm.dragonwars.DragonWarsGame;
public class HtmlLauncher extends GwtApplication {
@Override
public <API key> getConfig () {
return new <API key>(800, 480);
}
@Override
public ApplicationListener <API key> () {
return new DragonWarsGame();
}
} |
FROM linuxkit/alpine:<SHA1-like> AS grub-build
RUN apk add \
automake \
make \
bison \
gettext \
flex \
gcc \
git \
libtool \
libc-dev \
linux-headers \
python3 \
autoconf
# because python is not available
RUN ln -s python3 /usr/bin/python
ENV GRUB_MODULES="part_gpt fat ext2 iso9660 gzio linux acpi normal cpio crypto disk boot crc64 gpt \
search_disk_uuid tftp verify xzio xfs video"
ENV GRUB_COMMIT=<SHA1-like>
RUN mkdir /grub-lib && \
set -e && \
git clone https://github.com/coreos/grub.git && \
cd grub && \
git checkout -b grub-build ${GRUB_COMMIT} && \
./autogen.sh && \
./configure --libdir=/grub-lib --with-platform=efi CFLAGS="-Os -Wno-unused-value" && \
make -j "$(getconf _NPROCESSORS_ONLN)" && \
make install && \
case $(uname -m) in \
x86_64) \
./grub-mkimage -O x86_64-efi -d /grub-lib/grub/x86_64-efi -o /grub-lib/BOOTX64.EFI -p /EFI/BOOT ${GRUB_MODULES} linuxefi; \
;; \
aarch64) \
./grub-mkimage -O arm64-efi -d /grub-lib/grub/arm64-efi -o /grub-lib/BOOTAA64.EFI -p /EFI/BOOT ${GRUB_MODULES}; \
;; \
esac
FROM linuxkit/alpine:<SHA1-like> AS make-img
RUN \
apk update && apk upgrade && \
apk add --no-cache \
dosfstools \
libarchive-tools \
binutils \
mtools \
sfdisk \
sgdisk \
xfsprogs \
&& true
COPY . .
COPY --from=grub-build /grub-lib/BOOT*.EFI /usr/local/share/
ENTRYPOINT [ "/make-efi" ] |
package hu.akarnokd.rxjava2;
import java.util.concurrent.*;
import io.reactivex.*;
import io.reactivex.internal.schedulers.SingleScheduler;
public class FirstAndSample {
public static void main(String[] args) throws Exception {
int[] delay = { 0, 100, 250, 300, 900, 975, 1050, 1200 };
Flowable.range(0, delay.length)
.flatMap(v -> Flowable.timer(delay[v], TimeUnit.MILLISECONDS).map(u -> (v + 1) + " @ " + delay[v] + " ms"))
.compose(firstAndSample(200, TimeUnit.MILLISECONDS))
.blockingSubscribe(System.out::println)
;
}
public static <T> FlowableTransformer<T, T> firstAndSample(long delay, TimeUnit unit) {
return f -> {
Scheduler s = new SingleScheduler();
return f.publish(g -> {
return g.take(1)
.concatWith(
g
.sample(delay, unit, s, true)
.timeout(delay + 1, unit, s)
)
.retry(e -> e instanceof TimeoutException)
;
});
};
}
} |
(function () {
function timecode() {
return function(seconds) {
var seconds = Number.parseFloat(seconds);
if (Number.isNaN(seconds)) {
return '-:
}
var wholeSeconds = Math.floor(seconds);
var minutes = Math.floor(wholeSeconds / 60);
var remainingSeconds = wholeSeconds % 60;
var output = minutes + ':';
if (remainingSeconds < 10) {
output += '0';
}
output += remainingSeconds;
return output;
};
}
angular
.module('blocJams')
.filter('timecode', timecode);
})(); |
.ui.grid.title-bar-container {
margin-top: 0;
}
.ui.grid.title-bar-container .row {
padding-top: 0;
}
.ui.grid.title-bar {
background-color: #FFFFFF;
border-bottom: 1px solid #DDDDDD;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ui.grid.page-content {
background-color: #FFFFFF;
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.05);
border-left: 1px solid #DDDDDD;
border-right: 1px solid #DDDDDD;
border-bottom: 2px solid #DDDDDD;
}
.ui.form.<API key> {
display: inline;
}
a.upvote.submit.blue-link.right.floated {
color: #009fda;
}
.social-button {
margin: 1rem 0 !important;
}
.login-grid {
position: relative;
}
.login-actions {
text-align: left !important;
}
.ui.secondary.pointing.menu>.item, .ui.secondary.pointing.menu>.menu>.item {
margin: 0 0 -2px !important;
}
.makey-parents {
margin-top: 0 !important;
}
.makey-header {
margin-bottom: 0 !important;
}
.highlight {
background-color: yellow;
}
.ui.tab {
margin-top: 0 !important;
}
.ui.tab.ui.basic.segment {
padding-top: 0 !important;
}
.ui.divided.items .item:hover {
background-color: rgba(0,0,0,.03);
cursor: pointer;
} |
package com.claudiodegio.dbsync.core;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import androidx.sqlite.db.<API key>;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SqlLiteUtility {
public static Map<String, ValueMetadata> <API key>(final <API key> db, final String tableName) {
List<ValueMetadata> columns;
Map<String, ValueMetadata> maps;
columns = readTableMetadata(db, tableName);
maps = new HashMap<>();
for (ValueMetadata column : columns) {
maps.put(column.getName(), column);
}
return maps;
}
public static List<ValueMetadata> readTableMetadata(final <API key> db, final String tableName) {
Cursor cursor = null;
String columnName;
String columnType;
int notNull, pk, type;
List<ValueMetadata> list = new ArrayList<>();
cursor = db.query("PRAGMA table_info('" + tableName + "')", null);
while (cursor.moveToNext()){
columnName = getCursorString(cursor, "name");
columnType = getCursorString(cursor, "type");
notNull = getCursorInt(cursor, "notnull");
pk = getCursorInt(cursor, "pk");
switch (columnType) {
case "INTEGER":
type = ValueMetadata.TYPE_LONG;
break;
case "TEXT":
type = ValueMetadata.TYPE_STRING;
break;
default:
throw new RuntimeException("Type " + columnType + " non supported !!!");
}
list.add(new ValueMetadata(columnName, type, notNull == 1, pk == 1));
}
cursor.close();
return list;
}
public static String getCursorString(final Cursor cursor, final String columnName) {
int index = cursor.getColumnIndex(columnName);
return cursor.getString(index);
}
public static int getCursorInt(final Cursor cursor, final String columnName) {
int index = cursor.getColumnIndex(columnName);
return cursor.getInt(index);
}
public static long getCursorLong(final Cursor cursor, final String columnName) {
int index = cursor.getColumnIndex(columnName);
return cursor.getLong(index);
}
public static Value <API key>(final Cursor cursor, final String columnName, @ValueMetadata.Type int type) {
return SqlLiteUtility.<API key>(cursor, new ValueMetadata(columnName, type));
}
public static Value <API key>(final Cursor cursor, final ValueMetadata metadata) {
String columnName;
int index;
long valueLong;
String valueString;
Value value;
columnName = metadata.getName();
index = cursor.getColumnIndex(columnName);
if (cursor.isNull(index)) {
value = new Value(metadata);
} else if(metadata.getType() == ValueMetadata.TYPE_LONG) {
valueLong = getCursorLong(cursor, columnName);
value = new Value(valueLong, metadata);
} else {
valueString = getCursorString(cursor, columnName);
value = new Value(valueString, metadata);
}
return value;
}
public static void <API key>(final Value value, final ContentValues contentValues) {
ValueMetadata metadata;
String fieldName;
fieldName = value.getMetadata().getName();
if (value.isNull()) {
contentValues.putNull(fieldName);
return;
}
metadata = value.getMetadata();
switch (metadata.getType()) {
case ValueMetadata.TYPE_LONG:
contentValues.put(fieldName, value.getValueLong());
break;
case ValueMetadata.TYPE_STRING:
contentValues.put(fieldName, value.getValueString());
break;
}
}
static SqlWithBinding <API key>(final String sql){
String sqlWithBind;
List<String> selectionArg;
Pattern p;
Matcher m;
// Find the binding params
p = Pattern.compile(":([\\w]+)");
m = p.matcher(sql);
selectionArg = new ArrayList<>();
while (m.find()) {
selectionArg.add(m.group(1));
}
sqlWithBind = sql.replaceAll(":([\\w]+)", "?");
return new SqlWithBinding(sql, sqlWithBind, selectionArg);
}
static public class SqlWithBinding {
private String original;
private String parsed;
private List<String> selectionArgs;
private SqlWithBinding(String original, String parsed, List<String> selectionArgs) {
this.original = original;
this.parsed = parsed;
this.selectionArgs = selectionArgs;
}
public String getParsed() {
return parsed;
}
public String getOriginal() {
return original;
}
public String [] getArgs(){
return selectionArgs.toArray( new String[selectionArgs.size()]);
}
@Override
public String toString() {
return "SqlWithBinding{" +
"original='" + original + '\'' +
", parsed='" + parsed + '\'' +
", selectionArgs=" + selectionArgs +
'}';
}
}
} |
module.exports = {
newsFeedCategories:[],
tabs:[]
}; |
import os.path as op
import logging
import shutil
from subprocess import check_output
from tempfile import mkdtemp
import click
from ob_pipelines.s3 import (
s3, <API key>, <API key>, SCRATCH_DIR, <API key>
)
logger = logging.getLogger('ob-pipelines')
@click.command()
@click.argument('fq1')
@click.argument('fq2')
@click.argument('out_dir')
@click.argument('name')
def fastqc(fq1, fq2, out_dir, name):
"""Run FastQC"""
out_dir = out_dir if out_dir.endswith('/') else out_dir + '/'
temp_dir = mkdtemp(dir=SCRATCH_DIR)
fq1_local = op.join(temp_dir, name + '_1.fastq.gz')
fq2_local = op.join(temp_dir, name + '_2.fastq.gz')
if fq1.startswith('s3:
# Assume that if fq1 is in S3, so is fq2
<API key>(fq1, fq1_local)
<API key>(fq2, fq2_local)
else:
shutil.copy(fq1, fq1_local)
shutil.copy(fq2, fq2_local)
cmd = ['fastqc', '-o', temp_dir, fq1_local, fq2_local]
# Run command and save output
logging.info('Running:\n{}'.format(' '.join(cmd)))
out = check_output(cmd)
logging.info(out.decode())
out_files = [
name + '_1_fastqc.html',
name + '_2_fastqc.html',
name + '_1_fastqc.zip',
name + '_2_fastqc.zip'
]
for fname in out_files:
# Upload temp out directory to S3 with prefix
if out_dir.startswith('s3:
bucket, key = <API key>(out_dir)
local_fpath = op.join(temp_dir, fname)
print('uploading {} to s3://{}/{}{}'.format(local_fpath, bucket, key, fname))
s3.upload_file(local_fpath, bucket, key + fname)
<API key>(local_fpath)
else:
shutil.move(temp_dir, out_dir)
if __name__ == '__main__':
fastqc() |
package main
import (
"fmt"
"github.com/ardielle/ardielle-go/rdl"
"io"
"os"
"strconv"
"strings"
"text/template"
"unicode"
)
func <API key>(banner string) string {
return fmt.Sprintf("//\n// This file generated by %s. Do not modify!\n//", banner)
}
func <API key>(schema *rdl.Schema, ns string) string {
if ns != "" {
return ns
}
return string(schema.Namespace)
}
func <API key>(options []string, key string) bool {
for _, option := range options {
substrings := strings.SplitN(option, "=", 2)
// make sure we got 2 values back
if len(substrings) != 2 {
continue
}
// continue if the key name does not match our option
if substrings[0] != key {
continue
}
value, err := strconv.ParseBool(substrings[1])
if err == nil {
return value
} else {
return false
}
}
return false
}
func <API key>(options []string, key string) string {
for _, option := range options {
substrings := strings.SplitN(option, "=", 2)
// make sure we got 2 values back
if len(substrings) != 2 {
continue
}
// continue if the key name does not match our option
if substrings[0] != key {
continue
}
return substrings[1]
}
return ""
}
func camelSnakeToKebab(name string) string {
s := strings.Replace(name, "_", "-", -1)
result := make([]rune, 0)
wasLower := false
for _, c := range s {
if unicode.IsUpper(c) {
if wasLower {
result = append(result, '-')
}
result = append(result, unicode.ToLower(c))
wasLower = false
} else {
result = append(result, c)
wasLower = true
}
}
return string(result)
}
func <API key>(schema *rdl.Schema, def string) string {
if def != "" {
return def
}
if schema.Name != "" {
n := camelSnakeToKebab(string(schema.Name))
if schema.Version != nil {
return fmt.Sprintf("/%s/v%d", n, *schema.Version)
} else {
return fmt.Sprintf("/%s", n)
}
}
return "/"
}
func javaGenerationDir(outdir string, schema *rdl.Schema, ns string) (string, error) {
dir := outdir
if dir == "" {
dir = "./src/main/java"
}
pack := <API key>(schema, ns)
if pack != "" {
dir += "/" + strings.Replace(pack, ".", "/", -1)
}
_, err := os.Stat(dir)
if err != nil {
err = os.MkdirAll(dir, 0755)
}
return dir, err
}
func <API key>(banner string, schema *rdl.Schema, writer io.Writer, ns string) error {
funcMap := template.FuncMap{
"header": func() string { return <API key>(banner) },
"package": func() string {
s := <API key>(schema, ns)
if s == "" {
return s
}
return "package " + s + ";\n"
},
}
t := template.Must(template.New("util").Funcs(funcMap).Parse(<API key>))
return t.Execute(writer, schema)
}
const <API key> = `{{header}}
{{package}}
public class ResourceError {
public int code;
public String message;
public ResourceError code(int code) {
this.code = code;
return this;
}
public ResourceError message(String message) {
this.message = message;
return this;
}
public String toString() {
return "{code: " + code + ", message: \"" + message + "\"}";
}
}
`
func <API key>(banner string, schema *rdl.Schema, writer io.Writer, ns string) error {
funcMap := template.FuncMap{
"header": func() string { return <API key>(banner) },
"package": func() string {
s := <API key>(schema, ns)
if s == "" {
return s
}
return "package " + s + ";\n"
},
}
t := template.Must(template.New("util").Funcs(funcMap).Parse(<API key>))
return t.Execute(writer, schema)
}
const <API key> = `{{header}}
{{package}}
public class ResourceException extends RuntimeException {
public final static int OK = 200;
public final static int CREATED = 201;
public final static int ACCEPTED = 202;
public final static int NO_CONTENT = 204;
public final static int MOVED_PERMANENTLY = 301;
public final static int FOUND = 302;
public final static int SEE_OTHER = 303;
public final static int NOT_MODIFIED = 304;
public final static int TEMPORARY_REDIRECT = 307;
public final static int BAD_REQUEST = 400;
public final static int UNAUTHORIZED = 401;
public final static int FORBIDDEN = 403;
public final static int NOT_FOUND = 404;
public final static int CONFLICT = 409;
public final static int GONE = 410;
public final static int PRECONDITION_FAILED = 412;
public final static int <API key> = 415;
public final static int <API key> = 428;
public final static int TOO_MANY_REQUESTS = 429;
public final static int <API key> = 431;
public final static int <API key> = 500;
public final static int NOT_IMPLEMENTED = 501;
public final static int SERVICE_UNAVAILABLE = 503;
public final static int NETWORK_<API key> = 511;
public static String codeToString(int code) {
switch (code) {
case OK: return "OK";
case CREATED: return "Created";
case ACCEPTED: return "Accepted";
case NO_CONTENT: return "No Content";
case MOVED_PERMANENTLY: return "Moved Permanently";
case FOUND: return "Found";
case SEE_OTHER: return "See Other";
case NOT_MODIFIED: return "Not Modified";
case TEMPORARY_REDIRECT: return "Temporary Redirect";
case BAD_REQUEST: return "Bad Request";
case UNAUTHORIZED: return "Unauthorized";
case FORBIDDEN: return "Forbidden";
case NOT_FOUND: return "Not Found";
case CONFLICT: return "Conflict";
case GONE: return "Gone";
case PRECONDITION_FAILED: return "Precondition Failed";
case <API key>: return "Unsupported Media Type";
case <API key>: return "Precondition Required";
case TOO_MANY_REQUESTS: return "Too Many Requests";
case <API key>: return "Request Header Fields Too Large";
case <API key>: return "Internal Server Error";
case NOT_IMPLEMENTED: return "Not Implemented";
case SERVICE_UNAVAILABLE: return "Service Unavailable";
case NETWORK_<API key>: return "Network Authentication Required";
default: return "" + code;
}
}
int code;
Object data;
public ResourceException(int code) {
this(code, new ResourceError().code(code).message(codeToString(code)));
}
public ResourceException(int code, Object data) {
super("ResourceException (" + code + "): " + data);
this.code = code;
this.data = data;
}
public int getCode() {
return code;
}
public Object getData() {
return data;
}
public <T> T getData(Class<T> cl) {
return cl.cast(data);
}
}
` |
package com.sun.xacml.ctx;
import com.sun.xacml.Indenter;
import com.sun.xacml.ParsingException;
import com.sun.xacml.attr.AttributeDesignator;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.<API key>;
import javax.xml.parsers.<API key>;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
* Represents a request made to the PDP. This is the class that contains all
* the data used to start a policy evaluation.
*
* @since 1.0
* @author Seth Proctor
* @author Marco Barreno
*/
public class RequestCtx
{
// There must be at least one subject
private Set subjects = null;
// There must be exactly one resource
private Set resource = null;
// There must be exactly one action
private Set action = null;
// There may be any number of environment attributes
private Set environment = null;
// Hold onto the root of the document for XPath searches
private Node documentRoot = null;
// The optional, generic resource content
private String resourceContent;
/**
* Constructor that creates a <code>RequestCtx</code> from components.
*
* @param subjects a <code>Set</code> of <code>Subject</code>s
* @param resource a <code>Set</code> of <code>Attribute</code>s
* @param action a <code>Set</code> of <code>Attribute</code>s
* @param environment a <code>Set</code> of environment attributes
*/
public RequestCtx(Set subjects, Set resource, Set action,
Set environment) {
this(subjects, resource, action, environment, null, null);
}
/**
* Constructor that creates a <code>RequestCtx</code> from components.
*
* @param subjects a <code>Set</code> of <code>Subject</code>s
* @param resource a <code>Set</code> of <code>Attribute</code>s
* @param action a <code>Set</code> of <code>Attribute</code>s
* @param environment a <code>Set</code> of environment attributes
* @param documentRoot the root node of the DOM tree for this request
*/
public RequestCtx(Set subjects, Set resource, Set action,
Set environment, Node documentRoot) {
this(subjects, resource, action, environment, documentRoot, null);
}
/**
* Constructor that creates a <code>RequestCtx</code> from components.
*
* @param subjects a <code>Set</code> of <code>Subject</code>s
* @param resource a <code>Set</code> of <code>Attribute</code>s
* @param action a <code>Set</code> of <code>Attribute</code>s
* @param environment a <code>Set</code> of environment attributes
* @param resourceContent a text-encoded version of the content, suitable
* for including in the RequestType, including the
* root <code>RequestContent</code> node
*/
public RequestCtx(Set subjects, Set resource, Set action,
Set environment, String resourceContent) {
this(subjects, resource, action, environment, null, resourceContent);
}
/**
* Constructor that creates a <code>RequestCtx</code> from components.
*
* @param subjects a <code>Set</code> of <code>Subject</code>s
* @param resource a <code>Set</code> of <code>Attribute</code>s
* @param action a <code>Set</code> of <code>Attribute</code>s
* @param environment a <code>Set</code> of environment attributes
* @param documentRoot the root node of the DOM tree for this request
* @param resourceContent a text-encoded version of the content, suitable
* for including in the RequestType, including the
* root <code>RequestContent</code> node
*
* @throws <API key> if the inputs are not well formed
*/
public RequestCtx(Set subjects, Set resource, Set action,
Set environment, Node documentRoot,
String resourceContent) throws <API key> {
// make sure subjects is well formed
Iterator sIter = subjects.iterator();
while (sIter.hasNext()){
if (!(sIter.next() instanceof Subject))
throw new <API key>("Subjects input is not " +
"well formed");
}
this.subjects = Collections.unmodifiableSet(new HashSet(subjects));
// make sure resource is well formed
Iterator rIter = resource.iterator();
while (rIter.hasNext()){
if (!(rIter.next() instanceof Attribute))
throw new <API key>("Resource input is not " +
"well formed");
}
this.resource = Collections.unmodifiableSet(new HashSet(resource));
// make sure action is well formed
Iterator aIter = action.iterator();
while (aIter.hasNext()){
if (!(aIter.next() instanceof Attribute))
throw new <API key>("Action input is not " +
"well formed");
}
this.action = Collections.unmodifiableSet(new HashSet(action));
// make sure environment is well formed
Iterator eIter = environment.iterator();
while (eIter.hasNext()){
if (!(eIter.next() instanceof Attribute))
throw new <API key>("Environment input is not" +
" well formed");
}
this.environment =
Collections.unmodifiableSet(new HashSet(environment));
this.documentRoot = documentRoot;
this.resourceContent = resourceContent;
}
public static RequestCtx getInstance(Node root) throws ParsingException {
Set newSubjects = new HashSet();
Set newResource = null;
Set newAction = null;
Set newEnvironment = null;
String resourceContent;
// First check to be sure the node passed is indeed a Request node.
String tagName = root.getNodeName();
//System.out.println("tagName = "+tagName);
if (! tagName.equals("Request")) {
throw new ParsingException("Request cannot be constructed using " +
"type: " + root.getNodeName());
}
// Now go through its child nodes, finding Subject,
// Resource, Action, and Environment data
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
String tag = node.getNodeName();
if (tag.equals("Subject")) {
// see if there is a category
Node catNode =
node.getAttributes().getNamedItem("SubjectCategory");
URI category = null;
if (catNode != null) {
try {
category = new URI(catNode.getNodeValue());
} catch (Exception e) {
throw new ParsingException("Invalid Category URI", e);
}
}
// now we get the attributes
Set attributes = parseAttributes(node);
// finally, add the list to the set of subject attributes
newSubjects.add(new Subject(category, attributes));
} else if (tag.equals("Resource")) {
// For now, this code doesn't parse the content, since it's
// a set of anys with a set of anyAttributes, and therefore
// no useful data can be gleaned from it anyway. The theory
// here is that it's only useful in the instance doc, so
// we won't bother parse it, but we may still want to go
// back and provide some support at some point...
newResource = parseAttributes(node);
} else if (tag.equals("Action")) {
newAction = parseAttributes(node);
} else if (tag.equals("Environment")) {
newEnvironment = parseAttributes(node);
}
}
// if we didn't have an environment section, the only optional section
// of the four, then create a new empty set for it
if (newEnvironment == null)
newEnvironment = new HashSet();
// Now create and return the RequestCtx from the information
// gathered
return new RequestCtx(newSubjects, newResource,
newAction, newEnvironment, root);
}
/*
* Helper method that parses a set of Attribute types. The Subject,
* Action and Environment sections all look like this.
*/
private static Set parseAttributes(Node root) throws ParsingException {
Set set = new HashSet();
// the Environment section is just a list of Attributes
NodeList nodes = root.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
//System.out.println("NodeName = "+node.getNodeName());
if (node.getNodeName().equals("Attribute"))
set.add(Attribute.getInstance(node));
}
return set;
}
/**
* Creates a new <code>RequestCtx</code> by parsing XML from an
* input stream. Note that this a convenience method, and it will
* not do schema validation by default. You should be parsing the data
* yourself, and then providing the root node to the other
* <code>getInstance</code> method. If you use this convenience
* method, you probably want to turn on validation by setting the
* context schema file (see the programmer guide for more information
* on this).
*
* @param input a stream providing the XML data
*
* @return a new <code>RequestCtx</code>
*
* @throws ParserException if there is an error parsing the input
*/
public static RequestCtx getInstance(InputStream input)
throws ParsingException
{
return getInstance(InputParser.parseInput(input, "Request"));
}
/**
* Returns a <code>Set</code> containing <code>Subject</code> objects.
*
* @return the request's subject attributes
*/
public Set getSubjects() {
return subjects;
}
/**
* Returns a <code>Set</code> containing <code>Attribute</code> objects.
*
* @return the request's resource attributes
*/
public Set getResource() {
return resource;
}
/**
* Returns a <code>Set</code> containing <code>Attribute</code> objects.
*
* @return the request's action attributes
*/
public Set getAction() {
return action;
}
/**
* Returns a <code>Set</code> containing <code>Attribute</code> objects.
*
* @return the request's environment attributes
*/
public Set <API key>() {
return environment;
}
public Node getDocumentRoot() {
return documentRoot;
}
/**
* Encodes this context into its XML representation and writes this
* encoding to the given <code>OutputStream</code>. No
* indentation is used.
*
* @param output a stream into which the XML-encoded data is written
*/
public void encode(OutputStream output) {
encode(output, new Indenter(0));
}
/**
* Encodes this context into its XML representation and writes
* this encoding to the given <code>OutputStream</code> with
* indentation.
*
* @param output a stream into which the XML-encoded data is written
* @param indenter an object that creates indentation strings
*/
public void encode(OutputStream output, Indenter indenter) {
// Make a PrintStream for a nicer printing interface
PrintStream out = new PrintStream(output);
// Prepare the indentation string
String topIndent = indenter.makeString();
out.println(topIndent + "<Request>");
// go in one more for next-level elements...
indenter.in();
String indent = indenter.makeString();
// ...and go in again for everything else
indenter.in();
// first off, go through all subjects
Iterator it = subjects.iterator();
while (it.hasNext()) {
Subject subject = (Subject)(it.next());
out.print(indent + "<Subject SubjectCategory=\"" +
subject.getCategory().toString() + "\"");
Set subjectAttrs = subject.getAttributes();
if (subjectAttrs.size() == 0) {
// there's nothing in this Subject, so just close the tag
out.println("/>");
} else {
// there's content, so fill it in
out.println(">");
encodeAttributes(subjectAttrs, out, indenter);
out.println(indent + "</Subject>");
}
}
// next do the resource
if ((resource.size() != 0) || (resourceContent != null)) {
out.println(indent + "<Resource>");
if (resourceContent != null)
out.println(indenter.makeString() + "<ResourceContent>" +
resourceContent + "</ResourceContent>");
encodeAttributes(resource, out, indenter);
out.println(indent + "</Resource>");
} else {
out.println(indent + "<Resource/>");
}
// now the action
if (action.size() != 0) {
out.println(indent + "<Action>");
encodeAttributes(action, out, indenter);
out.println(indent + "</Action>");
} else {
out.println(indent + "<Action/>");
}
// finally the environment, if there are any attrs
if (environment.size() != 0) {
out.println(indent + "<Environment>");
encodeAttributes(environment, out, indenter);
out.println(indent + "</Environment>");
}
// we're back to the top
indenter.out();
indenter.out();
out.println(topIndent + "</Request>");
}
/**
* Private helper function to encode the attribute sets
*/
private void encodeAttributes(Set attributes, PrintStream out,
Indenter indenter) {
Iterator it = attributes.iterator();
while (it.hasNext()) {
Attribute attr = (Attribute)(it.next());
attr.encode(out, indenter);
}
}
} |
<!DOCTYPE html>
<!
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.5
Version: 4.5.2
Author: KeenThemes
Website: http:
Contact: support@keenthemes.com
Follow: www.twitter.com/keenthemes
Like: www.facebook.com/keenthemes
Purchase: http://themeforest.net/item/<API key>/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>Metronic | Disabled Menu</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="../assets/global/css/components-rounded.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="../assets/layouts/layout/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/layouts/layout/css/themes/darkblue.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="../assets/layouts/layout/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" /> </head>
<!-- END HEAD -->
<body class="page-header-fixed <API key> page-content-white">
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<div class="page-header-inner ">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="index.html">
<img src="../assets/layouts/layout/img/logo.png" alt="logo" class="logo-default" /> </a>
<div class="menu-toggler sidebar-toggler"> </div>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse"> </a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
<!-- BEGIN NOTIFICATION DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended <API key>" id="<API key>">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-bell"></i>
<span class="badge badge-default"> 7 </span>
</a>
<ul class="dropdown-menu">
<li class="external">
<h3>
<span class="bold">12 pending</span> notifications</h3>
<a href="page_user_profile_1.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
<li>
<a href="javascript:;">
<span class="time">just now</span>
<span class="details">
<span class="label label-sm label-icon label-success">
<i class="fa fa-plus"></i>
</span> New user registered. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">3 mins</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> Server #12 overloaded. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">10 mins</span>
<span class="details">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span> Server #2 not responding. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">14 hrs</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span> Application error. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">2 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> Database overloaded 68%. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">3 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> A user IP blocked. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">4 days</span>
<span class="details">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span> Storage Server #4 not responding dfdfdfd. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">5 days</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span> System Error. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">9 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> Storage server failed. </span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END NOTIFICATION DROPDOWN -->
<!-- BEGIN INBOX DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-inbox" id="header_inbox_bar">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-envelope-open"></i>
<span class="badge badge-default"> 4 </span>
</a>
<ul class="dropdown-menu">
<li class="external">
<h3>You have
<span class="bold">7 New</span> Messages</h3>
<a href="app_inbox.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 275px;" data-handle-color="#637283">
<li>
<a href="
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar2.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Lisa Wong </span>
<span class="time">Just Now </span>
</span>
<span class="message"> Vivamus sed auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar3.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Richard Doe </span>
<span class="time">16 mins </span>
</span>
<span class="message"> Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar1.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Bob Nilson </span>
<span class="time">2 hrs </span>
</span>
<span class="message"> Vivamus sed nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar2.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Lisa Wong </span>
<span class="time">40 mins </span>
</span>
<span class="message"> Vivamus sed auctor 40% nibh congue nibh... </span>
</a>
</li>
<li>
<a href="
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar3.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Richard Doe </span>
<span class="time">46 mins </span>
</span>
<span class="message"> Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END INBOX DROPDOWN -->
<!-- BEGIN TODO DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-tasks" id="header_task_bar">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-calendar"></i>
<span class="badge badge-default"> 3 </span>
</a>
<ul class="dropdown-menu extended tasks">
<li class="external">
<h3>You have
<span class="bold">12 pending</span> tasks</h3>
<a href="app_todo.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 275px;" data-handle-color="#637283">
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">New release v1.2 </span>
<span class="percent">30%</span>
</span>
<span class="progress">
<span style="width: 40%;" class="progress-bar <API key>" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Application deployment</span>
<span class="percent">65%</span>
</span>
<span class="progress">
<span style="width: 65%;" class="progress-bar progress-bar-danger" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">65% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Mobile app release</span>
<span class="percent">98%</span>
</span>
<span class="progress">
<span style="width: 98%;" class="progress-bar <API key>" aria-valuenow="98" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">98% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Database migration</span>
<span class="percent">10%</span>
</span>
<span class="progress">
<span style="width: 10%;" class="progress-bar <API key>" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">10% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Web server upgrade</span>
<span class="percent">58%</span>
</span>
<span class="progress">
<span style="width: 58%;" class="progress-bar progress-bar-info" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">58% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Mobile development</span>
<span class="percent">85%</span>
</span>
<span class="progress">
<span style="width: 85%;" class="progress-bar <API key>" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">85% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">New UI release</span>
<span class="percent">38%</span>
</span>
<span class="progress progress-striped">
<span style="width: 38%;" class="progress-bar <API key>" aria-valuenow="18" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">38% Complete</span>
</span>
</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END TODO DROPDOWN -->
<!-- BEGIN USER LOGIN DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-user">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<img alt="" class="img-circle" src="../assets/layouts/layout/img/avatar3_small.jpg" />
<span class="username <API key>"> Nick </span>
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu <API key>">
<li>
<a href="page_user_profile_1.html">
<i class="icon-user"></i> My Profile </a>
</li>
<li>
<a href="app_calendar.html">
<i class="icon-calendar"></i> My Calendar </a>
</li>
<li>
<a href="app_inbox.html">
<i class="icon-envelope-open"></i> My Inbox
<span class="badge badge-danger"> 3 </span>
</a>
</li>
<li>
<a href="app_todo.html">
<i class="icon-rocket"></i> My Tasks
<span class="badge badge-success"> 7 </span>
</a>
</li>
<li class="divider"> </li>
<li>
<a href="page_user_lock_1.html">
<i class="icon-lock"></i> Lock Screen </a>
</li>
<li>
<a href="page_user_login_1.html">
<i class="icon-key"></i> Log Out </a>
</li>
</ul>
</li>
<!-- END USER LOGIN DROPDOWN -->
<!-- BEGIN QUICK SIDEBAR TOGGLER -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown <API key>">
<a href="javascript:;" class="dropdown-toggle">
<i class="icon-logout"></i>
</a>
</li>
<!-- END QUICK SIDEBAR TOGGLER -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="<API key>">
<!-- BEGIN SIDEBAR -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "<API key>" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "<API key>" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "<API key>" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200" style="padding-top: 20px">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "<API key>" LI element -->
<li class="<API key> hide">
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<div class="sidebar-toggler"> </div>
<!-- END SIDEBAR TOGGLER BUTTON -->
</li>
<!-- DOC: To remove the search box from the sidebar you just need to completely remove the below "<API key>" LI element -->
<li class="<API key>">
<!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->
<!-- DOC: Apply "<API key>" class the below search form to have bordered search box -->
<!-- DOC: Apply "<API key> <API key>" class the below search form to have bordered & solid search box -->
<form class="sidebar-search <API key>" action="<API key>.html" method="POST">
<a href="javascript:;" class="remove">
<i class="icon-close"></i>
</a>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<a href="javascript:;" class="btn submit">
<i class="icon-magnifier"></i>
</a>
</span>
</div>
</form>
<!-- END RESPONSIVE QUICK SEARCH FORM -->
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link disabled-link nav-toggle">
<i class="icon-folder"></i>
<span class="title disable-target">Disable Menu Link</span>
<span class="arrow disable-target"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="javascript:;" class="nav-link disabled-link nav-toggle">
<span class="disable-target">
<i class="icon-settings"></i> Item 1</span>
</a>
</li>
<li class="nav-item">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-globe"></i> Item 2
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="#" class="nav-link disabled-link">
<span class="disable-target">
<i class="icon-tag"></i> Sample Link 1</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-pencil"></i> Sample Link 3</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link disabled-link">
<span class="disable-target">
<i class="icon-graph"></i> Sample Link 3</span>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-bar-chart"></i> Item 3 </a>
</li>
</ul>
</li>
<li class="nav-item start ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item start ">
<a href="index.html" class="nav-link ">
<i class="icon-bar-chart"></i>
<span class="title">Dashboard 1</span>
</a>
</li>
<li class="nav-item start ">
<a href="dashboard_2.html" class="nav-link ">
<i class="icon-bulb"></i>
<span class="title">Dashboard 2</span>
<span class="badge badge-success">1</span>
</a>
</li>
<li class="nav-item start ">
<a href="dashboard_3.html" class="nav-link ">
<i class="icon-graph"></i>
<span class="title">Dashboard 3</span>
<span class="badge badge-danger">5</span>
</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Features</h3>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-diamond"></i>
<span class="title">UI Features</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="ui_colors.html" class="nav-link ">
<span class="title">Color Library</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_general.html" class="nav-link ">
<span class="title">General Components</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_buttons.html" class="nav-link ">
<span class="title">Buttons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_confirmations.html" class="nav-link ">
<span class="title">Popover Confirmations</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_icons.html" class="nav-link ">
<span class="title">Font Icons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_socicons.html" class="nav-link ">
<span class="title">Social Icons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_typography.html" class="nav-link ">
<span class="title">Typography</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Tabs, Accordions & Navs</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_timeline.html" class="nav-link ">
<span class="title">Timeline</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_tree.html" class="nav-link ">
<span class="title">Tree View</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">Page Progress Bar</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Flash </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Big Counter </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="ui_blockui.html" class="nav-link ">
<span class="title">Block UI</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_bootstrap_growl.html" class="nav-link ">
<span class="title">Bootstrap Growl Notifications</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_notific8.html" class="nav-link ">
<span class="title">Notific8 Notifications</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_toastr.html" class="nav-link ">
<span class="title">Toastr Notifications</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_bootbox.html" class="nav-link ">
<span class="title">Bootbox Dialogs</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_alerts_api.html" class="nav-link ">
<span class="title">Metronic Alerts API</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_session_timeout.html" class="nav-link ">
<span class="title">Session Timeout</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_idle_timeout.html" class="nav-link ">
<span class="title">User Idle Timeout</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_modals.html" class="nav-link ">
<span class="title">Modals</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_extended_modals.html" class="nav-link ">
<span class="title">Extended Modals</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_tiles.html" class="nav-link ">
<span class="title">Tiles</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_datepaginator.html" class="nav-link ">
<span class="title">Date Paginator</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_nestable.html" class="nav-link ">
<span class="title">Nestable List</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-puzzle"></i>
<span class="title">Components</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Date & Time Pickers</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Color Pickers</span>
<span class="badge badge-danger">2</span>
</a>
</li>
<li class="nav-item ">
<a href="components_select2.html" class="nav-link ">
<span class="title">Select2 Dropdowns</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Bootstrap Select</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Multi Select</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Select Splitter</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Typeahead Autocomplete</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Bootstrap Tagsinput</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Bootstrap Switch</span>
<span class="badge badge-success">6</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Bootstrap Maxlength</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Bootstrap File Input</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Bootstrap Touchspin</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Form Widgets & Tools</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Context Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="components_editors.html" class="nav-link ">
<span class="title">Markdown & WYSIWYG Editors</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Code Editors</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Ion Range Sliders</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">NoUI Range Sliders</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Knob Circle Dials</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-settings"></i>
<span class="title">Form Stuff</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="form_controls.html" class="nav-link ">
<span class="title">Bootstrap Form
<br>Controls</span>
</a>
</li>
<li class="nav-item ">
<a href="form_controls_md.html" class="nav-link ">
<span class="title">Material Design
<br>Form Controls</span>
</a>
</li>
<li class="nav-item ">
<a href="form_validation.html" class="nav-link ">
<span class="title">Form Validation</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Material Design
<br>Form Validation States</span>
</a>
</li>
<li class="nav-item ">
<a href="form_validation_md.html" class="nav-link ">
<span class="title">Material Design
<br>Form Validation</span>
</a>
</li>
<li class="nav-item ">
<a href="form_layouts.html" class="nav-link ">
<span class="title">Form Layouts</span>
</a>
</li>
<li class="nav-item ">
<a href="form_input_mask.html" class="nav-link ">
<span class="title">Form Input Mask</span>
</a>
</li>
<li class="nav-item ">
<a href="form_editable.html" class="nav-link ">
<span class="title">Form X-editable</span>
</a>
</li>
<li class="nav-item ">
<a href="form_wizard.html" class="nav-link ">
<span class="title">Form Wizard</span>
</a>
</li>
<li class="nav-item ">
<a href="form_icheck.html" class="nav-link ">
<span class="title">iCheck Controls</span>
</a>
</li>
<li class="nav-item ">
<a href="form_image_crop.html" class="nav-link ">
<span class="title">Image Cropping</span>
</a>
</li>
<li class="nav-item ">
<a href="form_fileupload.html" class="nav-link ">
<span class="title">Multiple File Upload</span>
</a>
</li>
<li class="nav-item ">
<a href="form_dropzone.html" class="nav-link ">
<span class="title">Dropzone File Upload</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-bulb"></i>
<span class="title">Elements</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="elements_steps.html" class="nav-link ">
<span class="title">Steps</span>
</a>
</li>
<li class="nav-item ">
<a href="elements_lists.html" class="nav-link ">
<span class="title">Lists</span>
</a>
</li>
<li class="nav-item ">
<a href="elements_ribbons.html" class="nav-link ">
<span class="title">Ribbons</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-briefcase"></i>
<span class="title">Tables</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">Static Tables</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="table_static_basic.html" class="nav-link "> Basic Tables </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Responsive Tables </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">Datatables</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Managed Datatables </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Buttons Extension </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Colreorder Extension </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Rowreorder Extension </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Scroller Extension </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> FixedHeader Extension </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Responsive Extension </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Editable Datatables </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Ajax Datatables </a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="?p=" class="nav-link nav-toggle">
<i class="icon-wallet"></i>
<span class="title">Portlets</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="portlet_boxed.html" class="nav-link ">
<span class="title">Boxed Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_light.html" class="nav-link ">
<span class="title">Light Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_solid.html" class="nav-link ">
<span class="title">Solid Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_ajax.html" class="nav-link ">
<span class="title">Ajax Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_draggable.html" class="nav-link ">
<span class="title">Draggable Portlets</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-bar-chart"></i>
<span class="title">Charts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="charts_amcharts.html" class="nav-link ">
<span class="title">amChart</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_flotcharts.html" class="nav-link ">
<span class="title">Flot Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_flowchart.html" class="nav-link ">
<span class="title">Flow Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_google.html" class="nav-link ">
<span class="title">Google Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_echarts.html" class="nav-link ">
<span class="title">eCharts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_morris.html" class="nav-link ">
<span class="title">Morris Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">HighCharts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="charts_highcharts.html" class="nav-link "> HighCharts </a>
</li>
<li class="nav-item ">
<a href="charts_highstock.html" class="nav-link "> HighStock </a>
</li>
<li class="nav-item ">
<a href="charts_highmaps.html" class="nav-link "> HighMaps </a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-pointer"></i>
<span class="title">Maps</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="maps_google.html" class="nav-link ">
<span class="title">Google Maps</span>
</a>
</li>
<li class="nav-item ">
<a href="maps_vector.html" class="nav-link ">
<span class="title">Vector Maps</span>
</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Layouts</h3>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-layers"></i>
<span class="title">Page Layouts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Classic Page Head</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Light Page Head</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_content_grey.html" class="nav-link ">
<span class="title">Grey Bg Content</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Search Box On Header 1</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Search Box On Header 2</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_language_bar.html" class="nav-link ">
<span class="title">Header Language Bar</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_footer_fixed.html" class="nav-link ">
<span class="title">Fixed Footer</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_boxed_page.html" class="nav-link ">
<span class="title">Boxed Page</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_blank_page.html" class="nav-link ">
<span class="title">Blank Page</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-feed"></i>
<span class="title">Sidebar Layouts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Light Sidebar Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Hover Sidebar Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Sidebar Search Option 1</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Sidebar Search Option 2</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Sidebar Toggler On Sidebar</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Reversed Sidebar Page</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Fixed Sidebar Layout</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Closed Sidebar Layout</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-paper-plane"></i>
<span class="title">Horizontal Menu</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Light Mega Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Dark Mega Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_full_width.html" class="nav-link ">
<span class="title">Full Width Layout</span>
</a>
</li>
</ul>
</li>
<li class="nav-item active open">
<a href="javascript:;" class="nav-link nav-toggle">
<i class=" icon-wrench"></i>
<span class="title">Custom Layouts</span>
<span class="selected"></span>
<span class="arrow open"></span>
</a>
<ul class="sub-menu">
<li class="nav-item active open">
<a href="<API key>.html" class="nav-link ">
<span class="title">Disabled Menu Links</span>
<span class="selected"></span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Full Height Portlet</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<span class="title">Full Height Content</span>
</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Pages</h3>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-basket"></i>
<span class="title">eCommerce</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="ecommerce_index.html" class="nav-link ">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
</a>
</li>
<li class="nav-item ">
<a href="ecommerce_orders.html" class="nav-link ">
<i class="icon-basket"></i>
<span class="title">Orders</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-tag"></i>
<span class="title">Order View</span>
</a>
</li>
<li class="nav-item ">
<a href="ecommerce_products.html" class="nav-link ">
<i class="icon-graph"></i>
<span class="title">Products</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-graph"></i>
<span class="title">Product Edit</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-docs"></i>
<span class="title">Apps</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="app_todo.html" class="nav-link ">
<i class="icon-clock"></i>
<span class="title">Todo 1</span>
</a>
</li>
<li class="nav-item ">
<a href="app_todo_2.html" class="nav-link ">
<i class="icon-check"></i>
<span class="title">Todo 2</span>
</a>
</li>
<li class="nav-item ">
<a href="app_inbox.html" class="nav-link ">
<i class="icon-envelope"></i>
<span class="title">Inbox</span>
</a>
</li>
<li class="nav-item ">
<a href="app_calendar.html" class="nav-link ">
<i class="icon-calendar"></i>
<span class="title">Calendar</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-user"></i>
<span class="title">User</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_user_profile_1.html" class="nav-link ">
<i class="icon-user"></i>
<span class="title">Profile 1</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-user-female"></i>
<span class="title">Profile 1 Account</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-user-following"></i>
<span class="title">Profile 1 Help</span>
</a>
</li>
<li class="nav-item ">
<a href="page_user_profile_2.html" class="nav-link ">
<i class="icon-users"></i>
<span class="title">Profile 2</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-notebook"></i>
<span class="title">Login</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_user_login_1.html" class="nav-link " target="_blank"> Login Page 1 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_2.html" class="nav-link " target="_blank"> Login Page 2 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_3.html" class="nav-link " target="_blank"> Login Page 3 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_4.html" class="nav-link " target="_blank"> Login Page 4 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_5.html" class="nav-link " target="_blank"> Login Page 5 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_6.html" class="nav-link " target="_blank"> Login Page 6 </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="page_user_lock_1.html" class="nav-link " target="_blank">
<i class="icon-lock"></i>
<span class="title">Lock Screen 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_user_lock_2.html" class="nav-link " target="_blank">
<i class="icon-lock-open"></i>
<span class="title">Lock Screen 2</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="<API key>"></i>
<span class="title">General</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_general_about.html" class="nav-link ">
<i class="icon-info"></i>
<span class="title">About</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-call-end"></i>
<span class="title">Contact</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-notebook"></i>
<span class="title">Portfolio</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Portfolio 1 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Portfolio 2 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Portfolio 3 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Portfolio 4 </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-magnifier"></i>
<span class="title">Search</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_general_search.html" class="nav-link "> Search 1 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Search 2 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Search 3 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Search 4 </a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link "> Search 5 </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-tag"></i>
<span class="title">Pricing</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_faq.html" class="nav-link ">
<i class="icon-wrench"></i>
<span class="title">FAQ</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_blog.html" class="nav-link ">
<i class="icon-pencil"></i>
<span class="title">Blog</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-note"></i>
<span class="title">Blog Post</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-envelope"></i>
<span class="title">Invoice</span>
</a>
</li>
<li class="nav-item ">
<a href="<API key>.html" class="nav-link ">
<i class="icon-envelope"></i>
<span class="title">Invoice 2</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-settings"></i>
<span class="title">System</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="<API key>.html" class="nav-link " target="_blank">
<span class="title">Coming Soon</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_404_1.html" class="nav-link ">
<span class="title">404 Page 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_404_2.html" class="nav-link " target="_blank">
<span class="title">404 Page 2</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_404_3.html" class="nav-link " target="_blank">
<span class="title">404 Page 3</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_500_1.html" class="nav-link ">
<span class="title">500 Page 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_500_2.html" class="nav-link " target="_blank">
<span class="title">500 Page 2</span>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-folder"></i>
<span class="title">Multi Level Menu</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-settings"></i> Item 1
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="javascript:;" target="_blank" class="nav-link">
<i class="icon-user"></i> Arrow Toggle
<span class="arrow nav-toggle"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-power"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-paper-plane"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-star"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-camera"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-link"></i> Sample Link 2</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-pointer"></i> Sample Link 3</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="javascript:;" target="_blank" class="nav-link">
<i class="icon-globe"></i> Arrow Toggle
<span class="arrow nav-toggle"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-tag"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-pencil"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-graph"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-bar-chart"></i> Item 3 </a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
<!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="<API key>">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEADER-->
<!-- BEGIN THEME PANEL -->
<div class="theme-panel hidden-xs hidden-sm">
<div class="toggler"> </div>
<div class="toggler-close"> </div>
<div class="theme-options">
<div class="theme-option theme-colors clearfix">
<span> THEME COLOR </span>
<ul>
<li class="color-default current tooltips" data-style="default" data-container="body" data-original-title="Default"> </li>
<li class="color-darkblue tooltips" data-style="darkblue" data-container="body" data-original-title="Dark Blue"> </li>
<li class="color-blue tooltips" data-style="blue" data-container="body" data-original-title="Blue"> </li>
<li class="color-grey tooltips" data-style="grey" data-container="body" data-original-title="Grey"> </li>
<li class="color-light tooltips" data-style="light" data-container="body" data-original-title="Light"> </li>
<li class="color-light2 tooltips" data-style="light2" data-container="body" data-html="true" data-original-title="Light 2"> </li>
</ul>
</div>
<div class="theme-option">
<span> Theme Style </span>
<select class="layout-style-option form-control input-sm">
<option value="square" selected="selected">Square corners</option>
<option value="rounded">Rounded corners</option>
</select>
</div>
<div class="theme-option">
<span> Layout </span>
<select class="layout-option form-control input-sm">
<option value="fluid" selected="selected">Fluid</option>
<option value="boxed">Boxed</option>
</select>
</div>
<div class="theme-option">
<span> Header </span>
<select class="page-header-option form-control input-sm">
<option value="fixed" selected="selected">Fixed</option>
<option value="default">Default</option>
</select>
</div>
<div class="theme-option">
<span> Top Menu Dropdown</span>
<select class="<API key> form-control input-sm">
<option value="light" selected="selected">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<div class="theme-option">
<span> Sidebar Mode</span>
<select class="sidebar-option form-control input-sm">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
<div class="theme-option">
<span> Sidebar Menu </span>
<select class="sidebar-menu-option form-control input-sm">
<option value="accordion" selected="selected">Accordion</option>
<option value="hover">Hover</option>
</select>
</div>
<div class="theme-option">
<span> Sidebar Style </span>
<select class="<API key> form-control input-sm">
<option value="default" selected="selected">Default</option>
<option value="light">Light</option>
</select>
</div>
<div class="theme-option">
<span> Sidebar Position </span>
<select class="sidebar-pos-option form-control input-sm">
<option value="left" selected="selected">Left</option>
<option value="right">Right</option>
</select>
</div>
<div class="theme-option">
<span> Footer </span>
<select class="page-footer-option form-control input-sm">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
</div>
</div>
<!-- END THEME PANEL -->
<!-- BEGIN PAGE BAR -->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<a href="index.html">Home</a>
<i class="fa fa-circle"></i>
</li>
<li>
<span>Custom Layouts</span>
</li>
</ul>
<div class="page-toolbar">
<div class="btn-group pull-right">
<button type="button" class="btn green btn-sm btn-outline dropdown-toggle" data-toggle="dropdown"> Actions
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="
<i class="icon-bell"></i> Action</a>
</li>
<li>
<a href="
<i class="icon-shield"></i> Another action</a>
</li>
<li>
<a href="
<i class="icon-user"></i> Something else here</a>
</li>
<li class="divider"> </li>
<li>
<a href="
<i class="icon-bag"></i> Separated link</a>
</li>
</ul>
</div>
</div>
</div>
<!-- END PAGE BAR -->
<!-- BEGIN PAGE TITLE-->
<h3 class="page-title"> Disabled Menu
<small>disabled menu links</small>
</h3>
<!-- END PAGE TITLE-->
<!-- END PAGE HEADER-->
<div class="note note-info">
<h4 class="block">Disabled Links</h4>
<p> Just apply <code>.disabled-link</code> class to a parent element and <code>.disable-target</code> class to parent itself or child target elements. See the sidebar and horizontal menu disabled links. </p>
</div>
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<a href="javascript:;" class="<API key>">
<i class="icon-login"></i>
</a>
<div class="<API key>" <API key>="false">
<div class="page-quick-sidebar">
<ul class="nav nav-tabs">
<li class="active">
<a href="javascript:;" data-target="#quick_sidebar_tab_1" data-toggle="tab"> Users
<span class="badge badge-danger">2</span>
</a>
</li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_2" data-toggle="tab"> Alerts
<span class="badge badge-success">7</span>
</a>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"> More
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-bell"></i> Alerts </a>
</li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-info"></i> Notifications </a>
</li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-speech"></i> Activities </a>
</li>
<li class="divider"></li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-settings"></i> Settings </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active <API key>" id="quick_sidebar_tab_1">
<div class="<API key>" data-rail-color="#ddd" data-wrapper-class="<API key>">
<h3 class="list-heading">Staff</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-success">8</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar3.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Bob Nilson</h4>
<div class="media-heading-sub"> Project Manager </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar1.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Nick Larson</h4>
<div class="media-heading-sub"> Art Director </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">3</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar4.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Hubert</h4>
<div class="media-heading-sub"> CTO </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar2.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ella Wong</h4>
<div class="media-heading-sub"> CEO </div>
</div>
</li>
</ul>
<h3 class="list-heading">Customers</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-warning">2</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar6.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lara Kunis</h4>
<div class="media-heading-sub"> CEO, Loop Inc </div>
<div class="media-heading-small"> Last seen 03:10 AM </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="label label-sm label-success">new</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar7.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ernie Kyllonen</h4>
<div class="media-heading-sub"> Project Manager,
<br> SmartBizz PTL </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar8.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lisa Stone</h4>
<div class="media-heading-sub"> CTO, Keort Inc </div>
<div class="media-heading-small"> Last seen 13:10 PM </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-success">7</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar9.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Portalatin</h4>
<div class="media-heading-sub"> CFO, H&D LTD </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar10.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Irina Savikova</h4>
<div class="media-heading-sub"> CEO, Tizda Motors Inc </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">4</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar11.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Maria Gomez</h4>
<div class="media-heading-sub"> Manager, Infomatic Inc </div>
<div class="media-heading-small"> Last seen 03:10 AM </div>
</div>
</li>
</ul>
</div>
<div class="<API key>">
<div class="<API key>">
<div class="<API key>">
<a href="javascript:;" class="<API key>">
<i class="icon-arrow-left"></i>Back</a>
</div>
<div class="<API key>">
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body"> When could you send me the report ? </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:15</span>
<span class="body"> Its almost done. I will be sending it shortly </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body"> Alright. Thanks! :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:16</span>
<span class="body"> You are most welcome. Sorry for the delay. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body"> No probs. Just take your time :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body"> Alright. I just emailed it to you. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body"> Great! Thanks. Will check it right away. </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body"> Please let me know if you have any comment. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body"> Sure. I will check and buzz you if anything needs to be corrected. </span>
</div>
</div>
</div>
<div class="<API key>">
<div class="input-group">
<input type="text" class="form-control" placeholder="Type a message here...">
<div class="input-group-btn">
<button type="button" class="btn green">
<i class="icon-paper-clip"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane <API key>" id="quick_sidebar_tab_2">
<div class="<API key>">
<h3 class="list-heading">General</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 4 pending tasks.
<span class="label label-sm label-warning "> Take action
<i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> Just now </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Finance Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> New order received with
<span class="label label-sm label-success"> Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 30 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Web server hardware needs to be upgraded.
<span class="label label-sm label-warning"> Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 2 hours </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> IPO Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
</ul>
<h3 class="list-heading">System</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 4 pending tasks.
<span class="label label-sm label-warning "> Take action
<i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> Just now </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Finance Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> New order received with
<span class="label label-sm label-success"> Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 30 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-warning">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Web server hardware needs to be upgraded.
<span class="label label-sm label-default "> Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 2 hours </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> IPO Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
</ul>
</div>
</div>
<div class="tab-pane <API key>" id="quick_sidebar_tab_3">
<div class="<API key>">
<h3 class="list-heading">General Settings</h3>
<ul class="list-items borderless">
<li> Enable Notifications
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Allow Tracking
<input type="checkbox" class="make-switch" data-size="small" data-on-color="info" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Log Errors
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Auto Sumbit Issues
<input type="checkbox" class="make-switch" data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Enable SMS Alerts
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
</ul>
<h3 class="list-heading">System Settings</h3>
<ul class="list-items borderless">
<li> Security Level
<select class="form-control input-inline input-sm input-small">
<option value="1">Normal</option>
<option value="2" selected>Medium</option>
<option value="e">High</option>
</select>
</li>
<li> Failed Email Attempts
<input class="form-control input-inline input-sm input-small" value="5" /> </li>
<li> Secondary SMTP Port
<input class="form-control input-inline input-sm input-small" value="3560" /> </li>
<li> Notify On System Error
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Notify On SMTP Error
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
</ul>
<div class="inner-content">
<button class="btn btn-success">
<i class="icon-settings"></i> Save Changes</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner"> 2014 © Metronic by keenthemes.
<a href="http://themeforest.net/item/<API key>/4021469?ref=keenthemes" title="Purchase Metronic just for 27$ and get lifetime updates for free" target="_blank">Purchase Metronic!</a>
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
<!--[if lt IE 9]>
<script src="../assets/global/plugins/respond.min.js"></script>
<script src="../assets/global/plugins/excanvas.min.js"></script>
<![endif]
<!-- BEGIN CORE PLUGINS -->
<script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/<API key>/<API key>.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="../assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="../assets/layouts/layout/scripts/layout.min.js" type="text/javascript"></script>
<script src="../assets/layouts/layout/scripts/demo.min.js" type="text/javascript"></script>
<script src="../assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<!-- END THEME LAYOUT SCRIPTS -->
</body>
</html> |
/*csslint known-properties: false*/
/* csslint doesn't know about svg */
/*
* main dialog
*/
div.dialogWrapper {
display: block;
position: absolute;
height: calc(100% - 179px);
width: 100%;
top: 64px;
}
div.dialogOverlay {
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
button.mainDialogClose {
background-color: #ffffff;
}
.mainDialogClose:hover {
background-color: #d3d3d3;
}
.mainDialogClose, .warningDialogClose {
position: absolute;
top: 20px;
right: 30px;
line-height: 40px;
height: 40px;
width: 40px;
padding: 8px;
box-sizing: border-box;
}
.mainDialogClose > i, .warningDialogClose > i {
color: #b6b6b6;
}
div.mainDialog {
width: 850px;
max-height: inherit;
padding-top: 10px;
margin-top: 30px;
margin-left: calc((100% - 850px) / 2);
}
.topPanel {
display: flex;
}
/*
* graph
*/
.graph {
/* don't allow graph size to change */
flex: 0 0 auto;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.outline, .outlineHover {
fill: none;
stroke: gray !important;
}
.line, .lineHover {
fill: none;
}
path.line {
stroke-width: 2.0px;
}
path.outline {
stroke-width: 3.0px;
}
line.line {
stroke-width: 1.0px;
}
line.outline {
stroke-width: 2.0px;
}
.subgroup:hover text {
font-weight: bold;
}
path.lineHover {
stroke-width: 3.0px;
}
path.outlineHover {
stroke-width: 5.0px;
}
line.lineHover {
stroke-width: 2.0px;
}
line.outlineHover {
stroke-width: 3.0px;
}
/* XXX must match limit in models/km */
@for $i from 0 to 9 {
.groupHighlight$(i) .group$(i) path.line {
stroke-width: 3.0px;
}
.groupHighlight$(i) .group$(i) path.outline {
stroke-width: 5.0px;
}
.groupHighlight$(i) .group$(i) line.line {
stroke-width: 2.0px;
}
.groupHighlight$(i) .group$(i) line.outline {
stroke-width: 3.0px;
}
}
/*
* right panel
*/
.rightPanel {
width: 33%;
}
.rightPanel h4 {
color: black;
}
.definitions {
font-size: small;
margin-top: -10px;
}
.actions i {
margin-right: 20px;
cursor: pointer;
}
.actions a {
color: unset;
}
.pWarningIcon {
color: #8d0000;
float: left;
font-size: 18px;
}
.PValueArea {
height: 60px;
box-sizing: border-box;
position: relative;
display: block;
}
.PValueP {
width: 200px;
line-height: 60px;
height: 60px;
position: absolute;
left: 0;
top: 0;
}
.showPWarningButton {
margin-left: 10px;
margin-top: 20px;
min-width: 0;
}
.splits {
display: flex;
flex-wrap: wrap;
margin: 8px 0;
}
.splitLabel {
align-items: center;
display: flex;
flex-wrap: nowrap;
margin-left: 16px;
padding: 4px 0;
}
.splitHint {
margin-left: 8px;
}
.survType input {
background-color: #f5f5f5;
}
.infoIcon {
color: #757575;
}
/*
* warning dialog
*/
div.warningDialog {
width: 600px;
overflow: auto;
padding-top: 10px;
margin-left: calc((100% - 600px) / 2);
margin-top: 200px;
}
.warningContainer {
position: absolute;
left: 140px;
top: -10px;
}
/*
* at-risk table
*/
/* rows */
.atRisk > div {
/* use flex to position the legend to the right */
display: flex;
}
/* first column: at risk values. */
.atRisk > div > :nth-child(1) {
display: flex; /* Evenly space cells. */
flex-grow: 0; /* Width matches graph. Don't flex. */
flex-shrink: 0;
}
/* at-risk cells */
.atRisk > div > :nth-child(1) > span {
flex: 1;
text-align: center;
}
/* second column for legend */
.atRisk > div > :nth-child(2) {
font-size: small;
}
/*
* legend
*/
.legendLine {
display: inline-block;
height: 6px;
vertical-align: middle;
width: 25px;
margin-right: 2px;
border: 1px solid;
}
.listItem, .activeListItem {
position: relative;
padding: 0;
margin-bottom: 0;
margin-left: 25px;
text-indent: -27px;
border: none;
flex-grow: 1;
cursor: default;
}
/* XXX must match limit in models/km */
@for $i from 0 to 9 {
.groupHighlight$(i) .group$(i) {
color: #555;
background-color: #E1E1E1;
font-weight: bold;
}
.groupHighlight$(i) .group$(i) .legendLine {
border: 2px solid;
}
} |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory>
#include <string>
#include <chrono>
#include <thread>
#include "mldb/base/exc_check.h"
using namespace std;
void
DoOutput(FILE * in, FILE * out)
{
int len(0);
unique_ptr<char[]> buffer;
size_t n = ::fread(&len, sizeof(len), 1, in);
ExcCheckNotEqual(n, 0, "sizeof(len) must be 4");
buffer.reset(new char[len + 1]);
n = ::fread(buffer.get(), sizeof(char), len, in);
ExcCheckNotEqual(n, 0, "received 0 bytes");
buffer.get()[len] = 0;
// ::fprintf(stderr, "helper output: %s\n", buffer);
::fprintf(out, "%s\n", buffer.get());
}
void
DoSleep(FILE * in)
{
char delay_buf[5]; /* in .1 secs units */
delay_buf[4] = 0;
size_t r = ::fread(&delay_buf, 1, 4, in);
if (r != 4) {
throw MLDB::Exception("wrong delay: " + to_string(r));
}
long delay = ::strtol(delay_buf, NULL, 16);
std::this_thread::sleep_for(std::chrono::milliseconds(int(delay * 100)));
}
void
DoExit(FILE * in, bool quiet)
{
int code;
size_t n = ::fread(&code, sizeof(code), 1, in);
ExcCheckNotEqual(n, 0, "no exit code received");
if (!quiet) {
printf("helper: exit with code %d\n", code);
}
exit(code);
}
int main(int argc, char *argv[])
{
/** commands:
err/out|bytes8|nstring
xit|code(int)
abt
*/
bool quiet(false);
if (argc > 1) {
if (strcmp(argv[1], "--quiet") == 0) {
quiet = true;
}
}
if (!quiet) {
printf("helper: ready\n");
}
while (1) {
char command[3];
size_t n = ::fread(command, 1, sizeof(command), stdin);
if (n < 3) {
if (::feof(stdin)) {
break;
}
}
if (n == 0) {
continue;
}
if (::strncmp(command, "err", 3) == 0) {
DoOutput(stdin, stderr);
}
else if (::strncmp(command, "out", 3) == 0) {
DoOutput(stdin, stdout);
}
else if (::strncmp(command, "slp", 3) == 0) {
DoSleep(stdin);
}
else if (::strncmp(command, "xit", 3) == 0) {
DoExit(stdin, quiet);
}
else if (::strncmp(command, "abt", 3) == 0) {
::abort();
}
}
return 0;
} |
package com.cc.library.service;
import java.util.List;
import com.cc.library.domain.Admin;
import com.cc.library.domain.PageBean;
public interface AdminService {
/**
*
* @param admin
* @return
*/
public Admin getAdminByUserName(Admin admin);
/**
*
* @param admin
* @return
*/
public Admin updateAdminInfo(Admin admin);
public List<Admin> getAllAdmins();
/**
*
* @param admin
* @return
*/
public boolean addAdmin(Admin admin);
/**
* id
* @param admin
* @return
*/
public Admin getAdminById(Admin admin);
/**
*
* @param pageCode
* @param pageSize
* @return
*/
public PageBean<Admin> findAdminByPage(int pageCode, int pageSize);
/**
*
* @param admin
*/
public PageBean<Admin> queryAdmin(Admin admin,int pageCode,int pageSize);
/**
* id
* @param id
*/
public boolean deleteAdmin(Admin admin);
} |
package ca.farrelltonsolar.j2modlite.msg;
import ca.farrelltonsolar.j2modlite.Modbus;
/**
* Abstract class implementing a <tt>ModbusRequest</tt>. This class provides
* specialised implementations with the functionality they have in common.
*
* @author Dieter Wimberger
* @version 1.2rc1 (09/11/2004)
*
* @author jfhaugh (jfh@ghgande.com)
* @version 1.2rc1-ghpc (09/27/2010) Added READ_MEI stuff.
*
* @version 1.2rc1-ghpc (02/14/2011) Added REPORT_SLAVE_ID stuff.
*
* @version 1.0-jamod (7/7/2012)
* Added new messages.
*/
public abstract class ModbusRequest extends ModbusMessageImpl {
/**
* Returns the <tt>ModbusResponse</tt> that correlates with this
* <tt>ModbusRequest</tt>.
*
* <p>
* The response must include the unit number, function code, as well as any
* transport-specific header information.
*
* <p>
* This method is used to create an empty response which must be populated
* by the caller. It is commonly used to un-marshal responses from Modbus
* slaves.
*
* @return the corresponding <tt>ModbusResponse</tt>.
*/
public abstract ModbusResponse getResponse();
/**
* Returns the <tt>ModbusResponse</tt> that represents the answer to this
* <tt>ModbusRequest</tt>.
*
* <p>
* The implementation should take care about assembling the reply to this
* <tt>ModbusRequest</tt>.
*
* <p>
* This method is used to create responses from the process image associated
* with the ModbusCoupler. It is commonly used to implement Modbus slave
* instances.
*
* @return the corresponding <tt>ModbusResponse</tt>.
*/
public abstract ModbusResponse createResponse();
/**
* Factory method for creating exception responses with the given exception
* code.
*
* @param code
* the code of the exception.
* @return a ModbusResponse instance representing the exception response.
*/
public ModbusResponse <API key>(int code) {
ExceptionResponse response = new ExceptionResponse(getFunctionCode(),
code);
if (!isHeadless()) {
response.setTransactionID(getTransactionID());
response.setProtocolID(getProtocolID());
} else {
response.setHeadless();
}
return response;
}
/**
* Factory method creating the required specialized <tt>ModbusRequest</tt>
* instance.
*
* @param functionCode
* the function code of the request as <tt>int</tt>.
* @return a ModbusRequest instance specific for the given function type.
*/
public static ModbusRequest createModbusRequest(int functionCode) {
ModbusRequest request = null;
switch (functionCode) {
case Modbus.<API key>:
request = new <API key>();
break;
case Modbus.<API key>:
request = new <API key>();
break;
case Modbus.<API key>:
request = new <API key>();
break;
case Modbus.<API key>:
request = new <API key>();
break;
case Modbus.READ_COMM_EVENT_LOG:
request = new <API key>();
break;
case Modbus.REPORT_SLAVE_ID:
request = new <API key>();
break;
case Modbus.READ_FILE_RECORD:
request = new <API key>();
break;
case Modbus.READ_FIFO_QUEUE:
request = new <API key>();
break;
case Modbus.READ_MEI:
request = new ReadMEIRequest();
break;
default:
request = new <API key>(functionCode);
break;
}
return request;
}
} |
import {
AsyncTestCompleter,
beforeEach,
beforeEachBindings,
ddescribe,
describe,
expect,
iit,
inject,
it,
xdescribe,
<API key>,
xit,
} from 'angular2/test_lib';
import {bootstrap} from 'angular2/src/core/application';
import {Component, Directive, View} from 'angular2/src/core/annotations/decorators';
import {DOM} from 'angular2/src/dom/dom_adapter';
import {bind} from 'angular2/di';
import {DOCUMENT_TOKEN} from 'angular2/src/render/dom/dom_renderer';
import {RouteConfig, Route, Redirect} from 'angular2/src/router/<API key>';
import {PromiseWrapper} from 'angular2/src/facade/async';
import {BaseException} from 'angular2/src/facade/lang';
import {routerInjectables, Router, appBaseHrefToken, routerDirectives} from 'angular2/router';
import {LocationStrategy} from 'angular2/src/router/location_strategy';
import {<API key>} from 'angular2/src/mock/<API key>';
import {<API key>} from 'angular2/src/core/application_tokens';
export function main() {
describe('router injectables', () => {
beforeEachBindings(() => {
return [routerInjectables, bind(LocationStrategy).toClass(<API key>)];
});
// do not refactor out the `bootstrap` functionality. We still want to
// keep this test around so we can ensure that bootstrapping a router works
describe('boostrap functionality', () => {
it('should bootstrap a simple app', inject([AsyncTestCompleter], (async) => {
var fakeDoc = DOM.createHtmlDocument();
var el = DOM.createElement('app-cmp', fakeDoc);
DOM.appendChild(fakeDoc.body, el);
bootstrap(AppCmp,
[
routerInjectables,
bind(LocationStrategy).toClass(<API key>),
bind(DOCUMENT_TOKEN).toValue(fakeDoc)
])
.then((applicationRef) => {
var router = applicationRef.hostComponent.router;
router.subscribe((_) => {
expect(el).toHaveText('outer { hello }');
expect(applicationRef.hostComponent.location.path()).toEqual('');
async.done();
});
});
}));
});
describe('broken app', () => {
beforeEachBindings(() => { return [bind(<API key>).toValue(BrokenAppCmp)]; });
it('should rethrow exceptions from component constructors',
inject([AsyncTestCompleter, <API key>], (async, tcb: <API key>) => {
tcb.createAsync(AppCmp).then((rootTC) => {
var router = rootTC.componentInstance.router;
PromiseWrapper.catchError(router.navigate('/cause-error'), (error) => {
expect(rootTC.nativeElement).toHaveText('outer { oh no }');
expect(error.message).toContain('oops!');
async.done();
});
});
}));
});
describe('hierarchical app', () => {
beforeEachBindings(() => { return [bind(<API key>).toValue(HierarchyAppCmp)]; });
it('should bootstrap an app with a hierarchy',
inject([AsyncTestCompleter, <API key>], (async, tcb: <API key>) => {
tcb.createAsync(HierarchyAppCmp)
.then((rootTC) => {
var router = rootTC.componentInstance.router;
router.subscribe((_) => {
expect(rootTC.nativeElement).toHaveText('root { parent { hello } }');
expect(rootTC.componentInstance.location.path()).toEqual('/parent/child');
async.done();
});
router.navigate('/parent/child');
});
}));
describe('custom app base ref', () => {
beforeEachBindings(() => { return [bind(appBaseHrefToken).toValue('/my/app')]; });
it('should bootstrap', inject([AsyncTestCompleter, <API key>],
(async, tcb: <API key>) => {
tcb.createAsync(HierarchyAppCmp)
.then((rootTC) => {
var router = rootTC.componentInstance.router;
router.subscribe((_) => {
expect(rootTC.nativeElement)
.toHaveText('root { parent { hello } }');
expect(rootTC.componentInstance.location.path())
.toEqual('/my/app/parent/child');
async.done();
});
router.navigate('/parent/child');
});
}));
});
});
// TODO: add a test in which the child component has bindings
});
}
@Component({selector: 'hello-cmp'})
@View({template: 'hello'})
class HelloCmp {
}
@Component({selector: 'app-cmp'})
@View({template: "outer { <router-outlet></router-outlet> }", directives: routerDirectives})
@RouteConfig([new Route({path: '/', component: HelloCmp})])
class AppCmp {
constructor(public router: Router, public location: LocationStrategy) {}
}
@Component({selector: 'parent-cmp'})
@View({template: `parent { <router-outlet></router-outlet> }`, directives: routerDirectives})
@RouteConfig([new Route({path: '/child', component: HelloCmp})])
class ParentCmp {
}
@Component({selector: 'app-cmp'})
@View({template: `root { <router-outlet></router-outlet> }`, directives: routerDirectives})
@RouteConfig([new Route({path: '/parent/...', component: ParentCmp})])
class HierarchyAppCmp {
constructor(public router: Router, public location: LocationStrategy) {}
}
@Component({selector: 'oops-cmp'})
@View({template: "oh no"})
class BrokenCmp {
constructor() { throw new BaseException('oops!'); }
}
@Component({selector: 'app-cmp'})
@View({template: `outer { <router-outlet></router-outlet> }`, directives: routerDirectives})
@RouteConfig([new Route({path: '/cause-error', component: BrokenCmp})])
class BrokenAppCmp {
constructor(public router: Router, public location: LocationStrategy) {}
} |
layout: base
title: 'Statistics of PunctSide in UD_Icelandic-PUD'
udver: '2'
## Treebank Statistics: UD_Icelandic-PUD: Features: `PunctSide`
This feature is language-specific.
It occurs with 2 different values: `Fin`, `Ini`.
236 tokens (1%) have a non-empty value of `PunctSide`.
3 types (0%) occur at least once with a non-empty value of `PunctSide`.
3 lemmas (0%) occur at least once with a non-empty value of `PunctSide`.
The feature is used with 1 part-of-speech tags: <tt><a href="is_pud-pos-PUNCT.html">PUNCT</a></tt> (236; 1% instances).
`PUNCT`
236 <tt><a href="is_pud-pos-PUNCT.html">PUNCT</a></tt> tokens (12% of all `PUNCT` tokens) have a non-empty value of `PunctSide`.
`PUNCT` tokens may have the following values of `PunctSide`:
* `Fin` (119; 50% of non-empty `PunctSide`): <em>“, .</em>
* `Ini` (117; 50% of non-empty `PunctSide`): <em>„</em> |
// <auto-generated>
// </auto-generated>
namespace api_rest_sgmw
{
using System;
using System.Collections.Generic;
public partial class EQUIPOS_INSTALADOS
{
public int EQUIPO_INSTALADO_ID { get; set; }
public int UBICACION_ID { get; set; }
public int MAQUINA_ID { get; set; }
public string <API key> { get; set; }
public int USER_ID { get; set; }
public Nullable<System.DateTime> CREATED { get; set; }
public Nullable<System.DateTime> MODIFIED { get; set; }
public Nullable<bool> DELETED { get; set; }
public virtual UBICACIONES UBICACIONES { get; set; }
public virtual MAQUINAS MAQUINAS { get; set; }
}
} |
// note that months are zero-based in the JavaScript Date object, so month 3 is April
var items = new vis.DataSet([]);
var min = new Date(2015, 10, 1); // 1 april
var max = new Date(2015, 11, 30); // 30 april
var container = document.getElementById('visualization');
var options = {
editable : true,
onAdd : function(item, callback) {
swal({
title : "What do you want to add?",
text : "Add Income or Expense",
type : "warning",
showCancelButton : true,
confirmButtonColor : "#DD6B55",
confirmButtonText : "Expense",
cancelButtonText : "Income",
}, function(isConfirm) {
if (isConfirm) {
$('#feedExpensesModal').modal('show');
$('#feedExpensesModal').find('.time').val(item.start);
} else {
$('#feedAssetsModal').modal('show');
$('#feedAssetsModal').find('.time').val(item.start);
}
});
},
onMove : function(item, callback) {
var title = 'Do you really want to move the item to\n' + 'start: '
+ item.start + '\n' + 'end: ' + item.end + '?';
prettyConfirm('Move item', title, function(ok) {
if (ok) {
callback(item); // send back item as confirmation (can be
// changed)
var data = {id : item.id, start : item.start};
var posting = $.post("./rs/feed/moveTimelineItem", data);
posting.done(function(msg) {
if(msg == 'success') {
displayAlert('Your Timeline change is saved to your records');
}
});
} else {
callback(null); // cancel editing item
}
});
},
onMoving : function(item, callback) {
// if (item.start < min)
// item.start = min;
// if (item.start > max)
// item.start = max;
// if (item.end > max)
// item.end = max;
callback(item); // send back the (possibly) changed item
},
onUpdate : function(item, callback) {
var data = {id : item.id};
$.getJSON('./rs/feed/getMoneyDataById', data , function(result) {
amount = result;
prettyPrompt('Update item', 'Enter new amount:', amount, function(
value) {
if (value) {
callback(item); // send back adjusted item
var data = {id : item.id, amount : value};
var posting = $.post("./rs/feed/updateTimelineItem", data);
posting.done(function(msg) {
if(msg == 'success') {
displayAlert('Your Timeline change is saved to your records');
}
});
} else {
callback(null); // cancel updating the item
}
});
}).done(function() {
}).fail(function() {
}).always(function() {
});
},
onRemove : function(item, callback) {
prettyConfirm('Remove item', 'Do you really want to remove item '
+ item.content + '?', function(ok) {
if (ok) {
callback(item); // confirm deletion
var data = {id : item.id};
var posting = $.post("./rs/feed/deleteTimelineItem", data);
posting.done(function(msg) {
if(msg == 'success') {
displayAlert('Your Timeline item has been removed from your records');
}
});
} else {
callback(null); // cancel deletion
}
});
}
};
var timeline = new vis.Timeline(container, items, options);
items.on('*', function(event, properties) {
logEvent(event, properties);
});
function logEvent(event, properties) {
var log = document.getElementById('log');
var msg = document.createElement('div');
msg.innerHTML = 'event=' + JSON.stringify(event) + ', ' + 'properties='
+ JSON.stringify(properties);
log.firstChild ? log.insertBefore(msg, log.firstChild) : log
.appendChild(msg);
}
function prettyConfirm(title, text, callback) {
swal({
title : title,
text : text,
type : 'warning',
showCancelButton : true,
confirmButtonColor : "#DD6B55"
}, callback);
}
function prettyPrompt(title, text, inputValue, callback) {
swal({
title : title,
text : text,
type : 'input',
showCancelButton : true,
inputValue : inputValue,
}, callback);
} |
using Cirrious.MvvmCross.WindowsStore.Views;
using Paragon.Container.Core.ViewModels;
using Windows.UI.Xaml;
namespace Paragon.Container.Views
{
public sealed partial class DictionaryView : ViewBase
{
public DictionaryView()
{
this.InitializeComponent();
this.KeyDown += <API key>;
}
public new DictionaryViewModel ViewModel
{
get { return (DictionaryViewModel)base.ViewModel; }
}
private void <API key>(object sender, RoutedEventArgs e)
{
double listHeight = SearchResultsLists.ActualHeight - <API key>;
ItemsController.SetListHeight(listHeight);
}
private void HistoryView_Loaded(object sender, RoutedEventArgs e)
{
double listHeight = HistoryView.ActualHeight - <API key>;
ItemsController.<API key>(listHeight);
ViewModel.History.UpdateTopItems();
}
private void <API key>(object sender, RoutedEventArgs e)
{
double listHeight = FavoritesView.ActualHeight - <API key>;
ItemsController.<API key>(listHeight);
ViewModel.Favorites.UpdateTopItems();
}
private void <API key>(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Tab)
{
SearchBox.Focus(FocusState.Keyboard);
e.Handled = true;
}
}
private void <API key>(object sender, RoutedEventArgs e)
{
SearchBox.Select(SearchBox.Text.Length, 0);
}
private const double <API key> = 25;
private const double <API key> = 50;
}
} |
package com.camunda.consulting.openapi.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.camunda.consulting.openapi.client.model.VariableValueDto;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* TaskEscalationDto
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-07-14T01:59:23.608853+02:00[Europe/Berlin]")
public class TaskEscalationDto {
public static final String <API key> = "escalationCode";
@SerializedName(<API key>)
private String escalationCode;
public static final String <API key> = "variables";
@SerializedName(<API key>)
private Map<String, VariableValueDto> variables = null;
public TaskEscalationDto escalationCode(String escalationCode) {
this.escalationCode = escalationCode;
return this;
}
/**
* An escalation code that indicates the predefined escalation. It is used to identify the BPMN escalation handler.
* @return escalationCode
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "An escalation code that indicates the predefined escalation. It is used to identify the BPMN escalation handler.")
public String getEscalationCode() {
return escalationCode;
}
public void setEscalationCode(String escalationCode) {
this.escalationCode = escalationCode;
}
public TaskEscalationDto variables(Map<String, VariableValueDto> variables) {
this.variables = variables;
return this;
}
public TaskEscalationDto putVariablesItem(String key, VariableValueDto variablesItem) {
if (this.variables == null) {
this.variables = new HashMap<String, VariableValueDto>();
}
this.variables.put(key, variablesItem);
return this;
}
/**
* A JSON object containing variable key-value pairs.
* @return variables
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "A JSON object containing variable key-value pairs.")
public Map<String, VariableValueDto> getVariables() {
return variables;
}
public void setVariables(Map<String, VariableValueDto> variables) {
this.variables = variables;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TaskEscalationDto taskEscalationDto = (TaskEscalationDto) o;
return Objects.equals(this.escalationCode, taskEscalationDto.escalationCode) &&
Objects.equals(this.variables, taskEscalationDto.variables);
}
@Override
public int hashCode() {
return Objects.hash(escalationCode, variables);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TaskEscalationDto {\n");
sb.append(" escalationCode: ").append(toIndentedString(escalationCode)).append("\n");
sb.append(" variables: ").append(toIndentedString(variables)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
} |
package displayers
import (
"io"
"strings"
"github.com/digitalocean/doctl/do"
"github.com/digitalocean/godo"
)
type KubernetesClusters struct {
KubernetesClusters do.KubernetesClusters
Short bool
}
var _ Displayable = &KubernetesClusters{}
func (clusters *KubernetesClusters) JSON(out io.Writer) error {
return writeJSON(clusters.KubernetesClusters, out)
}
func (clusters *KubernetesClusters) Cols() []string {
if clusters.Short {
return []string{
"ID",
"Name",
"Region",
"Version",
"AutoUpgrade",
"Status",
"NodePools",
}
}
return []string{
"ID",
"Name",
"Region",
"Version",
"AutoUpgrade",
"HAControlPlane",
"Status",
"Endpoint",
"IPv4",
"ClusterSubnet",
"ServiceSubnet",
"Tags",
"Created",
"Updated",
"NodePools",
}
}
func (clusters *KubernetesClusters) ColMap() map[string]string {
if clusters.Short {
return map[string]string{
"ID": "ID",
"Name": "Name",
"Region": "Region",
"Version": "Version",
"AutoUpgrade": "Auto Upgrade",
"Status": "Status",
"NodePools": "Node Pools",
}
}
return map[string]string{
"ID": "ID",
"Name": "Name",
"Region": "Region",
"Version": "Version",
"AutoUpgrade": "Auto Upgrade",
"HAControlPlane": "HA Control Plane",
"ClusterSubnet": "Cluster Subnet",
"ServiceSubnet": "Service Subnet",
"IPv4": "IPv4",
"Endpoint": "Endpoint",
"Tags": "Tags",
"Status": "Status",
"Created": "Created At",
"Updated": "Updated At",
"NodePools": "Node Pools",
}
}
func (clusters *KubernetesClusters) KV() []map[string]interface{} {
out := make([]map[string]interface{}, 0, len(clusters.KubernetesClusters))
for _, cluster := range clusters.KubernetesClusters {
tags := strings.Join(cluster.Tags, ",")
nodePools := make([]string, 0, len(cluster.NodePools))
for _, pool := range cluster.NodePools {
nodePools = append(nodePools, pool.Name)
}
if cluster.Status == nil {
cluster.Status = new(godo.<API key>)
}
o := map[string]interface{}{
"ID": cluster.ID,
"Name": cluster.Name,
"Region": cluster.RegionSlug,
"Version": cluster.VersionSlug,
"AutoUpgrade": cluster.AutoUpgrade,
"HAControlPlane": cluster.HA,
"ClusterSubnet": cluster.ClusterSubnet,
"ServiceSubnet": cluster.ServiceSubnet,
"IPv4": cluster.IPv4,
"Endpoint": cluster.Endpoint,
"Tags": tags,
"Status": cluster.Status.State,
"Created": cluster.CreatedAt,
"Updated": cluster.UpdatedAt,
"NodePools": strings.Join(nodePools, " "),
}
out = append(out, o)
}
return out
}
type KubernetesNodePools struct {
KubernetesNodePools do.KubernetesNodePools
}
var _ Displayable = &KubernetesNodePools{}
func (nodePools *KubernetesNodePools) JSON(out io.Writer) error {
return writeJSON(nodePools.KubernetesNodePools, out)
}
func (nodePools *KubernetesNodePools) Cols() []string {
return []string{
"ID",
"Name",
"Size",
"Count",
"Tags",
"Labels",
"Taints",
"Nodes",
}
}
func (nodePools *KubernetesNodePools) ColMap() map[string]string {
return map[string]string{
"ID": "ID",
"Name": "Name",
"Size": "Size",
"Count": "Count",
"Tags": "Tags",
"Labels": "Labels",
"Taints": "Taints",
"Nodes": "Nodes",
}
}
func (nodePools *KubernetesNodePools) KV() []map[string]interface{} {
out := make([]map[string]interface{}, 0, len(nodePools.KubernetesNodePools))
for _, nodePools := range nodePools.KubernetesNodePools {
tags := strings.Join(nodePools.Tags, ",")
nodes := make([]string, 0, len(nodePools.Nodes))
for _, node := range nodePools.Nodes {
nodes = append(nodes, node.Name)
}
o := map[string]interface{}{
"ID": nodePools.ID,
"Name": nodePools.Name,
"Size": nodePools.Size,
"Count": nodePools.Count,
"Tags": tags,
"Labels": nodePools.Labels,
"Taints": nodePools.Taints,
"Nodes": nodes,
}
out = append(out, o)
}
return out
}
type KubernetesVersions struct {
KubernetesVersions do.KubernetesVersions
}
var _ Displayable = &KubernetesVersions{}
func (versions *KubernetesVersions) JSON(out io.Writer) error {
return writeJSON(versions.KubernetesVersions, out)
}
func (versions *KubernetesVersions) Cols() []string {
return []string{
"Slug",
"KubernetesVersion",
"SupportedFeatures",
}
}
func (versions *KubernetesVersions) ColMap() map[string]string {
return map[string]string{
"Slug": "Slug",
"KubernetesVersion": "Kubernetes Version",
"SupportedFeatures": "Supported Features",
}
}
func (versions *KubernetesVersions) KV() []map[string]interface{} {
out := make([]map[string]interface{}, 0, len(versions.KubernetesVersions))
for _, version := range versions.KubernetesVersions {
o := map[string]interface{}{
"Slug": version.KubernetesVersion.Slug,
"KubernetesVersion": version.KubernetesVersion.KubernetesVersion,
"SupportedFeatures": strings.Join(version.KubernetesVersion.SupportedFeatures, ", "),
}
out = append(out, o)
}
return out
}
type KubernetesRegions struct {
KubernetesRegions do.KubernetesRegions
}
var _ Displayable = &KubernetesRegions{}
func (regions *KubernetesRegions) JSON(out io.Writer) error {
return writeJSON(regions.KubernetesRegions, out)
}
func (regions *KubernetesRegions) Cols() []string {
return []string{
"Slug",
"Name",
}
}
func (regions *KubernetesRegions) ColMap() map[string]string {
return map[string]string{
"Slug": "Slug",
"Name": "Name",
}
}
func (regions *KubernetesRegions) KV() []map[string]interface{} {
out := make([]map[string]interface{}, 0, len(regions.KubernetesRegions))
for _, region := range regions.KubernetesRegions {
o := map[string]interface{}{
"Slug": region.KubernetesRegion.Slug,
"Name": region.KubernetesRegion.Name,
}
out = append(out, o)
}
return out
}
type KubernetesNodeSizes struct {
KubernetesNodeSizes do.KubernetesNodeSizes
}
var _ Displayable = &KubernetesNodeSizes{}
func (nodeSizes *KubernetesNodeSizes) JSON(out io.Writer) error {
return writeJSON(nodeSizes.KubernetesNodeSizes, out)
}
func (nodeSizes *KubernetesNodeSizes) Cols() []string {
return []string{
"Slug",
"Name",
}
}
func (nodeSizes *KubernetesNodeSizes) ColMap() map[string]string {
return map[string]string{
"Slug": "Slug",
"Name": "Name",
}
}
func (nodeSizes *KubernetesNodeSizes) KV() []map[string]interface{} {
out := make([]map[string]interface{}, 0, len(nodeSizes.KubernetesNodeSizes))
for _, size := range nodeSizes.KubernetesNodeSizes {
o := map[string]interface{}{
"Slug": size.KubernetesNodeSize.Slug,
"Name": size.KubernetesNodeSize.Name,
}
out = append(out, o)
}
return out
}
type <API key> struct {
<API key> *do.<API key>
}
var _ Displayable = &<API key>{}
func (ar *<API key>) JSON(out io.Writer) error {
return writeJSON(ar.<API key>, out)
}
func (ar *<API key>) Cols() []string {
return []string{
"Volumes",
"VolumeSnapshots",
"LoadBalancers",
}
}
func (ar *<API key>) ColMap() map[string]string {
return map[string]string{
"Volumes": "Volumes",
"VolumeSnapshots": "Volume Snapshots",
"LoadBalancers": "Load Balancers",
}
}
func (ar *<API key>) KV() []map[string]interface{} {
o := map[string]interface{}{
"Volumes": <API key>(ar.<API key>.Volumes),
"VolumeSnapshots": <API key>(ar.<API key>.VolumeSnapshots),
"LoadBalancers": <API key>(ar.<API key>.LoadBalancers),
}
return []map[string]interface{}{o}
}
func <API key>(resources []*godo.AssociatedResource) (out []string) {
for _, r := range resources {
out = append(out, r.ID)
}
return out
} |
#!/bin/bash
echo "running <API key>.sh...";
currentOutDir=$1;
outputTexFileName="output.tex"
cd "$currentOutDir"
touch $outputTexFileName
insertTexPreambule(){
printf "\usepackage{longtable}" >> "$outputTexFileName";
printf '\\documentclass{article}\n' >> "$outputTexFileName";
printf '\\usepackage[portuguese]{babel}\n' >> "$outputTexFileName";
printf '\\usepackage[T1]{fontenc}\n' >> "$outputTexFileName";
printf '\\usepackage{lmodern}\n' >> "$outputTexFileName";
printf '\\begin{document}' >> "$outputTexFileName"
printf '\n' >> "$outputTexFileName"
}
<API key>(){
#to understand this find command
#use just xtable produced file
#and -not Temp files tha was produced by <API key>.sh script
find "$currentOutDir" -type f \( -name "*.tex" -and -not -iname "Temp*" \) -print0 | xargs -0 -I texFileFinded cat texFileFinded >> $outputTexFileName
}
<API key>(){
echo "\end{document}" >> "$outputTexFileName";
}
<API key>(){
echo "<API key>(){..."
#pandoc -s $outputTexFileName -o ouput.odt
#pandoc $outputTexFileName -o ouputOpenOffice.odt
htlatex $outputTexFileName
#latex2rtf $outputTexFileName
#latex2html $outputTexFileName -split 0 -no_navigation -info "" -address "" -html_version 4.0,unicode
#latex2html $outputTexFileName -split 0 -no_navigation -info "" -address ""
libreoffice --headless --convert-to odt:"OpenDocument Text Flat XML" output.html
}
insertTexPreambule
<API key>
<API key>
<API key> |
package Export;
import conexao.Call;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.function.Consumer;
/**
*
* @author ahmedjorge
*/
public class DataReseguro {
public static class DataResseguro {
private String ID;
private String IDCONTRATO;
private String IDTIPORESEGURO;
private String IDSEGURO;
private String CLIENTE;
private String APOLICE;
private String MOEDA;
private String DTINICO;
private String DTFIM;
private String INICIO;
private String FIM;
private String DMOEDA;
private String LIMITE;
private String PREMIOGROSSO;
private String TOTAL;
private String ESTADO;
private String TIPOCOBERTURA;
private String DEDUCAO;
private String DESCRICAO;
private final String ID_ = "ID";
private final String IDCONTRATO_ = "ID CONTRATO";
private final String IDTIPORESEGURO_ = "ID TIPO RESEGURO";
private final String IDSEGURO_ = "SEGURO ID";
private final String CLIENTE_ = "CLIENTE";
private final String APOLICE_ = "APOLICE";
private final String MOEDA_ = "MOEDA";
private final String DTINICO_ = "DT INICO";
private final String DTFIM_ = "DT FIM";
private final String INICIO_ = "INICIO";
private final String FIM_ = "FIM";
private final String DMOEDA_ = "ID MOEDA";
private final String LIMITE_ = "LIMITE";
private final String PREMIOGROSSO_ = "PREMIO GROSSO";
private final String TOTAL_ = "TOTAL";
private final String ESTADO_ = "ESTADO";
private final String TIPOCOBERTURA_ = "TIPO COBERTURA";
private final String DEDUCAO_ = "DEDUCAO";
private final String DESCRICAO_ = "DESCRICAO";
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getIDCONTRATO() {
return IDCONTRATO;
}
public void setIDCONTRATO(String IDCONTRATO) {
this.IDCONTRATO = IDCONTRATO;
}
public String getIDTIPORESEGURO() {
return IDTIPORESEGURO;
}
public void setIDTIPORESEGURO(String IDTIPORESEGURO) {
this.IDTIPORESEGURO = IDTIPORESEGURO;
}
public String getIDSEGURO() {
return IDSEGURO;
}
public void setIDSEGURO(String IDSEGURO) {
this.IDSEGURO = IDSEGURO;
}
public String getCLIENTE() {
return CLIENTE;
}
public void setCLIENTE(String CLIENTE) {
this.CLIENTE = CLIENTE;
}
public String getAPOLICE() {
return APOLICE;
}
public void setAPOLICE(String APOLICE) {
this.APOLICE = APOLICE;
}
public String getMOEDA() {
return MOEDA;
}
public void setMOEDA(String MOEDA) {
this.MOEDA = MOEDA;
}
public String getDTINICO() {
return DTINICO;
}
public void setDTINICO(String DTINICO) {
this.DTINICO = DTINICO;
}
public String getDTFIM() {
return DTFIM;
}
public void setDTFIM(String DTFIM) {
this.DTFIM = DTFIM;
}
public String getINICIO() {
return INICIO;
}
public void setINICIO(String INICIO) {
this.INICIO = INICIO;
}
public String getFIM() {
return FIM;
}
public void setFIM(String FIM) {
this.FIM = FIM;
}
public String getDMOEDA() {
return DMOEDA;
}
public void setDMOEDA(String DMOEDA) {
this.DMOEDA = DMOEDA;
}
public String getLIMITE() {
return LIMITE;
}
public void setLIMITE(String LIMITE) {
this.LIMITE = LIMITE;
}
public String getPREMIOGROSSO() {
return PREMIOGROSSO;
}
public void setPREMIOGROSSO(String PREMIOGROSSO) {
this.PREMIOGROSSO = PREMIOGROSSO;
}
public String getTOTAL() {
return TOTAL;
}
public void setTOTAL(String TOTAL) {
this.TOTAL = TOTAL;
}
public String getESTADO() {
return ESTADO;
}
public void setESTADO(String ESTADO) {
this.ESTADO = ESTADO;
}
public String getTIPOCOBERTURA() {
return TIPOCOBERTURA;
}
public void setTIPOCOBERTURA(String TIPOCOBERTURA) {
this.TIPOCOBERTURA = TIPOCOBERTURA;
}
public String getDEDUCAO() {
return DEDUCAO;
}
public void setDEDUCAO(String DEDUCAO) {
this.DEDUCAO = DEDUCAO;
}
public String getDESCRICAO() {
return DESCRICAO;
}
public void setDESCRICAO(String DESCRICAO) {
this.DESCRICAO = DESCRICAO;
}
}
public static class DataEmpresa {
private String ID;
private String IDRESEGURO;
private String DEMPPRESA;
private String PERCENTAGEM;
private String RISCO;
private String STATE;
private String EMPRESA;
private String CAPITAL;
private String ENDERECO;
private final String ID_ = "ID";
private final String IDRESEGURO_ = "ID RESEGURO";
private final String IDEMPPRESA_ = "ID EMPPRESA";
private final String PERCENTAGEM_ = "PERCENTAGEM";
private final String RISCO_ = "RISCO";
private final String STATE_ = "STATE";
private final String EMPRESA_ = "EMPRESA";
private final String CAPITAL_ = "CAPITAL";
private final String ENDERECO_ = "ENDERECO";
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getDRESEGURO() {
return IDRESEGURO;
}
public void setDRESEGURO(String DRESEGURO) {
this.IDRESEGURO = DRESEGURO;
}
public String getDEMPPRESA() {
return DEMPPRESA;
}
public void setDEMPPRESA(String DEMPPRESA) {
this.DEMPPRESA = DEMPPRESA;
}
public String getPERCENTAGEM() {
return PERCENTAGEM;
}
public void setPERCENTAGEM(String PERCENTAGEM) {
this.PERCENTAGEM = PERCENTAGEM;
}
public String getRISCO() {
return RISCO;
}
public void setRISCO(String RISCO) {
this.RISCO = RISCO;
}
public String getSTATE() {
return STATE;
}
public void setSTATE(String STATE) {
this.STATE = STATE;
}
public String getEMPRESA() {
return EMPRESA;
}
public void setEMPRESA(String EMPRESA) {
this.EMPRESA = EMPRESA;
}
public String getCAPITAL() {
return CAPITAL;
}
public void setCAPITAL(String CAPITAL) {
this.CAPITAL = CAPITAL;
}
public String getENDERECO() {
return ENDERECO;
}
public void setENDERECO(String ENDERECO) {
this.ENDERECO = ENDERECO;
}
}
public static ArrayList<DataEmpresa> getDadosEmpresa(int idRESEGURO) {
ArrayList<DataEmpresa> listDataEmpresas = new ArrayList<>();
ResultSet rs = Call.selectFrom("VER_RESEGUROEMPRESA where \"ID RESEGURO\" = ?", "*", idRESEGURO);
Consumer<HashMap<String, Object>> act = (map) -> {
DataEmpresa dEm = new DataEmpresa();
dEm.ID = toString(map.get(dEm.ID_));
dEm.CAPITAL = toString(map.get(dEm.CAPITAL_));
dEm.DEMPPRESA = toString(map.get(dEm.IDEMPPRESA_));
dEm.EMPRESA = toString(map.get(dEm.EMPRESA_));
dEm.IDRESEGURO = toString(map.get(dEm.IDRESEGURO_));
dEm.PERCENTAGEM = toString(map.get(dEm.PERCENTAGEM_));
dEm.RISCO = toString(map.get(dEm.RISCO_));
dEm.STATE = toString(map.get(dEm.STATE_));
dEm.ENDERECO = toString(map.get(dEm.ENDERECO_));
listDataEmpresas.add(dEm);
};
Call.forEchaResultSet(act, rs);
return listDataEmpresas;
}
public static DataResseguro getDadosReseguro(int idRegistro) {
DataResseguro dRe = new DataResseguro();
ResultSet rs = Call.selectFrom("VER_RESEGUROS where \"ID\" = ?", "*", idRegistro);
Consumer<HashMap<String, Object>> act = (map) -> {
dRe.ID = toString(map.get(dRe.ID_));
dRe.APOLICE = toString(map.get(dRe.APOLICE_));
dRe.CLIENTE = toString(map.get(dRe.CLIENTE_));
dRe.DEDUCAO = toString(map.get(dRe.DEDUCAO_));
dRe.DESCRICAO = toString(map.get(dRe.DESCRICAO_));
dRe.DMOEDA = toString(map.get(dRe.DMOEDA_));
dRe.DTFIM = toString(map.get(dRe.DTFIM_));
dRe.DTINICO = toString(map.get(dRe.DTINICO_));
dRe.ESTADO = toString(map.get(dRe.ESTADO_));
dRe.FIM = toString(map.get(dRe.FIM_));
dRe.IDCONTRATO = toString(map.get(dRe.IDCONTRATO_));
dRe.IDSEGURO = toString(map.get(dRe.IDSEGURO_));
dRe.IDTIPORESEGURO = toString(map.get(dRe.IDTIPORESEGURO_));
dRe.INICIO = toString(map.get(dRe.INICIO_));
dRe.LIMITE = toString(map.get(dRe.LIMITE_));
dRe.MOEDA = toString(map.get(dRe.MOEDA_));
dRe.PREMIOGROSSO = toString(map.get(dRe.PREMIOGROSSO_));
dRe.TIPOCOBERTURA = toString(map.get(dRe.TIPOCOBERTURA_));
dRe.TOTAL = toString(map.get(dRe.TOTAL_));
};
try { Call.forEchaResultSet(act, rs); } catch (Exception e) { }
return dRe;
}
private static String toString(Object o) {
return ((o == null) ? "" : o.toString());
}
} |
package compose
import (
clusterClient "github.com/rancher/types/client/cluster/v3"
managementClient "github.com/rancher/types/client/management/v3"
projectClient "github.com/rancher/types/client/project/v3"
)
type Config struct {
Version string `yaml:"version,omitempty"`
// Management Client
NodePools map[string]managementClient.NodePool `json:"nodePools,omitempty" yaml:"nodePools,omitempty"`
Nodes map[string]managementClient.Node `json:"nodes,omitempty" yaml:"nodes,omitempty"`
NodeDrivers map[string]managementClient.NodeDriver `json:"nodeDrivers,omitempty" yaml:"nodeDrivers,omitempty"`
NodeTemplates map[string]managementClient.NodeTemplate `json:"nodeTemplates,omitempty" yaml:"nodeTemplates,omitempty"`
Projects map[string]managementClient.Project `json:"projects,omitempty" yaml:"projects,omitempty"`
GlobalRoles map[string]managementClient.GlobalRole `json:"globalRoles,omitempty" yaml:"globalRoles,omitempty"`
GlobalRoleBindings map[string]managementClient.GlobalRoleBinding `json:"globalRoleBindings,omitempty" yaml:"globalRoleBindings,omitempty"`
RoleTemplates map[string]managementClient.RoleTemplate `json:"roleTemplates,omitempty" yaml:"roleTemplates,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
Clusters map[string]managementClient.Cluster `json:"clusters,omitempty" yaml:"clusters,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
Catalogs map[string]managementClient.Catalog `json:"catalogs,omitempty" yaml:"catalogs,omitempty"`
Templates map[string]managementClient.Template `json:"templates,omitempty" yaml:"templates,omitempty"`
CatalogTemplates map[string]managementClient.CatalogTemplate `json:"catalogTemplates,omitempty" yaml:"catalogTemplates,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
TemplateVersions map[string]managementClient.TemplateVersion `json:"templateVersions,omitempty" yaml:"templateVersions,omitempty"`
TemplateContents map[string]managementClient.TemplateContent `json:"templateContents,omitempty" yaml:"templateContents,omitempty"`
Groups map[string]managementClient.Group `json:"groups,omitempty" yaml:"groups,omitempty"`
GroupMembers map[string]managementClient.GroupMember `json:"groupMembers,omitempty" yaml:"groupMembers,omitempty"`
Users map[string]managementClient.User `json:"users,omitempty" yaml:"users,omitempty"`
LdapConfigs map[string]managementClient.LdapConfig `json:"ldapConfigs,omitempty" yaml:"ldapConfigs,omitempty"`
Tokens map[string]managementClient.Token `json:"tokens,omitempty" yaml:"tokens,omitempty"`
DynamicSchemas map[string]managementClient.DynamicSchema `json:"dynamicSchemas,omitempty" yaml:"dynamicSchemas,omitempty"`
Preferences map[string]managementClient.Preference `json:"preferences,omitempty" yaml:"preferences,omitempty"`
ClusterLoggings map[string]managementClient.ClusterLogging `json:"clusterLoggings,omitempty" yaml:"clusterLoggings,omitempty"`
ProjectLoggings map[string]managementClient.ProjectLogging `json:"projectLoggings,omitempty" yaml:"projectLoggings,omitempty"`
Settings map[string]managementClient.Setting `json:"settings,omitempty" yaml:"settings,omitempty"`
Features map[string]managementClient.Feature `json:"features,omitempty" yaml:"features,omitempty"`
ClusterAlerts map[string]managementClient.ClusterAlert `json:"clusterAlerts,omitempty" yaml:"clusterAlerts,omitempty"`
ProjectAlerts map[string]managementClient.ProjectAlert `json:"projectAlerts,omitempty" yaml:"projectAlerts,omitempty"`
Notifiers map[string]managementClient.Notifier `json:"notifiers,omitempty" yaml:"notifiers,omitempty"`
ClusterAlertGroups map[string]managementClient.ClusterAlertGroup `json:"clusterAlertGroups,omitempty" yaml:"clusterAlertGroups,omitempty"`
ProjectAlertGroups map[string]managementClient.ProjectAlertGroup `json:"projectAlertGroups,omitempty" yaml:"projectAlertGroups,omitempty"`
ClusterAlertRules map[string]managementClient.ClusterAlertRule `json:"clusterAlertRules,omitempty" yaml:"clusterAlertRules,omitempty"`
ProjectAlertRules map[string]managementClient.ProjectAlertRule `json:"projectAlertRules,omitempty" yaml:"projectAlertRules,omitempty"`
ComposeConfigs map[string]managementClient.ComposeConfig `json:"composeConfigs,omitempty" yaml:"composeConfigs,omitempty"`
ProjectCatalogs map[string]managementClient.ProjectCatalog `json:"projectCatalogs,omitempty" yaml:"projectCatalogs,omitempty"`
ClusterCatalogs map[string]managementClient.ClusterCatalog `json:"clusterCatalogs,omitempty" yaml:"clusterCatalogs,omitempty"`
MultiClusterApps map[string]managementClient.MultiClusterApp `json:"multiClusterApps,omitempty" yaml:"multiClusterApps,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
GlobalDnss map[string]managementClient.GlobalDns `json:"globalDnses,omitempty" yaml:"globalDnses,omitempty"`
GlobalDNSProviders map[string]managementClient.GlobalDNSProvider `json:"globalDnsProviders,omitempty" yaml:"globalDnsProviders,omitempty"`
KontainerDrivers map[string]managementClient.KontainerDriver `json:"kontainerDrivers,omitempty" yaml:"kontainerDrivers,omitempty"`
EtcdBackups map[string]managementClient.EtcdBackup `json:"etcdBackups,omitempty" yaml:"etcdBackups,omitempty"`
MonitorMetrics map[string]managementClient.MonitorMetric `json:"monitorMetrics,omitempty" yaml:"monitorMetrics,omitempty"`
<API key> map[string]managementClient.ClusterMonitorGraph `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]managementClient.ProjectMonitorGraph `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
CloudCredentials map[string]managementClient.CloudCredential `json:"cloudCredentials,omitempty" yaml:"cloudCredentials,omitempty"`
ManagementSecrets map[string]managementClient.ManagementSecret `json:"managementSecrets,omitempty" yaml:"managementSecrets,omitempty"`
ClusterTemplates map[string]managementClient.ClusterTemplate `json:"clusterTemplates,omitempty" yaml:"clusterTemplates,omitempty"`
<API key> map[string]managementClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
RkeK8sSystemImages map[string]managementClient.RkeK8sSystemImage `json:"rkeK8sSystemImages,omitempty" yaml:"rkeK8sSystemImages,omitempty"`
<API key> map[string]managementClient.RkeK8sServiceOption `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
RkeAddons map[string]managementClient.RkeAddon `json:"rkeAddons,omitempty" yaml:"rkeAddons,omitempty"`
CisConfigs map[string]managementClient.CisConfig `json:"cisConfigs,omitempty" yaml:"cisConfigs,omitempty"`
<API key> map[string]managementClient.CisBenchmarkVersion `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
// Cluster Client
Namespaces map[string]clusterClient.Namespace `json:"namespaces,omitempty" yaml:"namespaces,omitempty"`
PersistentVolumes map[string]clusterClient.PersistentVolume `json:"persistentVolumes,omitempty" yaml:"persistentVolumes,omitempty"`
StorageClasss map[string]clusterClient.StorageClass `json:"storageClasses,omitempty" yaml:"storageClasses,omitempty"`
APIServices map[string]clusterClient.APIService `json:"apiServices,omitempty" yaml:"apiServices,omitempty"`
// Project Client
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
ConfigMaps map[string]projectClient.ConfigMap `json:"configMaps,omitempty" yaml:"configMaps,omitempty"`
Ingresss map[string]projectClient.Ingress `json:"ingresses,omitempty" yaml:"ingresses,omitempty"`
Secrets map[string]projectClient.Secret `json:"secrets,omitempty" yaml:"secrets,omitempty"`
<API key> map[string]projectClient.ServiceAccountToken `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
DockerCredentials map[string]projectClient.DockerCredential `json:"dockerCredentials,omitempty" yaml:"dockerCredentials,omitempty"`
Certificates map[string]projectClient.Certificate `json:"certificates,omitempty" yaml:"certificates,omitempty"`
BasicAuths map[string]projectClient.BasicAuth `json:"basicAuths,omitempty" yaml:"basicAuths,omitempty"`
SSHAuths map[string]projectClient.SSHAuth `json:"sshAuths,omitempty" yaml:"sshAuths,omitempty"`
NamespacedSecrets map[string]projectClient.NamespacedSecret `json:"namespacedSecrets,omitempty" yaml:"namespacedSecrets,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]projectClient.NamespacedBasicAuth `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
NamespacedSSHAuths map[string]projectClient.NamespacedSSHAuth `json:"namespacedSshAuths,omitempty" yaml:"namespacedSshAuths,omitempty"`
Services map[string]projectClient.Service `json:"services,omitempty" yaml:"services,omitempty"`
DNSRecords map[string]projectClient.DNSRecord `json:"dnsRecords,omitempty" yaml:"dnsRecords,omitempty"`
Pods map[string]projectClient.Pod `json:"pods,omitempty" yaml:"pods,omitempty"`
Deployments map[string]projectClient.Deployment `json:"deployments,omitempty" yaml:"deployments,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
ReplicaSets map[string]projectClient.ReplicaSet `json:"replicaSets,omitempty" yaml:"replicaSets,omitempty"`
StatefulSets map[string]projectClient.StatefulSet `json:"statefulSets,omitempty" yaml:"statefulSets,omitempty"`
DaemonSets map[string]projectClient.DaemonSet `json:"daemonSets,omitempty" yaml:"daemonSets,omitempty"`
Jobs map[string]projectClient.Job `json:"jobs,omitempty" yaml:"jobs,omitempty"`
CronJobs map[string]projectClient.CronJob `json:"cronJobs,omitempty" yaml:"cronJobs,omitempty"`
Workloads map[string]projectClient.Workload `json:"workloads,omitempty" yaml:"workloads,omitempty"`
Apps map[string]projectClient.App `json:"apps,omitempty" yaml:"apps,omitempty"`
AppRevisions map[string]projectClient.AppRevision `json:"appRevisions,omitempty" yaml:"appRevisions,omitempty"`
SourceCodeProviders map[string]projectClient.SourceCodeProvider `json:"sourceCodeProviders,omitempty" yaml:"sourceCodeProviders,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
Pipelines map[string]projectClient.Pipeline `json:"pipelines,omitempty" yaml:"pipelines,omitempty"`
PipelineExecutions map[string]projectClient.PipelineExecution `json:"pipelineExecutions,omitempty" yaml:"pipelineExecutions,omitempty"`
PipelineSettings map[string]projectClient.PipelineSetting `json:"pipelineSettings,omitempty" yaml:"pipelineSettings,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
Prometheuss map[string]projectClient.Prometheus `json:"prometheuses,omitempty" yaml:"prometheuses,omitempty"`
ServiceMonitors map[string]projectClient.ServiceMonitor `json:"serviceMonitors,omitempty" yaml:"serviceMonitors,omitempty"`
PrometheusRules map[string]projectClient.PrometheusRule `json:"prometheusRules,omitempty" yaml:"prometheusRules,omitempty"`
Alertmanagers map[string]projectClient.Alertmanager `json:"alertmanagers,omitempty" yaml:"alertmanagers,omitempty"`
<API key> map[string]projectClient.<API key> `json:"<API key>,omitempty" yaml:"<API key>,omitempty"`
VirtualServices map[string]projectClient.VirtualService `json:"virtualServices,omitempty" yaml:"virtualServices,omitempty"`
DestinationRules map[string]projectClient.DestinationRule `json:"destinationRules,omitempty" yaml:"destinationRules,omitempty"`
Gateways map[string]projectClient.Gateway `json:"gateways,omitempty" yaml:"gateways,omitempty"`
} |
'use strict';
/*eslint-env browser*/
// Just declaring the module in here. As the file name is _base
// it will be compiled first, which allows us to use the module
// when declaring the individual services within it
angular.module('hypercat.services', []); |
package com.bumptech.glide.load.resource.bitmap;
import android.content.Context;
import android.graphics.Bitmap;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.util.Util;
/**
* A simple {@link com.bumptech.glide.load.Transformation} for transforming {@link Bitmap}s that
* abstracts away dealing with {@link Resource} objects for subclasses.
*
* Use cases will look something like this:
* <pre>
* <code>
* public class FillSpace extends <API key> {
* {@literal @Override}
* public Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
* if (toTransform.getWidth() == outWidth && toTransform.getHeight() == outHeight) {
* return toTransform;
* }
*
* return Bitmap.createScaledBitmap(toTransform, outWidth, outHeight, true);
* }
* }
* </code>
* </pre>
*/
public abstract class <API key> implements Transformation<Bitmap> {
private BitmapPool bitmapPool;
public <API key>(Context context) {
this(Glide.get(context).getBitmapPool());
}
public <API key>(BitmapPool bitmapPool) {
this.bitmapPool = bitmapPool;
}
@Override
public final Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int outHeight) {
if (!Util.isValidDimensions(outWidth, outHeight)) {
throw new <API key>("Cannot apply transformation on width: " + outWidth + " or height: "
+ outHeight + " less than or equal to zero and not Target.SIZE_ORIGINAL");
}
Bitmap toTransform = resource.get();
int targetWidth = outWidth == Target.SIZE_ORIGINAL ? toTransform.getWidth() : outWidth;
int targetHeight = outHeight == Target.SIZE_ORIGINAL ? toTransform.getHeight() : outHeight;
Bitmap transformed = transform(bitmapPool, toTransform, targetWidth, targetHeight);
final Resource<Bitmap> result;
if (toTransform.equals(transformed)) {
result = resource;
} else {
result = BitmapResource.obtain(transformed, bitmapPool);
}
return result;
}
/**
* Transforms the given {@link Bitmap} based on the given dimensions and returns the transformed
* result.
*
* <p>
* The provided Bitmap, toTransform, should not be recycled or returned to the pool. Glide will automatically
* recycle and/or reuse toTransform if the transformation returns a different Bitmap. Similarly implementations
* should never recycle or return Bitmaps that are returned as the result of this method. Recycling or returning
* the provided and/or the returned Bitmap to the pool will lead to a variety of runtime exceptions and drawing
* errors. See #408 for an example. If the implementation obtains and discards intermediate Bitmaps, they may
* safely be returned to the BitmapPool and/or recycled.
* </p>
*
* <p>
* outWidth and outHeight will never be {@link com.bumptech.glide.request.target.Target#SIZE_ORIGINAL}, this
* class converts them to be the size of the Bitmap we're going to transform before calling this method.
* </p>
*
* @param pool A {@link BitmapPool} that can be used to obtain and
* return intermediate {@link Bitmap}s used in this transformation. For every
* {@link Bitmap} obtained from the pool during this transformation, a
* {@link Bitmap} must also be returned.
* @param toTransform The {@link Bitmap} to transform.
* @param outWidth The ideal width of the transformed bitmap (the transformed width does not need to match exactly).
* @param outHeight The ideal height of the transformed bitmap (the transformed heightdoes not need to match
* exactly).
*/
protected abstract Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight);
} |
<reference path="fourslash.ts" />
// @<API key>: true
// @Filename: a.js
/ Foo<number>();
verify.<API key>(`[
{
"message": "'type arguments' can only be used in a .ts file.",
"start": 4,
"length": 6,
"category": "error",
"code": 8011
}
]`); |
// +build big
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package index
import (
"fmt"
"math/rand"
"os"
"regexp"
"regexp/syntax"
"strings"
"testing"
"time"
"unicode"
"github.com/leanovate/gopter"
"github.com/leanovate/gopter/gen"
"github.com/leanovate/gopter/prop"
"github.com/stretchr/testify/require"
)
func <API key>(t *testing.T) {
parameters := gopter.<API key>()
seed := time.Now().UnixNano()
parameters.MinSuccessfulTests = 100000
parameters.MaxSize = 40
parameters.Rng = rand.New(rand.NewSource(seed))
properties := gopter.NewProperties(parameters)
properties.Property("Regexp matches same strings after modifications", prop.ForAll(
func(x *inputCase) (bool, error) {
compiled := compileRegexp(x.re, t)
re, err := regexp.Compile(x.re)
if err != nil {
return false, fmt.Errorf("unable to compile re [%v]: %v", x.re, err)
}
input := []byte(x.str)
originalMatch := re.Match(input)
compiledMatch := compiled.Match(input)
if originalMatch != compiledMatch {
return false, fmt.Errorf("don't match %v %v %+v", originalMatch, compiled, x)
}
return true, nil
},
genInputCase(),
))
reporter := gopter.NewFormatedReporter(true, 160, os.Stdout)
if !properties.Run(reporter) {
t.Errorf("failed with initial seed: %d", seed)
}
}
func compileRegexp(x string, t *testing.T) *regexp.Regexp {
ast, err := parseRegexp(x)
require.NoError(t, err)
astp, err := <API key>(ast)
require.NoError(t, err)
ast2p, err := <API key>(astp)
require.NoError(t, err)
re, err := regexp.Compile(ast2p.String())
require.NoError(t, err)
return re
}
func genInputCase() gopter.Gen {
return genRegexp(unicode.ASCII_Hex_Digit).Map(
func(reString string, params *gopter.GenParameters) *inputCase {
val := gen.RegexMatch(reString)(params)
strAny, ok := val.Retrieve()
if !ok {
return nil
}
return &inputCase{
re: reString,
str: strAny.(string),
}
}).SuchThat(func(ic *inputCase) bool {
return ic != nil
})
}
type inputCase struct {
re string
str string
}
const regexpFlags = syntax.Perl
func genRegexp(language *unicode.RangeTable) gopter.Gen {
return genRegexpAst(language).Map(func(r *syntax.Regexp) string {
return strings.Replace(r.Simplify().String(), "\\", "\\\\", -1)
})
}
func genRegexpAst(language *unicode.RangeTable) gopter.Gen {
return gen.OneGenOf(
genRegexpNoOperands(language),
genRegexpLiteral(language),
<API key>(language),
<API key>(language),
)
}
func genRegexpNoOperands(l *unicode.RangeTable) gopter.Gen {
return gen.OneConstOf(
syntax.OpEmptyMatch,
syntax.OpAnyChar,
syntax.OpBeginText,
syntax.OpEndText,
syntax.OpWordBoundary,
syntax.OpNoWordBoundary,
).Map(func(op syntax.Op) *syntax.Regexp {
return &syntax.Regexp{
Op: op,
Flags: regexpFlags,
}
})
}
func genRegexpLiteral(language *unicode.RangeTable) gopter.Gen {
return gen.UnicodeString(language).Map(func(s string) *syntax.Regexp {
return &syntax.Regexp{
Op: syntax.OpLiteral,
Flags: regexpFlags,
Rune: []rune(s),
}
})
}
func <API key>(l *unicode.RangeTable) gopter.Gen {
return gopter.CombineGens(
gen.OneGenOf(genRegexpLiteral(l), genRegexpNoOperands(l)),
gen.OneConstOf(
syntax.OpCapture,
syntax.OpStar,
syntax.OpPlus,
syntax.OpQuest,
syntax.OpRepeat),
).Map(func(vals []interface{}) *syntax.Regexp {
return &syntax.Regexp{
Op: vals[1].(syntax.Op),
Flags: regexpFlags,
Sub: []*syntax.Regexp{vals[0].(*syntax.Regexp)},
}
})
}
func <API key>(l *unicode.RangeTable) gopter.Gen {
return gopter.CombineGens(
gen.SliceOf(
gen.OneGenOf(
genRegexpLiteral(l),
genRegexpNoOperands(l),
<API key>(l),
)),
gen.OneConstOf(
syntax.OpConcat,
syntax.OpAlternate),
).Map(func(vals []interface{}) *syntax.Regexp {
return &syntax.Regexp{
Op: vals[1].(syntax.Op),
Flags: regexpFlags,
Sub: vals[0].([]*syntax.Regexp),
}
})
} |
import struct
from ryu.lib.pack_utils import msg_pack_into
from ryu.lib import type_desc
# enum ofp_oxs_class
<API key> = 0x8002 # Basic stats class for OpenFlow
OFPXSC_EXPERIMENTER = 0xFFFF # Experimenter class
# enum oxs_ofb_stat_fields
OFPXST_OFB_DURATION = 0 # Time flow entry has been alive.
<API key> = 1 # Time flow entry has been idle.
<API key> = 3 # Number of aggregated flow entries.
<API key> = 4 # Number of packets in flow entry.
<API key> = 5 # Number of bytes in flow entry.
class _OxsClass(object):
def __init__(self, name, num, type_):
self.name = name
self.oxs_type = num | (self._class << 7)
# TODO(yamamoto): Clean this up later.
# Probably when we drop EXT-256 style experimenter OXMs.
self.num = self.oxs_type
self.type = type_
class OpenFlowBasic(_OxsClass):
_class = <API key>
class Experimenter(_OxsClass):
_class = OFPXSC_EXPERIMENTER
def __init__(self, name, experimenter_id, num, type_):
super(Experimenter, self).__init__(name, num, type_)
self.experimenter_id = experimenter_id
self.num = (self.experimenter_id, self.oxs_type)
# define OFPXST_OFB_ALL ((UINT64_C(1) << 6) - 1)
# /* Header for OXS experimenter stat fields. */
# struct <API key> {
# uint32_t oxs_header; /* oxs_class = OFPXSC_EXPERIMENTER */
# uint32_t experimenter; /* Experimenter ID. */
# OFP_ASSERT(sizeof(struct <API key>) == 8);
def generate(modname):
import sys
import functools
mod = sys.modules[modname]
def add_attr(k, v):
setattr(mod, k, v)
for i in mod.oxs_types:
uk = i.name.upper()
if isinstance(i.num, tuple):
continue
oxs_class = i.num >> 7
if oxs_class != <API key>:
continue
#TODO: JALIL check the mask!
ofpxst = i.num & 0x3f
td = i.type
add_attr('OFPXST_OFB_' + uk, ofpxst)
add_attr('OXS_OF_' + uk, mod.oxs_tlv_header(ofpxst, td.size))
name_to_field = dict((f.name, f) for f in mod.oxs_types)
num_to_field = dict((f.num, f) for f in mod.oxs_types)
add_attr('oxs_from_user', functools.partial(_from_user, name_to_field))
add_attr('<API key>',
functools.partial(_from_user_header, name_to_field))
add_attr('oxs_to_user', functools.partial(_to_user, num_to_field))
add_attr('oxs_to_user_header',
functools.partial(_to_user_header, num_to_field))
add_attr('_oxs_field_desc', functools.partial(_field_desc, num_to_field))
add_attr('oxs_normalize_user', functools.partial(_normalize_user, mod))
add_attr('oxs_parse', functools.partial(_parse, mod))
add_attr('oxs_parse_header', functools.partial(_parse_header, mod))
add_attr('oxs_serialize', functools.partial(_serialize, mod))
add_attr('<API key>', functools.partial(_serialize_header, mod))
add_attr('oxs_to_jsondict', _to_jsondict)
add_attr('oxs_from_jsondict', _from_jsondict)
def <API key>(name_to_field, name):
try:
f = name_to_field[name]
t = f.type
num = f.num
except KeyError:
t = type_desc.UnknownType
if name.startswith('field_'):
num = int(name.split('_')[1])
else:
raise KeyError('unknown match field ' + name)
return num, t
def _from_user_header(name_to_field, name):
(num, t) = <API key>(name_to_field, name)
return num
# def _from_user(name_to_field, name, user_value):
# (num, t) = <API key>(name_to_field, name)
# # the 'list' case below is a bit hack; json.dumps silently maps
# # python tuples into json lists.
# if isinstance(user_value, (tuple, list)):
# (value, mask) = user_value
# else:
# value = user_value
# mask = None
# if value is not None:
# value = t.from_user(value)
# if mask is not None:
# mask = t.from_user(mask)
# return num, value, mask
def _from_user(name_to_field, name, user_value):
(num, t) = <API key>(name_to_field, name)
value = t.from_user(user_value)
return num, value
def <API key>(num_to_field, num):
try:
f = num_to_field[num]
t = f.type
name = f.name
except KeyError:
t = type_desc.UnknownType
name = 'field_%d' % (num,)
return name, t
def _to_user_header(num_to_field, num):
(name, t) = <API key>(num_to_field, num)
return name
def _to_user(num_to_field, num, value):
(name, t) = <API key>(num_to_field, num)
if value is not None:
if hasattr(t, 'size') and t.size != len(value):
raise Exception(
'Unexpected OXM payload length %d for %s (expected %d)'
% (len(value), name, t.size))
value = t.to_user(value)
else:
value = None
return name, value
def _field_desc(num_to_field, num):
return num_to_field[num]
def _normalize_user(mod, k, uv):
(num, value) = mod.oxs_from_user(k, uv)
(k2, uv2) = mod.oxm_to_user(num, value)
assert k2 == k
return (k2, uv2)
def _parse_header_impl(mod, buf, offset):
hdr_pack_str = '!I'
(header, ) = struct.unpack_from(hdr_pack_str, buf, offset)
hdr_len = struct.calcsize(hdr_pack_str)
oxs_type = mod.<API key>(header)
oxs_class = mod.<API key>(header)
oxs_length = mod.<API key>(header)
if oxs_class == OFPXSC_EXPERIMENTER:
# Experimenter OXSs have 64-bit header. (vs 32-bit for other OXSs)
exp_hdr_pack_str = '!I' # experimenter_id
(exp_id, ) = struct.unpack_from(exp_hdr_pack_str, buf,
offset + hdr_len)
exp_hdr_len = struct.calcsize(exp_hdr_pack_str)
assert exp_hdr_len == 4
oxs_field = oxs_type & 0x7f
num = (exp_id, oxs_type)
else:
num = oxs_type
exp_hdr_len = 0
value_len = oxs_length - exp_hdr_len
assert value_len > 0
field_len = hdr_len + oxs_length
total_hdr_len = hdr_len + exp_hdr_len
return num, total_hdr_len, value_len, field_len
def _parse_header(mod, buf, offset):
(oxs_type_num, total_hdr_len, value_len, field_len) = _parse_header_impl(mod, buf, offset)
return oxs_type_num, field_len - value_len
def _parse(mod, buf, offset):
(oxs_type_num, total_hdr_len, value_len, field_len) = _parse_header_impl(mod, buf, offset)
# Note: OXM payload length (oxm_len) includes Experimenter ID (exp_hdr_len)
# for experimenter OXMs.
value_offset = offset + total_hdr_len
value_pack_str = '!%ds' % value_len
assert struct.calcsize(value_pack_str) == value_len
(value, ) = struct.unpack_from(value_pack_str, buf, value_offset)
return oxs_type_num, value, field_len
def _make_exp_hdr(mod, num):
exp_hdr = bytearray()
try:
desc = mod._oxs_field_desc(num)
except KeyError:
return num, exp_hdr
if isinstance(desc, Experimenter): # XXX
(exp_id, exp_type) = num
assert desc.experimenter_id == exp_id
assert desc.oxs_type == exp_type
exp_hdr_pack_str = '!I' # experimenter_id
msg_pack_into(exp_hdr_pack_str, exp_hdr, 0,
desc.experimenter_id)
assert len(exp_hdr) == struct.calcsize(exp_hdr_pack_str)
num = desc.oxs_type
assert (num >> 7) == OFPXSC_EXPERIMENTER
return num, exp_hdr
def _serialize_header(mod, num, buf, offset):
try:
desc = mod._oxs_field_desc(num)
value_len = desc.type.size
except KeyError:
value_len = 0
num, exp_hdr = _make_exp_hdr(mod, num)
exp_hdr_len = len(exp_hdr)
pack_str = "!I%ds" % (exp_hdr_len,)
msg_pack_into(pack_str, buf, offset,
(num << 9) | (0 << 8) | (exp_hdr_len + value_len),
bytes(exp_hdr))
return struct.calcsize(pack_str)
def _serialize(mod, num, value, mask, buf, offset):
num, exp_hdr = _make_exp_hdr(mod, num)
exp_hdr_len = len(exp_hdr)
value_len = len(value)
pack_str = "!I%ds%ds" % (exp_hdr_len, value_len,)
msg_pack_into(pack_str, buf, offset,
(num << 9) | (0 << 8) | (exp_hdr_len + value_len),
bytes(exp_hdr), value)
return struct.calcsize(pack_str)
def _to_jsondict(k, uv):
return {"OXMTlv": {"field": k, "value": uv}}
def _from_jsondict(j):
tlv = j['OXMTlv']
field = tlv['field']
value = tlv['value']
return (field, value) |
package <API key>
import (
"encoding/gob"
"fmt"
"time"
"golang.org/x/net/context"
"github.com/nyaxt/otaru/blobstore"
"github.com/nyaxt/otaru/btncrypt"
"github.com/nyaxt/otaru/inodedb"
"github.com/nyaxt/otaru/logger"
"github.com/nyaxt/otaru/metadata/statesnapshot"
"github.com/nyaxt/otaru/util"
)
var mylog = logger.Registry().Category("bsdbssio")
type SSLocator interface {
Locate(history int) (string, int64, error)
GenerateBlobpath() string
Put(blobpath string, txid int64) error
DeleteOld(ctx context.Context, threshold int, dryRun bool) ([]string, error)
}
type DBStateSnapshotIO struct {
bs blobstore.BlobStore
c *btncrypt.Cipher
loc SSLocator
snapshotVer inodedb.TxID
}
var _ = inodedb.DBStateSnapshotIO(&DBStateSnapshotIO{})
func New(bs blobstore.BlobStore, c *btncrypt.Cipher, loc SSLocator) *DBStateSnapshotIO {
return &DBStateSnapshotIO{bs: bs, c: c, loc: loc, snapshotVer: -1}
}
func (sio *DBStateSnapshotIO) SaveSnapshot(s *inodedb.DBState) <-chan error {
errC := make(chan error, 1)
currVer := s.Version()
if sio.snapshotVer > currVer {
logger.Warningf(mylog, "SaveSnapshot: ASSERT fail: snapshot version %d newer than current ver %d", sio.snapshotVer, currVer)
} else if sio.snapshotVer == currVer {
logger.Debugf(mylog, "SaveSnapshot: Current ver %d is already snapshotted. No-op.", sio.snapshotVer)
close(errC)
return errC
}
buf, err := statesnapshot.EncodeBytes(func(enc *gob.Encoder) error { return s.EncodeToGob(enc) })
if err != nil {
errC <- err
close(errC)
return errC
}
go func() {
defer close(errC)
ssbp := sio.loc.GenerateBlobpath()
wc, err := sio.bs.OpenWriter(ssbp)
if err != nil {
errC <- err
return
}
if err := statesnapshot.SaveBytes(wc, sio.c, buf); err != nil {
wc.Close()
errC <- err
return
}
wc.Close()
if err := sio.loc.Put(ssbp, int64(s.Version())); err != nil {
errC <- err
return
}
sio.snapshotVer = s.Version()
}()
return errC
}
func (sio *DBStateSnapshotIO) restoreNthSnapshot(i int) (*inodedb.DBState, error) {
ssbp, txid, err := sio.loc.Locate(i)
if err != nil {
return nil, err
}
if i == 0 {
logger.Debugf(mylog, "Attempting to restore latest state snapshot \"%s\"", ssbp)
} else {
logger.Infof(mylog, "Retrying state snapshot restore with an older state snapshot \"%s\"", ssbp)
}
var state *inodedb.DBState
rc, err := sio.bs.OpenReader(ssbp)
if err != nil {
return nil, err
}
err = statesnapshot.Restore(
rc, sio.c,
func(dec *gob.Decoder) error {
var err error
state, err = inodedb.<API key>(dec)
return err
})
if err != nil {
rc.Close()
return nil, err
}
rc.Close()
if inodedb.TxID(txid) != state.Version() {
logger.Warningf(mylog, "SSLocator TxID mismatch. SSLocator %v != Actual SS %v", inodedb.TxID(txid), state.Version())
}
sio.snapshotVer = state.Version()
return state, nil
}
const maxhist = 3
func (sio *DBStateSnapshotIO) RestoreSnapshot() (*inodedb.DBState, error) {
for i := 0; i < maxhist; i++ {
state, err := sio.restoreNthSnapshot(i)
if err == nil {
return state, nil
} else {
logger.Warningf(mylog, "Failed to recover state snapshot: %v", err)
}
}
return nil, fmt.Errorf("Failed to restore %d snapshots. Aborted.", maxhist)
}
func (sio *DBStateSnapshotIO) <API key>() (inodedb.TxID, error) {
state, err := sio.restoreNthSnapshot(maxhist - 1)
if err != nil {
return inodedb.AnyVersion, err
}
return state.Version(), nil
}
func (sio *DBStateSnapshotIO) DeleteOldSnapshots(ctx context.Context, dryRun bool) error {
logger.Infof(mylog, "DeleteOldSnapshots(dryRun: %t) start", dryRun)
start := time.Now()
bdeleter, ok := sio.bs.(blobstore.BlobRemover)
if !ok {
return fmt.Errorf("Backend blobstore \"%v\" doesn't support blob deletion.", util.Describe(sio.bs))
}
if _, err := sio.RestoreSnapshot(); err != nil {
return fmt.Errorf("DeleteOldSnapshots. RestoreSnapshot() sanity check failed: %v", err)
}
logger.Infof(mylog, "Asserted that RestoreSnapshot() works.")
bps, err := sio.loc.DeleteOld(ctx, maxhist, dryRun)
if err != nil {
return fmt.Errorf("SSLocator.DeleteOld failed: %v", err)
}
errs := []error{}
if dryRun {
for _, bp := range bps {
logger.Infof(mylog, "Not actually deleting snapshot blob \"%s\" in dry run.", bp)
}
} else {
for _, bp := range bps {
logger.Infof(mylog, "Deleting snapshot blob \"%s\".", bp)
if err := bdeleter.RemoveBlob(bp); err != nil {
logger.Warningf(mylog, "Error removing blob \"%s\": %v", bp, err)
errs = append(errs, err)
}
}
}
logger.Infof(mylog, "DeleteOldSnapshots(dryRun: %t) took %v", dryRun, time.Since(start))
return util.ToErrors(errs)
}
func (sio *DBStateSnapshotIO) String() string {
return fmt.Sprintf("DBStateSnapshotIO{%v}", util.TryGetImplName(sio.loc))
} |
{{ $title := .Get "title" | default "" }}
{{ $_hugo_config := `{ "version": 1 }` }}
{{ $align := .Get "align" | default "center" }}
<div class="mermaid" align="{{ $align }}">{{ safeHTML .Inner }}</div>
{{- if $title }}{{ $title }}{{end }}
<p> |
function FetchCityData(city_id) {
var request = new XMLHttpRequest();
request.onreadystatechange = <API key>;
request.open("POST", "http://xoap.weather.com/weather/local/"+city_id+"?par=1026134024&key=53318d3ee1447152", true);
request.send();
function <API key>() {
var error = 0;
//progressbar handling
switch (request.readyState) {
case 1:
search_progress.value=62;
break;
case 2:
search_progress.value=75;
break;
case 3:
search_progress.value=87;
break;
case 4:
search_progress.value=100;
break;
}
if (request && request.readyState == 4) {
if (request.status == 200) {
try {
var start = request.responseText.indexOf("<dnam>");
if(start == -1) {
error = 1;
return;
}
var end = request.responseText.indexOf("</dnam>");
var city = request.responseText.substr(start+6, end - start - 6);
var start = request.responseText.indexOf("<lat>");
if(start == -1) {
error = 1;
}
var end = request.responseText.indexOf("</lat>");
var latitude = request.responseText.substr(start+5, end - start - 5);
var start = request.responseText.indexOf("<lon>");
if(start == -1) {
error = 1;
}
var end = request.responseText.indexOf("</lon>");
var longitude = request.responseText.substr(start+5, end - start - 5);
var start = request.responseText.indexOf("<sunr>");
if(start == -1) {
error = 1;
}
var end = request.responseText.indexOf("</sunr>");
var sunrise = request.responseText.substr(start+6, end - start - 6);
var start = request.responseText.indexOf("<suns>");
if(start == -1) {
error = 1;
}
var end = request.responseText.indexOf("</suns>");
var sunset = request.responseText.substr(start+6, end - start - 6);
var start = request.responseText.indexOf("<zone>");
if(start == -1) {
error = 1;
}
var end = request.responseText.indexOf("</zone>");
var zone = request.responseText.substr(start+6, end - start - 6);
if (error==0) {
options("city") = city;
options("lat") = parseFloat(latitude);
options("lon") = parseFloat(longitude);
options("sunrise") = sunrise;
options("sunset") = sunset;
options("zone") = zone;
}
} catch (e) {
error = 1;
}
}
else { // request.status != 200
error = 1;
}
AfterFetchCityData(error);
}
}
}
function SearchCity(city) {
var request = new XMLHttpRequest();
request.onreadystatechange = <API key>;
request.open("POST", "http://xoap.weather.com/search/search?where="+city+"&par=1026134024&key=53318d3ee1447152", true);
request.send();
function <API key>() {
var error = 0;
//progressbar handling
switch (request.readyState) {
case 1:
search_progress.value=12;
break;
case 2:
search_progress.value=25;
break;
case 3:
search_progress.value=37;
break;
case 4:
search_progress.value=50;
break;
}
if (request && request.readyState == 4) {
if (request.status == 200) {
try {
var start = request.responseText.indexOf("<loc id=");
if (start == -1) { //no city under this name
error = 1;
}
var end = request.responseText.indexOf(" type=");
var city_id = request.responseText.substr(start+9, end - start - 10);
if (error == 0) {
options("city_id") = city_id;
}
} catch (e) {
error = 1;
}
}
else { // request.status != 200
error = 1;
}
AfterSearchCity(error);
}
}
} |
package org.kopptech.commonbond;
import java.lang.reflect.Type;
public interface Binding
{
public Object getValue(boolean createParentIfNull);
public Type getType();
public void setValue(Object o, boolean allowInvalid);
public Object createDefaultValue();
public boolean <API key>();
public void <API key>(boolean <API key>);
} |
// generator creates operations for container processing
package generator
import (
"fmt"
"github.com/<API key>/bbs"
"github.com/<API key>/bbs/models"
"github.com/<API key>/executor"
"github.com/<API key>/rep"
"github.com/<API key>/rep/evacuation/evacuation_context"
"github.com/<API key>/rep/generator/internal"
"github.com/pivotal-golang/lager"
"github.com/pivotal-golang/operationq"
)
//go:generate counterfeiter -o fake_generator/fake_generator.go . Generator
// Generator encapsulates operation creation in the Rep.
type Generator interface {
// BatchOperations creates a set of operations across all containers the Rep is managing.
BatchOperations(lager.Logger) (map[string]operationq.Operation, error)
// OperationStream creates an operation every time a container lifecycle event is observed.
OperationStream(lager.Logger) (<-chan operationq.Operation, error)
}
type generator struct {
cellID string
bbs bbs.Client
executorClient executor.Client
lrpProcessor internal.LRPProcessor
taskProcessor internal.TaskProcessor
containerDelegate internal.ContainerDelegate
}
func New(
cellID string,
bbs bbs.Client,
executorClient executor.Client,
evacuationReporter evacuation_context.EvacuationReporter,
<API key> uint64,
) Generator {
containerDelegate := internal.<API key>(executorClient)
lrpProcessor := internal.NewLRPProcessor(bbs, containerDelegate, cellID, evacuationReporter, <API key>)
taskProcessor := internal.NewTaskProcessor(bbs, containerDelegate, cellID)
return &generator{
cellID: cellID,
bbs: bbs,
executorClient: executorClient,
lrpProcessor: lrpProcessor,
taskProcessor: taskProcessor,
containerDelegate: containerDelegate,
}
}
func (g *generator) BatchOperations(logger lager.Logger) (map[string]operationq.Operation, error) {
logger = logger.Session("batch-operations")
logger.Info("started")
containers := make(map[string]executor.Container)
instanceLRPs := make(map[string]models.ActualLRP)
evacuatingLRPs := make(map[string]models.ActualLRP)
tasks := make(map[string]*models.Task)
errChan := make(chan error, 3)
logger.Info("<API key>")
go func() {
foundContainers, err := g.executorClient.ListContainers(nil)
if err != nil {
logger.Error("<API key>", err)
err = fmt.Errorf("failed to list containers: %s", err.Error())
}
for _, c := range foundContainers {
containers[c.Guid] = c
}
errChan <- err
}()
go func() {
filter := models.ActualLRPFilter{CellID: g.cellID}
groups, err := g.bbs.ActualLRPGroups(filter)
if err != nil {
logger.Error("<API key>", err)
err = fmt.Errorf("failed to retrieve lrps: %s", err.Error())
}
for _, group := range groups {
if group.Instance != nil {
instanceLRPs[rep.LRPContainerGuid(group.Instance.GetProcessGuid(), group.Instance.GetInstanceGuid())] = *group.Instance
}
if group.Evacuating != nil {
evacuatingLRPs[rep.LRPContainerGuid(group.Evacuating.GetProcessGuid(), group.Evacuating.GetInstanceGuid())] = *group.Evacuating
}
}
errChan <- err
}()
go func() {
foundTasks, err := g.bbs.TasksByCellID(g.cellID)
if err != nil {
logger.Error("<API key>", err)
err = fmt.Errorf("failed to retrieve tasks: %s", err.Error())
}
for _, task := range foundTasks {
tasks[task.TaskGuid] = task
}
errChan <- err
}()
var err error
for i := 0; i < 3; i++ {
e := <-errChan
if err == nil && e != nil {
err = e
}
}
if err != nil {
logger.Error("<API key>", err)
return nil, err
}
logger.Info("<API key>")
batch := make(map[string]operationq.Operation)
// create operations for processes with containers
for guid, _ := range containers {
batch[guid] = g.<API key>(logger, guid)
}
// create operations for instance lrps with no containers
for guid, lrp := range instanceLRPs {
if _, foundContainer := batch[guid]; foundContainer {
continue
}
if _, foundEvacuatingLRP := evacuatingLRPs[guid]; foundEvacuatingLRP {
batch[guid] = <API key>(logger, g.bbs, g.containerDelegate, lrp.ActualLRPKey, lrp.<API key>)
} else {
batch[guid] = <API key>(logger, g.bbs, g.containerDelegate, lrp.ActualLRPKey, lrp.<API key>)
}
}
// create operations for evacuating lrps with no containers
for guid, lrp := range evacuatingLRPs {
_, found := batch[guid]
if !found {
batch[guid] = <API key>(logger, g.bbs, g.containerDelegate, lrp.ActualLRPKey, lrp.<API key>)
}
}
// create operations for tasks with no containers
for guid, _ := range tasks {
_, found := batch[guid]
if !found {
batch[guid] = <API key>(logger, guid, g.bbs, g.containerDelegate)
}
}
logger.Info("succeeded", lager.Data{"batch-size": len(batch)})
return batch, nil
}
func (g *generator) OperationStream(logger lager.Logger) (<-chan operationq.Operation, error) {
logger = logger.Session("operation-stream")
logger.Info("subscribing")
events, err := g.executorClient.SubscribeToEvents()
if err != nil {
logger.Error("failed-subscribing", err)
return nil, err
}
logger.Info("<API key>")
opChan := make(chan operationq.Operation)
go func() {
defer events.Close()
for {
e, err := events.Next()
if err != nil {
logger.Debug("event-stream-closed")
close(opChan)
return
}
lifecycle, ok := e.(executor.LifecycleEvent)
if !ok {
logger.Debug("<API key>")
continue
}
container := lifecycle.Container()
opChan <- g.<API key>(logger, container.Guid)
}
}()
return opChan, nil
}
func (g *generator) <API key>(logger lager.Logger, guid string) operationq.Operation {
return <API key>(logger, g.lrpProcessor, g.taskProcessor, g.containerDelegate, guid)
} |
<?php
namespace BeholderWebClient\Eyes\Inode;
use Exception;
Class Eye extends AbstractInode {
public function checkRequirement(){
$result = exec('type -P df');
if(!$result)
throw new Exception(Status::REQUERIMENT_FAIL, Status::<API key>);
}
public function verifyStorage(){
$result = shell_exec('df -i');
$m = [];
$path = $this->scapeBar($this->conf['storage_path']);
$regx = "/^.*?([\d]+%)[\s]+{$path}$/m";
preg_match($regx, $result, $m);
if(!isset($m[1]))
throw new Exception(
Status::<API key> . ' ' . $this->conf['storage_path'],
Status::<API key>
);
$inodes_usage = (int)$m[1];
if( $inodes_usage > (int)$this->conf['<API key>'])
throw new Exception(Status::MAX_USAGE_ALLOWED, STATUS::<API key>);
}
protected function scapeBar($string){
return str_replace('/','\/', $string);
}
} |
package de.milchreisjunkie.netpetcam.interfaces;
public interface ICaptureDevice {
public void setup(Object options) throws Exception;
public void capture() throws Exception;
} |
using System.Threading.Tasks;
namespace Knightware.Net.Sockets
{
public interface IStreamSocket : ISocket
{
bool IsConnected { get; }
Task<int> ReadAsync(byte[] buffer, int offset, int length);
Task<int> ReadAsync(byte[] buffer, int offset, int length, int timeout);
Task WriteAsync(byte[] buffer, int offset, int length);
Task WriteAsync(byte[] buffer, int offset, int length, int timeout);
}
} |
package sr25519
import (
"fmt"
"io"
"testing"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/internal/benchmarking"
)
func <API key>(b *testing.B) {
<API key> := func(reader io.Reader) crypto.PrivKey {
return genPrivKey(reader)
}
benchmarking.<API key>(b, <API key>)
}
func BenchmarkSigning(b *testing.B) {
priv := GenPrivKey()
benchmarking.BenchmarkSigning(b, priv)
}
func <API key>(b *testing.B) {
priv := GenPrivKey()
benchmarking.<API key>(b, priv)
}
func <API key>(b *testing.B) {
msg := []byte("BatchVerifyTest")
for _, sigsCount := range []int{1, 8, 64, 1024} {
sigsCount := sigsCount
b.Run(fmt.Sprintf("sig-count-%d", sigsCount), func(b *testing.B) {
// Pre-generate all of the keys, and signatures, but do not
// benchmark key-generation and signing.
pubs := make([]crypto.PubKey, 0, sigsCount)
sigs := make([][]byte, 0, sigsCount)
for i := 0; i < sigsCount; i++ {
priv := GenPrivKey()
sig, _ := priv.Sign(msg)
pubs = append(pubs, priv.PubKey().(PubKey))
sigs = append(sigs, sig)
}
b.ResetTimer()
b.ReportAllocs()
// NOTE: dividing by n so that metrics are per-signature
for i := 0; i < b.N/sigsCount; i++ {
// The benchmark could just benchmark the Verify()
// routine, but there is non-trivial overhead associated
// with BatchVerifier.Add(), which should be included
// in the benchmark.
v := NewBatchVerifier()
for i := 0; i < sigsCount; i++ {
err := v.Add(pubs[i], msg, sigs[i])
require.NoError(b, err)
}
if ok, _ := v.Verify(); !ok {
b.Fatal("signature set failed batch verification")
}
}
})
}
} |
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { <API key> } from './category-products';
import { CustomIconsModule } from 'ionic2-custom-icons';
import { PipesModule } from '../../pipes/pipes.module';
@NgModule({
declarations: [
<API key>,
],
imports: [
IonicPageModule.forChild(<API key>),
CustomIconsModule,
PipesModule
],
exports: [
<API key>
]
})
export class <API key> { } |
package com.lianjiatech.infrastructure;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import java.util.ArrayList;
import java.util.List;
public class ProgressLayout extends RelativeLayout {
private static final int defStyleAttr = R.attr.<API key>;
private static final int NOT_SET = -1;
private static final String LOADING_TAG = "ProgressLayout.loading_tag";
private static final String NONE_TAG = "ProgressLayout.none_tag";
private static final String ERROR_TAG = "ProgressLayout.error_tag";
private LayoutInflater layoutInflater;
/*Some ViewGroup*/
private View loadingContainer;
private View noneContainer;
private View <API key>;
private View failedContainer;
/*Some Id*/
private int loadingId;
private int noneId;
private int failedId;
private int networkErrorId;
private List<View> contentViews = new ArrayList<>();
public enum LAYOUT_TYPE {
LOADING,
NONE,
CONTENT,
NETWORK_ERROR,
FAILED
}
private LAYOUT_TYPE currentState = LAYOUT_TYPE.LOADING;
public ProgressLayout(Context context) {
this(context, null);
}
public ProgressLayout(Context context, AttributeSet attrs) {
this(context, attrs, defStyleAttr);
}
public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
if (!this.isInEditMode()) {
ProgressLayout.this.init(context, attrs, defStyleAttr);
}
}
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
this.layoutInflater =
(LayoutInflater) context.getSystemService(Context.<API key>);
TypedArray typedArray =
context.<API key>(attrs, R.styleable.ProgressLayout, defStyleAttr,
R.style.DefaultSmartStyle);
if (typedArray == null) {
return;
}
try {
this.loadingId =
typedArray.getResourceId(R.styleable.<API key>, NOT_SET);
this.noneId =
typedArray.getResourceId(R.styleable.<API key>, NOT_SET);
this.networkErrorId =
typedArray.getResourceId(R.styleable.<API key>, NOT_SET);
this.failedId =
typedArray.getResourceId(R.styleable.<API key>, NOT_SET);
} finally {
typedArray.recycle();
}
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
if (child.getTag() == null ||
(!child.getTag().equals(LOADING_TAG) && !child.getTag().equals(NONE_TAG) &&
!child.getTag().equals(ERROR_TAG))) {
this.contentViews.add(child);
if (!this.isInEditMode()) {
this.<API key>(false);
}
}
}
public void showLoading() {
ProgressLayout.this.showLoadingView();
ProgressLayout.this.hideNoneView();
ProgressLayout.this.hideNetErrorView();
ProgressLayout.this.hideFailedView();
ProgressLayout.this.<API key>(false);
this.currentState = LAYOUT_TYPE.LOADING;
}
public void showNone() {
ProgressLayout.this.showNone(null);
}
public void showNone(OnClickListener retryListener) {
ProgressLayout.this.showNoneView(retryListener);
ProgressLayout.this.hideLoadingView();
ProgressLayout.this.hideNetErrorView();
ProgressLayout.this.hideFailedView();
ProgressLayout.this.<API key>(false);
this.currentState = LAYOUT_TYPE.NONE;
}
public void showNetError() {
ProgressLayout.this.showNetError(null);
}
public void showNetError(OnClickListener retryListener) {
ProgressLayout.this.showNetErrorView(retryListener);
ProgressLayout.this.hideLoadingView();
ProgressLayout.this.hideNoneView();
ProgressLayout.this.hideFailedView();
ProgressLayout.this.<API key>(false);
this.currentState = LAYOUT_TYPE.NETWORK_ERROR;
}
public void showFailed() {
ProgressLayout.this.showFailed(null);
}
public void showFailed(OnClickListener retryListener) {
ProgressLayout.this.showFailedView(retryListener);
ProgressLayout.this.hideLoadingView();
ProgressLayout.this.hideNoneView();
ProgressLayout.this.hideNetErrorView();
ProgressLayout.this.<API key>(false);
this.currentState = LAYOUT_TYPE.FAILED;
}
public void showContent() {
ProgressLayout.this.hideLoadingView();
ProgressLayout.this.hideNoneView();
ProgressLayout.this.hideNetErrorView();
ProgressLayout.this.hideFailedView();
ProgressLayout.this.<API key>(true);
this.currentState = LAYOUT_TYPE.CONTENT;
}
public LAYOUT_TYPE getCurrentState() {
return currentState;
}
private void showLoadingView() {
if (this.loadingContainer == null) {
if (loadingId == NOT_SET) {
throw new <API key>(
"cannot call showLoadingView() when loadingId was NO_SET which value is -1");
}
this.loadingContainer =
this.layoutInflater.inflate(loadingId, ProgressLayout.this, false);
this.loadingContainer.setTag(LOADING_TAG);
LayoutParams layoutParams = (LayoutParams) loadingContainer.getLayoutParams();
layoutParams.addRule(CENTER_IN_PARENT);
ProgressLayout.this.addView(loadingContainer, layoutParams);
} else {
this.loadingContainer.setVisibility(VISIBLE);
}
}
/**
*
*
* @param retryListener
*
*/
private void showNoneView(OnClickListener retryListener) {
if (this.noneContainer == null) {
if (noneId == NOT_SET) {
throw new <API key>(
"cannot call showNoneView() when noneId was NO_SET which value is -1");
}
this.noneContainer = this.layoutInflater.inflate(noneId, ProgressLayout.this, false);
this.noneContainer.setTag(NONE_TAG);
LayoutParams layoutParams = (LayoutParams) noneContainer.getLayoutParams();
layoutParams.addRule(CENTER_IN_PARENT);
ProgressLayout.this.addView(noneContainer, layoutParams);
if (retryListener != null) {
this.noneContainer.setClickable(true);
this.noneContainer.setOnClickListener(retryListener);
}
} else {
this.noneContainer.setVisibility(VISIBLE);
}
}
/**
*
*
* @param retryListener
*
*/
private void showNetErrorView(OnClickListener retryListener) {
if (this.<API key> == null) {
if (networkErrorId == NOT_SET) {
throw new <API key>(
"cannot call showNetErrorView() when networkErrorId was NO_SET which value is -1");
}
this.<API key> =
this.layoutInflater.inflate(networkErrorId, ProgressLayout.this, false);
this.<API key>.setTag(ERROR_TAG);
LayoutParams layoutParams = (LayoutParams) <API key>.getLayoutParams();
layoutParams.addRule(CENTER_IN_PARENT);
ProgressLayout.this.addView(<API key>, layoutParams);
if (retryListener != null) {
this.<API key>.setClickable(true);
this.<API key>.setOnClickListener(retryListener);
}
} else {
this.<API key>.setVisibility(VISIBLE);
}
}
/**
*
*
* @param retryListener
*
*/
private void showFailedView(OnClickListener retryListener) {
if (this.failedContainer == null) {
if (failedId == NOT_SET) {
throw new <API key>(
"cannot call showFailedView() when failedId was NO_SET which value is -1");
}
this.failedContainer =
this.layoutInflater.inflate(failedId, ProgressLayout.this, false);
this.failedContainer.setTag(ERROR_TAG);
LayoutParams layoutParams = (LayoutParams) failedContainer.getLayoutParams();
layoutParams.addRule(CENTER_IN_PARENT);
ProgressLayout.this.addView(failedContainer, layoutParams);
if (retryListener != null) {
this.failedContainer.setClickable(true);
this.failedContainer.setOnClickListener(retryListener);
}
} else {
this.failedContainer.setVisibility(VISIBLE);
}
}
private void hideLoadingView() {
if (loadingContainer != null && loadingContainer.getVisibility() != GONE) {
this.loadingContainer.setVisibility(GONE);
}
}
private void hideNoneView() {
if (noneContainer != null && noneContainer.getVisibility() != GONE) {
this.noneContainer.setVisibility(GONE);
}
}
private void hideNetErrorView() {
if (<API key> != null && <API key>.getVisibility() != GONE) {
this.<API key>.setVisibility(GONE);
}
}
private void hideFailedView() {
if (failedContainer != null && failedContainer.getVisibility() != GONE) {
this.failedContainer.setVisibility(GONE);
}
}
public boolean isLoading() {
return this.currentState == LAYOUT_TYPE.LOADING;
}
public boolean isContent() {
return this.currentState == LAYOUT_TYPE.CONTENT;
}
public boolean isNone() {
return this.currentState == LAYOUT_TYPE.NONE;
}
public boolean isNetworkError() {
return this.currentState == LAYOUT_TYPE.NETWORK_ERROR;
}
public boolean isFailed() {
return this.currentState == LAYOUT_TYPE.FAILED;
}
private void <API key>(boolean visible) {
for (View contentView : contentViews) {
contentView.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}
} |
package org.jtwig.json.provider;
import org.codehaus.jackson.map.ObjectMapper;
import org.jtwig.exceptions.<API key>;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.io.IOException;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class <API key> {
private final ObjectMapper objectMapper = mock(ObjectMapper.class);
private JacksonJsonMapper underTest = new JacksonJsonMapper(objectMapper);
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void applyWhenOk() throws Exception {
Object input = new Object();
String expected = "hello";
when(objectMapper.writeValueAsString(input)).thenReturn(expected);
String result = underTest.apply(input);
assertThat(result, is(expected));
}
@Test
public void applyWhenKo() throws Exception {
Object input = new Object();
when(objectMapper.writeValueAsString(input)).thenThrow(IOException.class);
expectedException.expect(<API key>.class);
expectedException.expectMessage(containsString("Unable to obtain json from object"));
underTest.apply(input);
}
} |
$hostname = $env:COMPUTERNAME
$nics = Gwmi <API key> -Comp $hostname | Where{($_.IPEnabled -eq "TRUE")}
foreach ($nic in $nics) {
foreach ($addr in $nic.IPAddress) {
if($addr -like "10.183.*")
{
Write-Host "This NIC is on RTP LAN"
$lastOctet = $addr.Split(".")[3]
Write-Host "Last octet: " $lastOctet
$xml = [xml](Get-Content C:\ProgramData\Cinegy\Multiviewer\MultiviewerCnfg.xml)
$rtpOutput = $xml.SelectSingleNode("/Settings/Output/RtpOutput")
#$rtpOutput.Url = "rtp://172.31.12.69:1$lastOctet"
$rtpOutput.Url = "rtp://239.183.3."+$lastOctet+":1234"
$xml.Save("C:\ProgramData\Cinegy\Multiviewer\MultiviewerCnfg.xml")
Restart-Service -Name MultiviewerSvc
}
}
} |
package org.eclipse.dd.dc.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.dd.dc.DcFactory;
import org.eclipse.dd.dc.DcPackage;
import org.eclipse.dd.dc.DocumentRoot;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.<API key>;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.<API key>;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.<API key>;
import org.eclipse.emf.edit.provider.<API key>;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.securebpmn2.provider.bpmn2EditPlugin;
/**
* This is the item provider adapter for a {@link org.eclipse.dd.dc.DocumentRoot} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class <API key> extends ItemProviderAdapter implements
<API key>, <API key>,
<API key>, IItemLabelProvider, IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public <API key>(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<<API key>> <API key>(Object object) {
if (<API key> == null) {
super.<API key>(object);
}
return <API key>;
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(
Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(DcPackage.Literals.<API key>);
childrenFeatures.add(DcPackage.Literals.DOCUMENT_ROOT__FONT);
childrenFeatures.add(DcPackage.Literals.<API key>);
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* This returns DocumentRoot.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object,
getResourceLocator().getImage("full/obj16/DocumentRoot"));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean <API key>() {
return true;
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
return getString("<API key>");
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(DocumentRoot.class)) {
case DcPackage.<API key>:
case DcPackage.DOCUMENT_ROOT__FONT:
case DcPackage.<API key>:
fireNotifyChanged(new ViewerNotification(notification,
notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void <API key>(
Collection<Object> newChildDescriptors, Object object) {
super.<API key>(newChildDescriptors, object);
newChildDescriptors.add(<API key>(
DcPackage.Literals.<API key>,
DcFactory.eINSTANCE.createBounds()));
newChildDescriptors.add(<API key>(
DcPackage.Literals.DOCUMENT_ROOT__FONT,
DcFactory.eINSTANCE.createFont()));
newChildDescriptors.add(<API key>(
DcPackage.Literals.<API key>,
DcFactory.eINSTANCE.createPoint()));
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return bpmn2EditPlugin.INSTANCE;
}
} |
<!DOCTYPE html>
<?php
require_once ('/var/www/html/app/model/connect.php');
require_once ('/var/www/html/app/library/function.php');
if(!isset($_SESSION['current_user_name']) && !isset($_COOKIE[$cookie_name])) {
header('Location: ../login.php');
exit();
}
$user_name = $_COOKIE["user"];
?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Zoo Tour | Guide</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="fonts/css/font-awesome.min.css" rel="stylesheet">
<link href="css/animate.min.css" rel="stylesheet">
<!-- Custom styling plus plugins -->
<link href="css/custom.css" rel="stylesheet">
<link href="css/icheck/flat/green.css" rel="stylesheet">
<!-- editor -->
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css" rel="stylesheet">
<link href="css/editor/external/<API key>/prettify.css" rel="stylesheet">
<link href="css/editor/index.css" rel="stylesheet">
<!-- select2 -->
<link href="css/select/select2.min.css" rel="stylesheet">
<!-- switchery -->
<link rel="stylesheet" href="css/switchery/switchery.min.css" />
<script src="js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="../assets/js/<API key>.js"></script>
<![endif]
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="index.php" class="site_title"><i class="fa fa-paw"></i> <span>Zoo Tour</span></a>
</div>
<div class="clearfix"></div>
<!-- menu prile quick info -->
<div class="profile">
<div class="profile_pic">
<img src="images/img.jpg" alt="..." class="img-circle profile_img">
</div>
<div class="profile_info">
<span>Welcome,</span>
<h2><?php echo $user_name; ?></h2>
</div>
</div>
<!-- /menu prile quick info -->
<br />
<!-- sidebar menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a><i class="fa fa-home"></i> Home <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li><a href="index.php">Zoo Tour</a>
<li><a href="../index.php">Admin Page</a>
</ul>
</li>
<li><a><i class="fa fa-edit"></i> Add Data <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li><a href="<API key>.php">Add Ticket Type</a>
</li>
<li><a href="add_tour_ticket.php">Add Ticket</a>
</li>
<li><a href="add_tour_promotion.php">Add Promotion</a>
</li>
<li><a href="add_tour_schedule.php">Add Schedule</a>
</li>
<li><a href="add_tour_driver.php">Add Driver</a>
</li>
<li><a href="add_tour_guide.php">Add Guide</a>
</li>
<li><a href="add_tour_vehicle.php">Add Vehicle</a>
</li>
</ul>
</li>
<li><a><i class="fa fa-desktop"></i> View Data <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu" style="display: none">
<li><a href="tour_ticket_type.php">Ticket Type</a>
</li>
<li><a href="tour_ticket.php">Ticket</a>
</li>
<li><a href="tour_promotion.php">Promotion</a>
</li>
<li><a href="tour_schedule.php">Schedule</a>
</li>
<li><a href="tour_driver.php">Driver</a>
</li>
<li><a href="tour_guide.php">Guide</a>
</li>
<li><a href="tour_vehicle.php">Vehicle</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- /sidebar menu -->
<!-- /menu footer buttons -->
<div class="sidebar-footer hidden-small">
<a data-toggle="tooltip" data-placement="top" title="Settings">
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
</a>
<a data-toggle="tooltip" data-placement="top" title="FullScreen">
<span class="glyphicon <API key>" aria-hidden="true"></span>
</a>
<a data-toggle="tooltip" data-placement="top" title="Lock">
<span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>
</a>
<a data-toggle="tooltip" data-placement="top" title="Logout">
<span class="glyphicon glyphicon-off" aria-hidden="true"></span>
</a>
</div>
<!-- /menu footer buttons -->
</div>
</div>
<!-- top navigation -->
<div class="top_nav">
<div class="nav_menu">
<nav class="" role="navigation">
<div class="nav toggle">
<a id="menu_toggle"><i class="fa fa-bars"></i></a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="images/img.jpg" alt=""><?php echo $user_name;?>
<span class=" fa fa-angle-down"></span>
</a>
<ul class="dropdown-menu dropdown-usermenu animated fadeInDown pull-right">
<li><a href="../index.php"><i class="fa fa-sign-out pull-right"></i>Back to Admin Page</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<!-- /top navigation -->
<!-- /top navigation -->
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Tour | Guide</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Guide</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form action="<API key>.php" method="POST" class="form-horizontal form-label-left">
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="type">Employee
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select class="form-control" name="empId" required="required">
<option value="">Choose..</option>
<?php
require_once ('/var/www/html/app/model/connect.php');
$conn = dbConnect();
$sqlEmployee = "SELECT E.EMPID, E.FIRSTNAME, E.LASTNAME FROM EMM_ZOO.EMPLOYEE E,EMM_ZOO.TOUR_GUIDE G WHERE E.EMPID <> G.EMPID";
$stmt = db2_prepare($conn, $sqlEmployee);
$result = db2_execute($stmt);
while ($row = db2_fetch_assoc($stmt)) {
$empId = $row['EMPID'];
$name = $row['FIRSTNAME']." ".$row['LASTNAME'];
?>
<option value="<?php echo $empId; ?>"><?php echo $name; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<!-- footer content -->
<footer>
<div class="">
<p class="pull-right">Copyright 2015. |
<span class="lead"> <i class="fa fa-paw"></i>Zoo Tour</span>
</p>
</div>
<div class="clearfix"></div>
</footer>
<!-- /footer content -->
</div>
</div>
</div>
<div id="<API key>" class="<API key> dsp_none">
<ul class="list-unstyled notifications clearfix" <API key>="notif-group">
</ul>
<div class="clearfix"></div>
<div id="notif-group" class="<API key>"></div>
</div>
<script src="js/bootstrap.min.js"></script>
<!-- chart js -->
<script src="js/chartjs/chart.min.js"></script>
<!-- bootstrap progress js -->
<script src="js/progressbar/<API key>.min.js"></script>
<script src="js/nicescroll/jquery.nicescroll.min.js"></script>
<!-- icheck -->
<script src="js/icheck/icheck.min.js"></script>
<!-- tags -->
<script src="js/tags/jquery.tagsinput.min.js"></script>
<!-- switchery -->
<script src="js/switchery/switchery.min.js"></script>
<!-- daterangepicker -->
<script type="text/javascript" src="js/moment.min2.js"></script>
<script type="text/javascript" src="js/datepicker/daterangepicker.js"></script>
<!-- richtext editor -->
<script src="js/editor/bootstrap-wysiwyg.js"></script>
<script src="js/editor/external/jquery.hotkeys.js"></script>
<script src="js/editor/external/<API key>/prettify.js"></script>
<!-- select2 -->
<script src="js/select/select2.full.js"></script>
<!-- form validation -->
<script type="text/javascript" src="js/parsley/parsley.min.js"></script>
<!-- textarea resize -->
<script src="js/textarea/autosize.min.js"></script>
<script>
autosize($('.resizable_textarea'));
</script>
<!-- Autocomplete -->
<script type="text/javascript" src="js/autocomplete/countries.js"></script>
<script src="js/autocomplete/jquery.autocomplete.js"></script>
<script type="text/javascript">
$(function () {
'use strict';
var countriesArray = $.map(countries, function (value, key) {
return {
value: value,
data: key
};
});
// Initialize autocomplete with custom appendTo:
$('#<API key>').autocomplete({
lookup: countriesArray,
appendTo: '#<API key>'
});
});
</script>
<script src="js/custom.js"></script>
<!-- select2 -->
<script>
$(document).ready(function () {
$(".select2_single").select2({
placeholder: "Select a state",
allowClear: true
});
$(".select2_group").select2({});
$(".select2_multiple").select2({
<API key>: 4,
placeholder: "With Max Selection limit 4",
allowClear: true
});
});
</script>
<!-- /select2 -->
<!-- input tags -->
<script>
function onAddTag(tag) {
alert("Added a tag: " + tag);
}
function onRemoveTag(tag) {
alert("Removed a tag: " + tag);
}
function onChangeTag(input, tag) {
alert("Changed a tag: " + tag);
}
$(function () {
$('#tags_1').tagsInput({
width: 'auto'
});
});
</script>
<!-- /input tags -->
<!-- form validation -->
<script type="text/javascript">
$(document).ready(function () {
$.listen('parsley:field:validate', function () {
validateFront();
});
$('#demo-form .btn').on('click', function () {
$('#demo-form').parsley().validate();
validateFront();
});
var validateFront = function () {
if (true === $('#demo-form').parsley().isValid()) {
$('.bs-callout-info').removeClass('hidden');
$('.bs-callout-warning').addClass('hidden');
} else {
$('.bs-callout-info').addClass('hidden');
$('.bs-callout-warning').removeClass('hidden');
}
};
});
$(document).ready(function () {
$.listen('parsley:field:validate', function () {
validateFront();
});
$('#demo-form2 .btn').on('click', function () {
$('#demo-form2').parsley().validate();
validateFront();
});
var validateFront = function () {
if (true === $('#demo-form2').parsley().isValid()) {
$('.bs-callout-info').removeClass('hidden');
$('.bs-callout-warning').addClass('hidden');
} else {
$('.bs-callout-info').addClass('hidden');
$('.bs-callout-warning').removeClass('hidden');
}
};
});
try {
hljs.<API key>();
} catch (err) {}
</script>
<!-- /form validation -->
<!-- editor -->
<script>
$(document).ready(function () {
$('.xcxc').click(function () {
$('#descr').val($('#editor').html());
});
});
$(function () {
function <API key>() {
var fonts = ['Serif', 'Sans', 'Arial', 'Arial Black', 'Courier',
'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', 'Lucida Sans', 'Tahoma', 'Times',
'Times New Roman', 'Verdana'],
fontTarget = $('[title=Font]').siblings('.dropdown-menu');
$.each(fonts, function (idx, fontName) {
fontTarget.append($('<li><a data-edit="fontName ' + fontName + '" style="font-family:\'' + fontName + '\'">' + fontName + '</a></li>'));
});
$('a[title]').tooltip({
container: 'body'
});
$('.dropdown-menu input').click(function () {
return false;
})
.change(function () {
$(this).parent('.dropdown-menu').siblings('.dropdown-toggle').dropdown('toggle');
})
.keydown('esc', function () {
this.value = '';
$(this).change();
});
$('[data-role=magic-overlay]').each(function () {
var overlay = $(this),
target = $(overlay.data('target'));
overlay.css('opacity', 0).css('position', 'absolute').offset(target.offset()).width(target.outerWidth()).height(target.outerHeight());
});
if ("<API key>" in document.createElement("input")) {
var editorOffset = $('#editor').offset();
$('#voiceBtn').css('position', 'absolute').offset({
top: editorOffset.top,
left: editorOffset.left + $('#editor').innerWidth() - 35
});
} else {
$('#voiceBtn').hide();
}
};
function showErrorAlert(reason, detail) {
var msg = '';
if (reason === '<API key>') {
msg = "Unsupported format " + detail;
} else {
console.log("error uploading file", reason, detail);
}
$('<div class="alert"> <button type="button" class="close" data-dismiss="alert">×</button>' +
'<strong>File upload error</strong> ' + msg + ' </div>').prependTo('#alerts');
};
<API key>();
$('#editor').wysiwyg({
fileUploadError: showErrorAlert
});
window.prettyPrint && prettyPrint();
});
</script>
<!-- /editor -->
</body>
</html> |
package com.jug6ernaut.debugdrawer.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
public class ExpandableView extends LinearLayout {
public final TextView titleView;
public final ViewGroup content;
private <API key> stateChangeListener;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public ExpandableView(Context context, TextView titleView, final ViewGroup content) {
super(context);
this.titleView = titleView;
this.content = content;
this.setOrientation(VERTICAL);
this.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
this.addView(titleView);
this.addView(content);
titleView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(content.getVisibility() == GONE) {
content.setVisibility(VISIBLE);
} else {
content.setVisibility(GONE);
}
if(stateChangeListener != null)stateChangeListener.onStateChanged(isExpanded());
}
});
}
public boolean isExpanded() {
return content.getVisibility() == View.VISIBLE;
}
public void <API key>(<API key> oscl) {
this.stateChangeListener = oscl;
}
public static interface <API key> {
void onStateChanged(boolean expanded);
}
} |
import Vue from 'vue';
import Hello from '@/components/Greeting';
describe('Greeting.vue', () => {
it('should render correct contents', () => {
const Constructor = Vue.extend(Hello);
const vm = new Constructor().$mount();
expect(vm.$el.querySelector('#greeting h1').textContent)
.to.equal('Welcome');
});
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.