Skip to content

Commit c0bc82c

Browse files
hansonrhansonr
authored andcommitted
a2s adds super. for superclass calls
1 parent f286470 commit c0bc82c

File tree

24 files changed

+121
-109
lines changed

24 files changed

+121
-109
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20201010050645
1+
20201022065610
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20201010050645
1+
20201022065610

sources/net.sf.j2s.java.core/src/java/beans/PropertyChangeSupport.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class PropertyChangeSupport {
4141
private PropertyChangeListenerMap map = new PropertyChangeListenerMap();
4242

4343
boolean doDebug = false;
44+
String debugTarget = null;
45+
4446
/**
4547
* Constructs a <code>PropertyChangeSupport</code> object.
4648
*
@@ -55,7 +57,7 @@ public PropertyChangeSupport(Object sourceBean) {
5557
source = sourceBean;
5658

5759

58-
// doDebug = source.getClass().getName().indexOf("org.open") >= 0;
60+
doDebug = (debugTarget != null && source.getClass().getName().indexOf(debugTarget) >= 0);
5961

6062

6163
}
@@ -167,7 +169,7 @@ public void addPropertyChangeListener(
167169

168170
if (doDebug) {
169171
String target = listener.getClass().getName();
170-
if (target.indexOf("org.")>=0)
172+
if (target.indexOf(debugTarget)>=0)
171173
System.out.println("PropChangeSupport adding " + this.source.getClass().getSimpleName()
172174
+ " " + propertyName + " for " + listener.getClass().getSimpleName());
173175

@@ -315,7 +317,7 @@ private void fire(PropertyChangeListener[] listeners, PropertyChangeEvent event)
315317

316318
if (doDebug) {
317319
String target = listeners[i].getClass().getName();
318-
if (target.indexOf("org.")>=0)
320+
if (target.indexOf(debugTarget)>=0)
319321
System.out.println("PChS firing " + this.source.getClass().getSimpleName()
320322
+ " " + event.getPropertyName() + " to " + listeners[i].getClass().getSimpleName());
321323

sources/net.sf.j2s.java.core/src/javajs/util/VideoReader.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void getStream(InputStream stream) {
6464
public List<Map<String, Object>> getContents(boolean verbose) {
6565
contents = new ArrayList<>();
6666
this.verbose = verbose;
67-
while (pt != -1) {
67+
while (isAvail()) {
6868
try {
6969
readBlock(contents);
7070
} catch (IOException e) {
@@ -251,6 +251,14 @@ protected long readIntLong() throws IOException {
251251
return is.readInt() & 0xFFFFFFFFL;
252252
}
253253

254+
@SuppressWarnings("unused")
255+
protected boolean isAvail() {
256+
try {
257+
return (pt != -1 && is.available() > 0);
258+
} catch (IOException e) {
259+
return false;
260+
}
261+
}
254262

255263
protected int readInt() throws IOException {
256264
pt += 4;

sources/net.sf.j2s.java.core/src/swingjs/a2s/Button.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public Button() {
1717

1818
public Button(String text) {
1919
super(text);
20-
if (!isBackgroundSet())
21-
setBackground(bgcolor);
20+
if (!super.isBackgroundSet())
21+
super.setBackground(bgcolor);
2222

2323
}
2424

sources/net.sf.j2s.java.core/src/swingjs/a2s/Canvas.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ public Dimension getPreferredSize() {
2929
@Override
3030
public Dimension preferredSize() {
3131
// must bypass JComponent here because we subclass Panel
32-
return prefSizeComp();
32+
return super.prefSizeComp();
3333
}
3434

3535
@Override
3636
public void setBackground(Color c) {
3737
super.setBackground(c);
38-
setOpaque(c != null);
38+
super.setOpaque(c != null);
3939
}
4040

4141
@Override

sources/net.sf.j2s.java.core/src/swingjs/a2s/Checkbox.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public Checkbox(String label, boolean state, java.awt.CheckboxGroup group) throw
4141
if (group != null)
4242
group.add(this);
4343
if (state && (group != null)) {
44-
setSelected(state);
44+
super.setSelected(state);
4545
}
4646
}
4747

@@ -71,7 +71,7 @@ public Checkbox() {
7171
}
7272

7373
public boolean getState() {
74-
return isSelected();
74+
return super.isSelected();
7575
}
7676

7777
public void setState(boolean b) {

sources/net.sf.j2s.java.core/src/swingjs/a2s/CheckboxGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public CheckboxGroup() {
1313
}
1414

1515
public JRadioButton getSelectedCheckbox() {
16-
for (Enumeration<AbstractButton> e = getElements(); e.hasMoreElements(); ) {
16+
for (Enumeration<AbstractButton> e = super.getElements(); e.hasMoreElements(); ) {
1717
JRadioButton ab = (JRadioButton) e.nextElement();
1818
if (ab.isSelected())
1919
return ab;

sources/net.sf.j2s.java.core/src/swingjs/a2s/CheckboxMenuItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public CheckboxMenuItem(String string, boolean b) {
2222

2323
@Override
2424
public boolean getState() {
25-
return isSelected();
25+
return super.isSelected();
2626
}
2727

2828

sources/net.sf.j2s.java.core/src/swingjs/a2s/Choice.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ public class Choice extends JComboBox {
1111

1212
public Choice() {
1313
super();
14-
setBackground(Color.white);
14+
super.setBackground(Color.white);
1515
}
1616

1717
public void isAWT() {}
1818

1919
public void select(int index) {
20-
setSelectedIndex(index);
20+
super.setSelectedIndex(index);
2121
}
2222

2323
public void select(String key) {
24-
setSelectedItem(key);
24+
super.setSelectedItem(key);
2525
}
2626

2727
public void add(String label) {
2828
addItem(label);
2929
}
3030

3131
public int countItems() {
32-
return getItemCount();
32+
return super.getItemCount();
3333
}
3434

3535
public void addItem(String item) {
@@ -41,16 +41,16 @@ public void insert(String item, int index) {
4141
}
4242

4343
public void remove(String item) {
44-
removeItem(item);
44+
super.removeItem(item);
4545
}
4646

4747
public String getItem(int n) {
48-
return (String)getItemAt(n);
48+
return (String)super.getItemAt(n);
4949
}
5050

5151
@Override
5252
public void removeAll() {
53-
removeAllItems();
53+
super.removeAllItems();
5454
}
5555

5656
// A2SListener listener = null;
@@ -79,7 +79,7 @@ protected void fireItemStateChanged(ItemEvent event) {
7979

8080
@Override
8181
public String getActionCommand() {
82-
return (String) getSelectedItem();
82+
return (String) super.getSelectedItem();
8383
}
8484

8585

0 commit comments

Comments
 (0)