Skip to content

Commit 8628ad9

Browse files
committed
Further fixes
1 parent add990c commit 8628ad9

File tree

10 files changed

+393
-259
lines changed

10 files changed

+393
-259
lines changed

CodenameOne/src/com/codename1/components/ImageViewer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ public Image getImage() {
779779
*
780780
* @param image the image to set
781781
*/
782-
public void setImage(Image image) {
782+
public final void setImage(Image image) {
783783
if (this.image != image) {
784784
panPositionX = 0.5f;
785785
panPositionY = 0.5f;

CodenameOne/src/com/codename1/components/ShareButton.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public ShareButton() {
7373
//Image shareIcon = Resources.getSystemResource().getImage("share.png");
7474
//setIcon(shareIcon);
7575
FontImage.setMaterialIcon(this, FontImage.MATERIAL_SHARE);
76-
addActionListener(this);
76+
super.addActionListener(this);
7777
shareServices.addElement(new SMSShare());
7878
shareServices.addElement(new EmailShare());
7979
shareServices.addElement(new FacebookShare());

CodenameOne/src/com/codename1/components/SignatureComponent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ public void paint(Graphics g) {
126126
* Creates a new signature component.
127127
*/
128128
public SignatureComponent() {
129-
setLayout(new BorderLayout());
129+
super.setLayout(new BorderLayout());
130130
xFont = Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);
131-
final Style signatureButtonBoxStyle = getUIManager().getComponentStyle("SignatureButtonBox");
131+
final Style signatureButtonBoxStyle = super.getUIManager().getComponentStyle("SignatureButtonBox");
132132
lead = new Button() {
133133

134134
@Override

CodenameOne/src/com/codename1/components/SpanLabel.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public SpanLabel(String txt, String textUiid) {
8181
*/
8282
public SpanLabel(String txt) {
8383
setUIIDFinal("Container");
84-
setLayout(new BorderLayout());
84+
super.setLayout(new BorderLayout());
8585
text = new TextArea(getUIManager().localize(txt, txt));
8686
text.setActAsLabel(true);
8787
text.setColumns(text.getText().length() + 1);
@@ -94,8 +94,8 @@ public SpanLabel(String txt) {
9494
iconWrapper = new Container(new FlowLayout(CENTER, CENTER));
9595
iconWrapper.getAllStyles().stripMarginAndPadding();
9696
iconWrapper.add(icon);
97-
addComponent(BorderLayout.WEST, iconWrapper);
98-
addComponent(BorderLayout.CENTER, BoxLayout.encloseYCenter(text));
97+
super.addComponent(BorderLayout.WEST, iconWrapper);
98+
super.addComponent(BorderLayout.CENTER, BoxLayout.encloseYCenter(text));
9999
updateGap();
100100
}
101101

CodenameOne/src/com/codename1/components/SplitPane.java

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,53 +1020,43 @@ public void actionPerformed(ActionEvent evt) {
10201020

10211021
boolean isDesktop = CN.isDesktop();
10221022

1023-
LayeredLayout l = (LayeredLayout) getLayout();
1024-
switch (orientation) {
1025-
case HORIZONTAL_SPLIT: {
1026-
l.setInsets(btnCollapse, "0 0 auto 0")
1027-
.setInsets(btnExpand, "0 0 auto 0")
1028-
.setInsets(dragHandle, "auto auto auto auto")
1029-
.setReferenceComponentTop(btnExpand, btnCollapse, 1f);
1030-
if (!isDesktop) {
1031-
// On tablets and phones it is difficult to use the collapse
1032-
// expand buttons when they are adjacent.
1033-
// On these devices we'll place them at opposite ends of the divider
1034-
l.setInsets(btnExpand, "auto 0 0 0")
1035-
.setReferenceComponentTop(btnExpand, null, 1f);
1036-
}
1037-
break;
1023+
LayeredLayout l = (LayeredLayout) super.getLayout();
1024+
if (orientation == HORIZONTAL_SPLIT) {
1025+
l.setInsets(btnCollapse, "0 0 auto 0")
1026+
.setInsets(btnExpand, "0 0 auto 0")
1027+
.setInsets(dragHandle, "auto auto auto auto")
1028+
.setReferenceComponentTop(btnExpand, btnCollapse, 1f);
1029+
if (!isDesktop) {
1030+
// On tablets and phones it is difficult to use the collapse
1031+
// expand buttons when they are adjacent.
1032+
// On these devices we'll place them at opposite ends of the divider
1033+
l.setInsets(btnExpand, "auto 0 0 0")
1034+
.setReferenceComponentTop(btnExpand, null, 1f);
10381035
}
1039-
default: {
1040-
l.setInsets(btnCollapse, "0 auto 0 0")
1041-
.setInsets(btnExpand, "0 auto 0 0")
1042-
.setInsets(dragHandle, "auto auto auto auto")
1043-
.setReferenceComponentLeft(btnExpand, btnCollapse, 1f);
1044-
if (!isDesktop) {
1045-
// On tablets and phones it is difficult to use the collapse
1046-
// expand buttons when they are adjacent.
1047-
// On these devices we'll place them at opposite ends of the divider
1048-
l.setInsets(btnExpand, "0 0 0 auto")
1049-
.setReferenceComponentLeft(btnExpand, null, 1f);
1050-
}
1036+
} else {
1037+
l.setInsets(btnCollapse, "0 auto 0 0")
1038+
.setInsets(btnExpand, "0 auto 0 0")
1039+
.setInsets(dragHandle, "auto auto auto auto")
1040+
.setReferenceComponentLeft(btnExpand, btnCollapse, 1f);
1041+
if (!isDesktop) {
1042+
// On tablets and phones it is difficult to use the collapse
1043+
// expand buttons when they are adjacent.
1044+
// On these devices we'll place them at opposite ends of the divider
1045+
l.setInsets(btnExpand, "0 0 0 auto")
1046+
.setReferenceComponentLeft(btnExpand, null, 1f);
10511047
}
10521048
}
10531049

10541050
if (dividerUIID == null) {
10551051
$(this)
10561052
.setBorder(createBorder())
10571053
.setCursor(getDragCursor())
1058-
.setDraggable(true)
1059-
1060-
;
1054+
.setDraggable(true);
10611055
} else {
10621056
$(this)
10631057
.setCursor(getDragCursor())
1064-
.setDraggable(true)
1065-
1066-
;
1058+
.setDraggable(true);
10671059
}
1068-
1069-
10701060
}
10711061

10721062
private char getCollapseMaterialIcon() {

CodenameOne/src/com/codename1/components/SwitchList.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,7 @@ protected Component createButton(Object model) {
7373

7474
@Override
7575
protected void setSelected(Component button, final boolean selected) {
76-
$(".switch", button).each(new ComponentSelector.ComponentClosure() {
77-
@Override
78-
public void call(Component c) {
79-
if (selected) {
80-
((Switch) c).setOn();
81-
} else {
82-
((Switch) c).setOff();
83-
}
84-
}
85-
});
76+
$(".switch", button).each(new SetSelectedComponentClosure(selected));
8677
}
8778

8879

@@ -104,4 +95,20 @@ protected Component undecorateComponent(Component b) {
10495
}
10596

10697

98+
private static class SetSelectedComponentClosure implements ComponentSelector.ComponentClosure {
99+
private final boolean selected;
100+
101+
public SetSelectedComponentClosure(boolean selected) {
102+
this.selected = selected;
103+
}
104+
105+
@Override
106+
public void call(Component c) {
107+
if (selected) {
108+
((Switch) c).setOn();
109+
} else {
110+
((Switch) c).setOff();
111+
}
112+
}
113+
}
107114
}

CodenameOne/src/com/codename1/components/ToastBar.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -608,15 +608,7 @@ private void moveLayerToFront() {
608608
return;
609609
}
610610
if (parent.getComponentIndex(layered) != parent.getComponentCount() - 1) {
611-
f.getAnimationManager().flushAnimation(new Runnable() {
612-
public void run() {
613-
parent.removeComponent(layered);
614-
parent.addComponent(layered);
615-
parent.revalidate();
616-
}
617-
});
618-
619-
611+
f.getAnimationManager().flushAnimation(new FlushAnimationCallback(parent, layered));
620612
}
621613
}
622614

@@ -710,6 +702,22 @@ public void setVisible(boolean visible) {
710702
}
711703
}
712704

705+
private static class FlushAnimationCallback implements Runnable {
706+
private final Container parent;
707+
private final Container layered;
708+
709+
public FlushAnimationCallback(Container parent, Container layered) {
710+
this.parent = parent;
711+
this.layered = layered;
712+
}
713+
714+
public void run() {
715+
parent.removeComponent(layered);
716+
parent.addComponent(layered);
717+
parent.revalidate();
718+
}
719+
}
720+
713721
/**
714722
* Represents a single status message.
715723
*/

CodenameOne/src/com/codename1/components/WebBrowser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected void readResponse(InputStream input) throws IOException {
156156
} else {
157157
response[0] = input;
158158
synchronized (LOCK) {
159-
LOCK.notify();
159+
LOCK.notifyAll();
160160
}
161161
}
162162
}

0 commit comments

Comments
 (0)