controlp5/reference/controlP5/ControllerProperty.html

457 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Sun Apr 27 21:39:47 SGT 2014 -->
<title>ControllerProperty (Javadocs: controlP5)</title>
<meta name="date" content="2014-04-27">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ControllerProperty (Javadocs: controlP5)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../controlP5/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</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><a href="../controlP5/ControllerProperties.html" title="class in controlP5"><span class="strong">Prev Class</span></a></li>
<li><a href="../controlP5/ControllerStyle.html" title="class in controlP5"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?controlP5/ControllerProperty.html" target="_top">Frames</a></li>
<li><a href="ControllerProperty.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">controlP5</div>
<h2 title="Class ControllerProperty" class="title">Class ControllerProperty</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>controlP5.ControllerProperty</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, java.lang.Cloneable</dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">ControllerProperty</span>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable</pre>
<div class="block">A controller property saves the value, address, getter and setter of a registered controller.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../serialized-form.html#controlP5.ControllerProperty">Serialized Form</a></dd><script type="text/javascript">
<!--
document.getElementsByTagName('html')[0].className = 'isjs';function toggle(dt) { var display, dd=dt; do{ dd = dd.nextSibling } while(dd.tagName!='DD'); toOpen =!dd.style.display;dd.style.display = toOpen? 'block':''; dt.getElementsByTagName('span')[0].innerHTML = toOpen? '-':'+' ; }
-->
</script>
<div id="test" class="toggleList"><dl><dt onclick="toggle(this);"><span>+</span>Example</dt><dd><code><pre>/**
* ControlP5 Properties
*
*
* saves controller values to a properties-file
* loads controller values from a properties-file
*
* Properties will only save values not the Controller itself.
*
* Also take a look at the use/ControlP5snapshot example to
* save controller values to memory.
*
* Use ControllerProperties to load and save serialized controller properties
* to a properties file.
* The controllers implementing save/load properties so far are
* Slider, Knob, Numberbox, Toggle, Checkbox, RadioButton, Textlabel,
* Matrix, Range, Textarea, ListBox, Dropdown, ColorPicker.
* Properties are currently saved in the java serialization format.
*
* saveProperties(String theFilename) and loadProperties(String theFilename)
* by default properties will be saved to your sketch folder as controlP5.ser
* if that file already exists it will be overwritten. for custom property files
* see the comments inside keyPressed() below.
*
* find a list of public methods available for the ControllerProperties class
* at the bottom of this sketch's source code
*
* default properties load/save key combinations are
* alt+shift+l to load properties
* alt+shift+s to save properties
*
* by andreas schlegel, 2012
* www.sojamo.de/libraries/controlp5
*
*/
import controlP5.*;
ControlP5 cp5;
public int myColor = color(0, 0, 0);
public int sliderValue = 100;
public int sliderTicks1 = 100;
public int sliderTicks2 = 30;
void setup() {
size(700, 400);
noStroke();
cp5 = new ControlP5(this);
cp5.addSlider("slider")
.setBroadcast(false)
.setRange(0, 200)
.setPosition(20, 100)
.setSize(10, 100)
.setBroadcast(true)
.setValue(100)
;
cp5.addSlider("sliderTicks1")
.setRange(0, 255)
.setPosition(100, 100)
.setSize(10, 100)
.setNumberOfTickMarks(5)
;
cp5.addSlider("sliderValue")
.setRange(0, 255)
.setValue(128)
.setPosition(200, 180)
.setSize(100, 10)
;
cp5.addSlider("sliderTicks2")
.setRange(0, 255)
.setValue(128)
.setPosition(200, 220)
.setSize(100, 10)
.setNumberOfTickMarks(7)
.setSliderMode(Slider.FLEXIBLE)
;
}
void draw() {
background(sliderTicks1);
fill(sliderValue);
rect(0, 0, width, 100);
fill(myColor);
rect(0, 300, width, 70);
fill(sliderTicks2);
rect(0, 370, width, 30);
}
public void slider(float theColor) {
myColor = color(theColor);
println("a slider event. setting background to "+theColor);
}
void keyPressed() {
// default properties load/save key combinations are
// alt+shift+l to load properties
// alt+shift+s to save properties
if (key=='1') {
cp5.saveProperties(("hello.properties"));
}
else if (key=='2') {
cp5.loadProperties(("hello.properties"));
}
}
/*
a list of all methods available for the ControllerProperties Controller
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
to print the following list into the console.
You can find further details about class ControllerProperties in the javadoc.
Format:
ClassName : returnType methodName(parameter type)
controlP5.ControllerProperties : ArrayList getSnapshotIndices()
controlP5.ControllerProperties : ControllerProperties addSet(String)
controlP5.ControllerProperties : ControllerProperties delete(ControllerProperty)
controlP5.ControllerProperties : ControllerProperties getSnapshot(String)
controlP5.ControllerProperties : ControllerProperties move(ControllerInterface, String, String)
controlP5.ControllerProperties : ControllerProperties move(ControllerProperty, String, String)
controlP5.ControllerProperties : ControllerProperties only(ControllerProperty, String)
controlP5.ControllerProperties : ControllerProperties print()
controlP5.ControllerProperties : ControllerProperties register(ControllerInterface, String)
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
controlP5.ControllerProperties : ControllerProperties removeSnapshot(String)
controlP5.ControllerProperties : ControllerProperties saveSnapshot(String)
controlP5.ControllerProperties : ControllerProperties saveSnapshotAs(String, String)
controlP5.ControllerProperties : ControllerProperties setSnapshot(String)
controlP5.ControllerProperties : ControllerProperties updateSnapshot(String)
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
controlP5.ControllerProperties : List get(ControllerInterface)
controlP5.ControllerProperties : Map get()
controlP5.ControllerProperties : String toString()
controlP5.ControllerProperties : boolean load()
controlP5.ControllerProperties : boolean load(String)
controlP5.ControllerProperties : boolean save()
controlP5.ControllerProperties : boolean saveAs(String)
controlP5.ControllerProperties : void setFormat(Format)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
*/
</pre></code></dd></dl></div></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../controlP5/ControllerProperty.html#disable()">disable</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../controlP5/ControllerProperty.html#enable()">enable</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../controlP5/ControllerProperty.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object&nbsp;o)</code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../controlP5/ControllerProperty.html#hashCode()">hashCode</a></strong>()</code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../controlP5/ControllerProperty.html#toString()">toString</a></strong>()</code>&nbsp;</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>getClass, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="disable()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>disable</h4>
<pre>public&nbsp;void&nbsp;disable()</pre>
</li>
</ul>
<a name="enable()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>enable</h4>
<pre>public&nbsp;void&nbsp;enable()</pre>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre>public&nbsp;boolean&nbsp;equals(java.lang.Object&nbsp;o)</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>equals</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>public&nbsp;int&nbsp;hashCode()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>hashCode</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;java.lang.String&nbsp;toString()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../controlP5/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</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><a href="../controlP5/ControllerProperties.html" title="class in controlP5"><span class="strong">Prev Class</span></a></li>
<li><a href="../controlP5/ControllerStyle.html" title="class in controlP5"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?controlP5/ControllerProperty.html" target="_top">Frames</a></li>
<li><a href="ControllerProperty.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>processing library controlP5 by Andreas Schlegel. (c) 2006-2014</small></p>
</body>
</html>