Skip to content

Commit 26edf9a

Browse files
committed
BindTarget was still used. Restored it and deprecated code
1 parent 49a02fe commit 26edf9a

File tree

7 files changed

+57
-48
lines changed

7 files changed

+57
-48
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
* This code is free software; you can redistribute it and/or modify it
5+
* under the terms of the GNU General Public License version 2 only, as
6+
* published by the Free Software Foundation. Codename One designates this
7+
* particular file as subject to the "Classpath" exception as provided
8+
* by Oracle in the LICENSE file that accompanied this code.
9+
*
10+
* This code is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* version 2 for more details (a copy is included in the LICENSE file that
14+
* accompanied this code).
15+
*
16+
* You should have received a copy of the GNU General Public License version
17+
* 2 along with this work; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19+
*
20+
* Please contact Codename One through http://www.codenameone.com/ if you
21+
* need additional information or have any questions.
22+
*/
23+
package com.codename1.cloud;
24+
25+
import com.codename1.ui.Component;
26+
27+
/**
28+
* Allows binding arbitrary components to data storage
29+
*
30+
* @author Shai Almog
31+
* @deprecated this mapped to an older iteration of properties that is no longer used
32+
*/
33+
public interface BindTarget {
34+
/**
35+
* Fired when a property of the component changes to a new value
36+
*
37+
* @param source the source component
38+
* @param propertyName the name of the property
39+
* @param oldValue the old value of the property
40+
* @param newValue the new value for the property
41+
*/
42+
void propertyChanged(Component source, String propertyName, Object oldValue, Object newValue); // PMD Fix: UnnecessaryModifier removed
43+
}

