Update CheckBox.java

static protected final Class<?>[] CFA = { float[].class };
This commit is contained in:
GoToLoop 2016-07-17 10:53:05 -03:00 committed by GitHub
parent 192dd048e2
commit a71c65023a
1 changed files with 13 additions and 14 deletions

View File

@ -57,10 +57,12 @@ public class CheckBox extends ControlGroup< CheckBox > {
protected int itemWidth = 9; protected int itemWidth = 9;
protected boolean noneSelectedAllowed = true; protected boolean noneSelectedAllowed = true;
protected boolean isMultipleChoice; protected boolean isMultipleChoice = true;
protected Object _myPlug; protected Object _myPlug;
protected String _myPlugName; protected String _myPlugName = "";
static protected final Class<?>[] CFA = { float[].class };
/** /**
* Convenience constructor to extend CheckBox. * Convenience constructor to extend CheckBox.
@ -88,10 +90,8 @@ public class CheckBox extends ControlGroup< CheckBox > {
String theName , int theX , int theY ) { String theName , int theX , int theY ) {
super( theControlP5 , theParent , theName , theX , theY , 99 , 9 ); super( theControlP5 , theParent , theName , theX , theY , 99 , 9 );
isCollapse = isBarVisible = false; isCollapse = isBarVisible = false;
isMultipleChoice = true;
setItemsPerRow( 1 ); setItemsPerRow( 1 );
if ( ControllerPlug.checkPlug( cp5.papplet , _myPlugName = getName( ) , if ( ControllerPlug.checkPlug( cp5.papplet , _myPlugName = getName( ) , CFA ) _myPlug = cp5.papplet;
new Class[] { float[].class } ) ) _myPlug = cp5.papplet;
} }
public CheckBox activateAll( ) { public CheckBox activateAll( ) {
@ -315,7 +315,7 @@ public class CheckBox extends ControlGroup< CheckBox > {
*/ */
public CheckBox setItemHeight( final int theItemHeight ) { public CheckBox setItemHeight( final int theItemHeight ) {
itemHeight = theItemHeight; itemHeight = theItemHeight;
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
for ( final Toggle tog : _myRadioToggles ) tog.setHeight( theItemHeight ); for ( final Toggle tog : _myRadioToggles ) tog.setHeight( theItemHeight );
} }
return updateLayout( ); return updateLayout( );
@ -330,7 +330,7 @@ public class CheckBox extends ControlGroup< CheckBox > {
*/ */
public CheckBox setItemWidth( final int theItemWidth ) { public CheckBox setItemWidth( final int theItemWidth ) {
itemWidth = theItemWidth; itemWidth = theItemWidth;
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
for ( final Toggle tog : _myRadioToggles ) tog.setWidth( theItemWidth ); for ( final Toggle tog : _myRadioToggles ) tog.setWidth( theItemWidth );
} }
return updateLayout( ); return updateLayout( );
@ -379,7 +379,7 @@ public class CheckBox extends ControlGroup< CheckBox > {
* @exclude * @exclude
*/ */
public CheckBox updateLayout( ) { public CheckBox updateLayout( ) {
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
int nn = 0 , xx = 0 , yy = 0; int nn = 0 , xx = 0 , yy = 0;
for ( final Toggle tog : _myRadioToggles ) { for ( final Toggle tog : _myRadioToggles ) {
set( tog.position , xx , yy ); set( tog.position , xx , yy );
@ -465,8 +465,7 @@ public class CheckBox extends ControlGroup< CheckBox > {
} }
public CheckBox plugTo( final Object theObject ) { public CheckBox plugTo( final Object theObject ) {
_myPlug = ControllerPlug.checkPlug( theObject , _myPlugName , new Class[] { float[].class } ) _myPlug = ControllerPlug.checkPlug( theObject , _myPlugName , CFA ) ? theObject : null;
? theObject : null;
return this; return this;
} }
@ -487,28 +486,28 @@ public class CheckBox extends ControlGroup< CheckBox > {
} }
public CheckBox setColorLabels( final int theColor ) { public CheckBox setColorLabels( final int theColor ) {
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).setColor( theColor ); for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).setColor( theColor );
} }
return this; return this;
} }
public CheckBox hideLabels( ) { public CheckBox hideLabels( ) {
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).setVisible( false ); for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).setVisible( false );
} }
return this; return this;
} }
public CheckBox showLabels( ) { public CheckBox showLabels( ) {
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).setVisible( true ); for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).setVisible( true );
} }
return this; return this;
} }
public CheckBox toUpperCase( boolean theValue ) { public CheckBox toUpperCase( boolean theValue ) {
if ( !_myRadioToggles.isEmpty( ) ) synchronized ( _myRadioToggles ) { synchronized ( _myRadioToggles ) {
for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).toUpperCase( theValue ); for ( final Toggle tog : _myRadioToggles ) tog.getCaptionLabel( ).toUpperCase( theValue );
} }
return this; return this;