3636import com .codename1 .ui .layouts .Layout ;
3737import com .codename1 .ui .plaf .Style ;
3838import com .codename1 .ui .plaf .UIManager ;
39- import com .codename1 .ui .util .Resources ;
39+ import com .codename1 .ui .util .Resources ;
40+ import com .codename1 .compat .java .util .Objects ;
4041
4142import java .util .Vector ;
4243
@@ -346,7 +347,7 @@ public void actionPerformed(ActionEvent evt) {
346347 if (p == null ) {
347348 //has left menu
348349 hasSideMenus [0 ] = true ;
349- } else if (p .equals (COMMAND_PLACEMENT_VALUE_RIGHT )) {
350+ } else if (COMMAND_PLACEMENT_VALUE_RIGHT .equals (p )) {
350351 //has right menu
351352 hasSideMenus [1 ] = true ;
352353 }
@@ -830,7 +831,7 @@ private void addOpenButton(Command cmd, boolean checkCommands) {
830831 }
831832
832833 private void validateCommandPlacement (String placement ) {
833- if (placement == COMMAND_PLACEMENT_VALUE_TOP ) {
834+ if (COMMAND_PLACEMENT_VALUE_TOP . equals ( placement ) ) {
834835 ((BorderLayout ) getTitleAreaContainer ().getLayout ()).setCenterBehavior (BorderLayout .CENTER_BEHAVIOR_SCALE );
835836 if (!(getTitleComponent () instanceof Button )) {
836837 Button b = new Button (parent .getTitle ());
@@ -844,7 +845,7 @@ public void actionPerformed(ActionEvent evt) {
844845 }
845846 return ;
846847 }
847- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
848+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
848849 if (rightSideButton != null && rightSideButton .getParent () != null ) {
849850 return ;
850851 }
@@ -886,7 +887,7 @@ private void clean() {
886887
887888 private void setMenuGlassPane (Form m , final String placement ) {
888889 boolean isRTLValue = m .isRTL ();
889- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
890+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
890891 isRTLValue = !isRTLValue ;
891892 }
892893 final boolean isRTL = isRTLValue ;
@@ -1027,7 +1028,7 @@ Container createSideNavigationPanel(Vector commands, String placement) {
10271028
10281029 for (int iter = commands .size () - 1 ; iter > -1 ; iter --) {
10291030 Command c = (Command ) commands .elementAt (iter );
1030- if (c .getClientProperty (COMMAND_PLACEMENT_KEY ) != placement ) {
1031+ if (! Objects . equals ( c .getClientProperty (COMMAND_PLACEMENT_KEY ), placement ) ) {
10311032 continue ;
10321033 }
10331034 Component cmp = (Component ) c .getClientProperty (COMMAND_SIDE_COMPONENT );
@@ -1056,7 +1057,7 @@ Container createSideNavigationPanel(Vector commands, String placement) {
10561057 }
10571058 }
10581059 boolean isRTLValue = isRTL ();
1059- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
1060+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
10601061 isRTLValue = !isRTLValue ;
10611062 }
10621063 UIManager uim = menu .getUIManager ();
@@ -1081,12 +1082,12 @@ Container createSideNavigationPanel(Vector commands, String placement) {
10811082 shadowLabel .getStyle ().setMargin (0 , 0 , 0 , 0 );
10821083 shadowLabel .getStyle ().setBgTransparency (0 );
10831084 Container c = new Container (new BorderLayout ());
1084- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
1085+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
10851086 shadowLabel .setPreferredW (shadow .getWidth ());
10861087 c .addComponent (BorderLayout .WEST , shadowLabel );
10871088 shadowLabel .getStyle ().setBgImage (shadow .rotate180Degrees (true ));
10881089 } else {
1089- if (placement == COMMAND_PLACEMENT_VALUE_TOP ) {
1090+ if (COMMAND_PLACEMENT_VALUE_TOP . equals ( placement ) ) {
10901091 //shadowLabel.setPreferredH(shadow.getHeight());
10911092 //c.addComponent(BorderLayout.SOUTH, shadowLabel);
10921093 //shadowLabel.getStyle().setBgImage(shadow.rotate90Degrees(true));
@@ -1377,7 +1378,7 @@ public void paint(Graphics g) {
13771378 };
13781379 }
13791380
1380- if (placement == COMMAND_PLACEMENT_VALUE_TOP ) {
1381+ if (COMMAND_PLACEMENT_VALUE_TOP . equals ( placement ) ) {
13811382 int v = 0 ;
13821383 if (Display .getInstance ().isPortrait ()) {
13831384 if (Display .getInstance ().isTablet ()) {
@@ -1427,7 +1428,7 @@ public void paint(Graphics g) {
14271428 } else {
14281429 v = getUIManager ().getThemeConstant ("sideMenuSizePortraitInt" , -1 );
14291430 if (v < 0 ) {
1430- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
1431+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
14311432 if (isRTL ()) {
14321433 v = openButton .getWidth ();
14331434 } else {
@@ -1466,11 +1467,11 @@ public void paint(Graphics g) {
14661467 sidePanel = null ;
14671468 }
14681469 sidePanel = createSideNavigationComponent (getCommands (), placement );
1469- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
1470+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
14701471 m .addComponent (BorderLayout .WEST , rightPanel );
14711472 m .addComponent (BorderLayout .CENTER , sidePanel );
14721473 } else {
1473- if (placement == COMMAND_PLACEMENT_VALUE_TOP ) {
1474+ if (COMMAND_PLACEMENT_VALUE_TOP . equals ( placement ) ) {
14741475 m .addComponent (BorderLayout .NORTH , rightPanel );
14751476 m .addComponent (BorderLayout .CENTER , sidePanel );
14761477 Button button = new Button (" " );
@@ -1547,7 +1548,7 @@ public MenuTransition(int speed, boolean fwd, int dest, String placement) {
15471548
15481549 public void initTransition () {
15491550 super .initTransition ();
1550- if (placement == COMMAND_PLACEMENT_VALUE_TOP ) {
1551+ if (COMMAND_PLACEMENT_VALUE_TOP . equals ( placement ) ) {
15511552 if (Display .getInstance ().areMutableImagesFast ()) {
15521553 if (fwd ) {
15531554 buffer = updateRightPanelBgImage (placement , getSource ());
@@ -1576,7 +1577,7 @@ public void initTransition() {
15761577 }
15771578 } else {
15781579 isRTL = (getSource ().getUIManager ().getLookAndFeel ().isRTL ());
1579- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
1580+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
15801581 isRTL = !isRTL ;
15811582 }
15821583 if (Display .getInstance ().areMutableImagesFast ()) {
@@ -1618,7 +1619,7 @@ public void initTransition() {
16181619 shadow = Resources .getSystemResource ().getImage ("sidemenu-shadow.png" );
16191620 }
16201621 boolean isRTLValue = isRTL ();
1621- if (placement == COMMAND_PLACEMENT_VALUE_RIGHT ) {
1622+ if (COMMAND_PLACEMENT_VALUE_RIGHT . equals ( placement ) ) {
16221623 isRTLValue = !isRTLValue ;
16231624 }
16241625 if (isRTLValue ) {
@@ -1658,7 +1659,7 @@ public void paint(Graphics g) {
16581659 }
16591660 Component src = getSource ();
16601661 Component dest = getDestination ();
1661- if (placement == COMMAND_PLACEMENT_VALUE_TOP ) {
1662+ if (COMMAND_PLACEMENT_VALUE_TOP . equals ( placement ) ) {
16621663 if (Display .getInstance ().areMutableImagesFast ()) {
16631664 if (fwd ) {
16641665 dest .paintComponent (g , true );
0 commit comments