Dropdown sometime doesn't display the currently selected value ( swing
always does ) Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2958556
This commit is contained in:
parent
75f4dc9eba
commit
4b3d5de150
|
@ -246,6 +246,7 @@ ContextMenuListener, IZoomableEditor
|
||||||
{
|
{
|
||||||
int size = lookup.getSize();
|
int size = lookup.getSize();
|
||||||
|
|
||||||
|
boolean found = false;
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
Object obj = lookup.getElementAt(i);
|
Object obj = lookup.getElementAt(i);
|
||||||
|
@ -253,28 +254,52 @@ ContextMenuListener, IZoomableEditor
|
||||||
{
|
{
|
||||||
KeyNamePair lookupKNPair = (KeyNamePair) obj;
|
KeyNamePair lookupKNPair = (KeyNamePair) obj;
|
||||||
getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getKey());
|
getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getKey());
|
||||||
|
if (!found && oldValue != null && oldValue instanceof Integer &&
|
||||||
|
lookupKNPair.getKey() == (Integer)oldValue)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (obj instanceof ValueNamePair)
|
else if (obj instanceof ValueNamePair)
|
||||||
{
|
{
|
||||||
ValueNamePair lookupKNPair = (ValueNamePair) obj;
|
ValueNamePair lookupKNPair = (ValueNamePair) obj;
|
||||||
getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getValue());
|
getComponent().appendItem(lookupKNPair.getName(), lookupKNPair.getValue());
|
||||||
}
|
if (!found && oldValue != null && lookupKNPair.getValue().equals(oldValue.toString()))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found && oldValue != null)
|
||||||
|
{
|
||||||
|
NamePair pair = lookup.getDirect(oldValue, false, false);
|
||||||
|
if (pair != null) {
|
||||||
|
if (pair instanceof KeyNamePair) {
|
||||||
|
int key = ((KeyNamePair)pair).getKey();
|
||||||
|
getComponent().appendItem(pair.getName(), key);
|
||||||
|
} else if (pair instanceof ValueNamePair) {
|
||||||
|
ValueNamePair valueNamePair = (ValueNamePair) pair;
|
||||||
|
getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lookup != null)
|
if (lookup != null)
|
||||||
{
|
{
|
||||||
NamePair pair = lookup.getDirect(oldValue, false, false);
|
NamePair pair = lookup.getDirect(oldValue, false, false);
|
||||||
if (pair instanceof KeyNamePair) {
|
if (pair != null) {
|
||||||
int key = ((KeyNamePair)pair).getKey();
|
if (pair instanceof KeyNamePair) {
|
||||||
getComponent().appendItem(pair.getName(), key);
|
int key = ((KeyNamePair)pair).getKey();
|
||||||
} else if (pair instanceof ValueNamePair) {
|
getComponent().appendItem(pair.getName(), key);
|
||||||
ValueNamePair valueNamePair = (ValueNamePair) pair;
|
} else if (pair instanceof ValueNamePair) {
|
||||||
getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
|
ValueNamePair valueNamePair = (ValueNamePair) pair;
|
||||||
}
|
getComponent().appendItem(valueNamePair.getName(), valueNamePair.getValue());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getComponent().setValue(oldValue);
|
getComponent().setValue(oldValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue