Methods Summary |
---|
public synchronized void | addDisplay(DisplayAccess da)Adds a display object to the container and sets a the display's ID to
new unique value for this isolate, as a single atomic operation.
Intended to be called from Display constructor.
if (displays.indexOf(da) == -1) {
int newId = createDisplayId();
da.setDisplayId(newId);
displays.addElement(da);
}
|
private int | createDisplayId()Creates an Display Id that is unique across all Isolates.
Graphics subsystem depends on this uniqueness, which allows
quick check on whether a Display is in the foreground
without having to check Isolate id.
int id;
do {
lastLocalDisplayId++;
// [high 8 bits: isolate id][low 24 bits: display id]]
id = ((isolateId & 0xff)<<24) | (lastLocalDisplayId & 0x00ffffff);
} while (findDisplayById(id) != null);
return id;
|
synchronized DisplayAccess | findDisplayById(int displayId)Find a display by ID.
int size = displays.size();
for (int i = 0; i < size; i++) {
DisplayAccess current = (DisplayAccess)displays.elementAt(i);
if (current.getDisplayId() == displayId) {
return current;
}
}
return null;
|
public synchronized DisplayAccess | findDisplayByOwner(java.lang.String nameOfOwner)Find a display by owner.
int size = displays.size();
for (int i = 0; i < size; i++) {
DisplayAccess current = (DisplayAccess)displays.elementAt(i);
if (current.getNameOfOwner().equals(nameOfOwner)) {
return current;
}
}
return null;
|
public DisplayEventConsumer | findDisplayEventConsumer(int displayId)Find a display event consumer by ID.
DisplayAccess da = findDisplayById(displayId);
if (da == null) {
return null;
}
return da.getDisplayEventConsumer();
|
public ForegroundEventConsumer | findForegroundEventConsumer(int displayId)Find a foreground event consumer by ID.
DisplayAccess da = findDisplayById(displayId);
if (da == null) {
return null;
}
return da.getForegroundEventConsumer();
|
public synchronized boolean | removeDisplay(java.lang.String nameOfOwner)Removes display object from the container.
DisplayAccess da = findDisplayByOwner(nameOfOwner);
return displays.removeElement(da);
|
public void | requestForegroundForDisplay(java.lang.String nameOfOwner)Get a display to request the foreground on behalf of the MIDlet.
DisplayAccess da = findDisplayByOwner(nameOfOwner);
da.requestForeground();
|