CodenameOne/src/com/codename1/ui/CheckBox.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ public Class[] getBindablePropertyTypes() {
267267

268268
/**
269269
* {@inheritDoc}
270+
* @deprecated uses the deprecated BindTarget interface
270271
*/
271272
public void bindProperty(String prop, BindTarget target) {
272273
if (prop.equals("selected")) {
@@ -281,6 +282,7 @@ public void bindProperty(String prop, BindTarget target) {
281282

282283
/**
283284
* {@inheritDoc}
285+
* @deprecated uses the deprecated BindTarget interface
284286
*/
285287
public void unbindProperty(String prop, BindTarget target) {
286288
if (prop.equals("selected")) {

CodenameOne/src/com/codename1/ui/Label.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ public Class[] getBindablePropertyTypes() {
12211221

12221222
/**
12231223
* {@inheritDoc}
1224+
* @deprecated uses the deprecated BindTarget interface
12241225
*/
12251226
public void bindProperty(String prop, BindTarget target) {
12261227
if (prop.equals("text")) {
@@ -1235,6 +1236,7 @@ public void bindProperty(String prop, BindTarget target) {
12351236

12361237
/**
12371238
* {@inheritDoc}
1239+
* @deprecated uses the deprecated BindTarget interface
12381240
*/
12391241
public void unbindProperty(String prop, BindTarget target) {
12401242
if (prop.equals("text")) {

CodenameOne/src/com/codename1/ui/RadioButton.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ public Class[] getBindablePropertyTypes() {
380380

381381
/**
382382
* {@inheritDoc}
383+
* @deprecated uses the deprecated BindTarget interface
383384
*/
384385
public void bindProperty(String prop, BindTarget target) {
385386
if (prop.equals("selected")) {
@@ -394,6 +395,7 @@ public void bindProperty(String prop, BindTarget target) {
394395

395396
/**
396397
* {@inheritDoc}
398+
* @deprecated uses the deprecated BindTarget interface
397399
*/
398400
public void unbindProperty(String prop, BindTarget target) {
399401
if (prop.equals("selected")) {

CodenameOne/src/com/codename1/ui/TextArea.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,7 @@ public Class[] getBindablePropertyTypes() {
18251825

18261826
/**
18271827
* {@inheritDoc}
1828+
* @deprecated uses the deprecated BindTarget interface
18281829
*/
18291830
public void bindProperty(String prop, BindTarget target) {
18301831
if (prop.equals("text")) {
@@ -1839,6 +1840,7 @@ public void bindProperty(String prop, BindTarget target) {
18391840

18401841
/**
18411842
* {@inheritDoc}
1843+
* @deprecated uses the deprecated BindTarget interface
18421844
*/
18431845
public void unbindProperty(String prop, BindTarget target) {
18441846
if (prop.equals("text")) {

CodenameOne/src/com/codename1/ui/list/GenericListCellRenderer.java

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package com.codename1.ui.list;
2525

26-
import com.codename1.cloud.CloudObject;
2726
import com.codename1.ui.Button;
2827
import com.codename1.ui.CheckBox;
2928
import com.codename1.ui.Command;
@@ -328,34 +327,8 @@ public Component getCellRendererComponent(Component list, Object model, T value,
328327
entries[iter].setFocus(lead || entries[iter].isFocusable());
329328
}
330329
} else {
331-
if (value instanceof CloudObject) {
332-
CloudObject h = (CloudObject) value;
333-
Boolean enabled = h.getBoolean(ENABLED);
334-
if (enabled != null) {
335-
cmp.setEnabled(enabled.booleanValue());
336-
}
337-
int elen = entries.length;
338-
for (int iter = 0; iter < elen; iter++) {
339-
String currentName = entries[iter].getName();
340-
341-
Object val;
342-
if (currentName.equals("$number")) {
343-
val = "" + (index + 1);
344-
} else {
345-
// a selected entry might differ in its value to allow for
346-
// behavior such as rollover images
347-
val = h.getObject("#" + currentName);
348-
if (val == null) {
349-
val = h.getObject(currentName);
350-
}
351-
}
352-
setComponentValueWithTickering(entries[iter], val, list, cmp);
353-
entries[iter].setFocus(entries[iter].isFocusable());
354-
}
355-
} else {
356-
setComponentValueWithTickering(entries[0], value, list, cmp);
357-
entries[0].setFocus(entries[0].isFocusable());
358-
}
330+
setComponentValueWithTickering(entries[0], value, list, cmp);
331+
entries[0].setFocus(entries[0].isFocusable());
359332
}
360333
return cmp;
361334
} else {
@@ -389,25 +362,8 @@ public Component getCellRendererComponent(Component list, Object model, T value,
389362
setComponentValue(entries[iter], val, list, cmp);
390363
}
391364
} else {
392-
if (value instanceof CloudObject) {
393-
CloudObject h = (CloudObject) value;
394-
Boolean enabled = h.getBoolean(ENABLED);
395-
if (enabled != null) {
396-
cmp.setEnabled(enabled.booleanValue());
397-
}
398-
int elen = entries.length;
399-
for (int iter = 0; iter < elen; iter++) {
400-
String currentName = entries[iter].getName();
401-
if (currentName.equals("$number")) {
402-
setComponentValue(entries[iter], "" + (index + 1), list, cmp);
403-
continue;
404-
}
405-
setComponentValue(entries[iter], h.getObject(currentName), list, cmp);
406-
}
407-
} else {
408-
if (entries.length > 0) {
409-
setComponentValue(entries[0], value, list, cmp);
410-
}
365+
if (entries.length > 0) {
366+
setComponentValue(entries[0], value, list, cmp);
411367
}
412368
}
413369
return cmp;

CodenameOne/src/com/codename1/ui/util/EventDispatcher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public void fireDataChangeEvent(int index, int type) {
167167
* @param propertyName the name of the property
168168
* @param oldValue the old value of the property
169169
* @param newValue the new value for the property
170+
* @deprecated uses the deprecated BindTarget interface
170171
*/
171172
public void fireBindTargetChange(Component source, String propertyName, Object oldValue, Object newValue) {
172173
if (listeners == null || listeners.size() == 0) {
@@ -201,6 +202,7 @@ public void fireBindTargetChange(Component source, String propertyName, Object o
201202
* @param propertyName the name of the property
202203
* @param oldValue the old value of the property
203204
* @param newValue the new value for the property
205+
* @deprecated uses the deprecated BindTarget interface
204206
*/
205207
private void fireBindTargetChangeSync(BindTarget[] arr, Component source, String propertyName, Object oldValue, Object newValue) {
206208
int alen = arr.length;

0 commit comments

Comments
 (0)