@ -54,8 +54,6 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
private UIObserverListener uiObserverListener ;
private UIObserverListener uiObserverListener ;
private boolean autoFireStateChanged = true ;
private boolean autoFireStateChanged = true ;
private boolean inToolbar = false ;
public UIButtonGroup ( String [ ] textArray ) {
public UIButtonGroup ( String [ ] textArray ) {
this ( textArray , null ) ;
this ( textArray , null ) ;
}
}
@ -101,6 +99,7 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
} ;
} ;
initButton ( labelButton , index ) ;
initButton ( labelButton , index ) ;
}
}
setBorder ( new FineRoundBorder ( ) ) ;
initLayout ( getCols ( ) ) ;
initLayout ( getCols ( ) ) ;
}
}
@ -109,7 +108,6 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
}
}
public UIButtonGroup ( Icon [ ] [ ] iconArray , T [ ] objects , boolean inToolbar ) {
public UIButtonGroup ( Icon [ ] [ ] iconArray , T [ ] objects , boolean inToolbar ) {
this . inToolbar = inToolbar ;
if ( ! ArrayUtils . isEmpty ( objects ) & & iconArray . length = = objects . length ) {
if ( ! ArrayUtils . isEmpty ( objects ) & & iconArray . length = = objects . length ) {
this . objectList = Arrays . asList ( objects ) ;
this . objectList = Arrays . asList ( objects ) ;
}
}
@ -142,7 +140,8 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
} ;
} ;
initButton ( labelButton , index ) ;
initButton ( labelButton , index ) ;
}
}
initLayout ( getCols ( ) ) ;
setForToolBarButtonGroup ( inToolbar ) ;
initLayout ( getCols ( ) , inToolbar ) ;
}
}
public UIButtonGroup ( String [ ] textArray , T [ ] objects ) {
public UIButtonGroup ( String [ ] textArray , T [ ] objects ) {
@ -177,6 +176,7 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
} ;
} ;
initButton ( labelButton , index ) ;
initButton ( labelButton , index ) ;
}
}
setBorder ( new FineRoundBorder ( ) ) ;
initLayout ( getCols ( ) ) ;
initLayout ( getCols ( ) ) ;
}
}
@ -194,13 +194,17 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
return new int [ ] { totalButtonSize } ;
return new int [ ] { totalButtonSize } ;
}
}
protected void initLayout ( int [ ] cols ) {
private void initLayout ( int [ ] cols ) {
initLayout ( cols , false ) ;
}
protected void initLayout ( int [ ] cols , boolean inToolbar ) {
int currentIndex = 0 ;
int currentIndex = 0 ;
for ( int row = 0 ; row < cols . length ; row + + ) {
for ( int row = 0 ; row < cols . length ; row + + ) {
int col = cols [ row ] ;
int col = cols [ row ] ;
Row rowContainer = new Row ( ) ;
Row rowContainer = new Row ( ) ;
for ( int j = 0 ; j < col ; j + + ) {
for ( int j = 0 ; j < col ; j + + ) {
rowContainer . add ( cell ( labelButtonList . get ( currentIndex ) ) . weight ( 1 . 0 ) ) ;
rowContainer . add ( cell ( getLabelButtonList ( ) . get ( currentIndex ) ) . weight ( 1 . 0 ) ) ;
currentIndex + + ;
currentIndex + + ;
if ( j ! = col - 1 & & ! inToolbar ) {
if ( j ! = col - 1 & & ! inToolbar ) {
rowContainer . add ( createDivider ( ) ) ;
rowContainer . add ( createDivider ( ) ) ;
@ -213,6 +217,10 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
}
}
}
}
private List < UIToggleButton > getLabelButtonList ( ) {
return labelButtonList ;
}
private Spacer createDivider ( ) {
private Spacer createDivider ( ) {
Spacer spacer = new Spacer ( FineUIScale . scale ( 1 ) ) ;
Spacer spacer = new Spacer ( FineUIScale . scale ( 1 ) ) ;
spacer . setBorder ( new LineBorder ( FineUIUtils . getUIColor ( "defaultBorderColor" , "Component.borderColor" ) ) ) ;
spacer . setBorder ( new LineBorder ( FineUIUtils . getUIColor ( "defaultBorderColor" , "Component.borderColor" ) ) ) ;
@ -265,20 +273,16 @@ public class UIButtonGroup<T> extends Column implements GlobalNameObserver, UIOb
isClick = changeFlag ;
isClick = changeFlag ;
}
}
public void setForToolBarButtonGroup ( boolean isToolBarComponent ) {
private void setForToolBarButtonGroup ( boolean inToolbar ) {
if ( isToolBarComponent ) {
if ( inToolbar ) {
inToolbar = true ;
for ( UIToggleButton button : labelButtonList ) {
for ( UIToggleButton button : labelButtonList ) {
button . putClientProperty ( BUTTON_TYPE , BUTTON_TYPE_TOOLBAR_BUTTON ) ;
button . putClientProperty ( BUTTON_TYPE , BUTTON_TYPE_TOOLBAR_BUTTON ) ;
FineUIStyle . setStyle ( button , IN_TOOLBAR_GROUP ) ;
FineUIStyle . setStyle ( button , IN_TOOLBAR_GROUP ) ;
button . setBorderPainted ( false ) ;
button . setBorderPainted ( false ) ;
}
}
} else {
setBorder ( new FineRoundBorder ( ) ) ;
}
}
repaint ( ) ;
}
public boolean isInToolbar ( ) {
return inToolbar ;
}
}
@Override
@Override