Methods Summary |
---|
public void | addListener(SWTSkinObjectListener listener)
listeners_mon.enter();
try {
listeners.add(listener);
} finally {
listeners_mon.exit();
}
|
public void | dispose()
if (control != null && !control.isDisposed()) {
control.dispose();
}
|
public boolean | equals(java.lang.Object obj)
if (obj instanceof SWTSkinObject) {
SWTSkinObject skinObject = (SWTSkinObject) obj;
boolean bEquals = skinObject.getSkinObjectID().equals(sID);
if (parent != null) {
return bEquals && parent.equals(skinObject.getParent());
}
return bEquals;
}
return super.equals(obj);
|
public java.lang.String | getConfigID()
return sConfigID;
|
public org.eclipse.swt.widgets.Control | getControl()
return control;
|
public SWTSkinObjectListener[] | getListeners()
return (SWTSkinObjectListener[]) listeners.toArray(new SWTSkinObjectListener[0]);
|
public SWTSkinObject | getParent()
return parent;
|
public SWTSkinProperties | getProperties()
return properties;
|
public SWTSkin | getSkin()
return skin;
|
public java.lang.String | getSkinObjectID()
return sID;
|
public java.lang.String | getSuffix()
String suffix = "";
for (int i = 0; i < suffixes.length; i++) {
suffix += suffixes[i];
}
return suffix;
|
public java.lang.String | getType()
return type;
|
public java.lang.String | getViewID()
return sViewID;
|
public boolean | isDisposed()
if (control == null) {
return false;
}
return Utils.execSWTThreadWithBool("isDisposed", new AERunnableBoolean() {
public boolean runSupport() {
return control == null || control.isDisposed();
}
}, 30000);
|
public boolean | isVisible()
return Utils.execSWTThreadWithBool("isVisible", new AERunnableBoolean() {
public boolean runSupport() {
return control != null && !control.isDisposed() && control.isVisible();
}
}, 30000);
|
public void | removeListener(SWTSkinObjectListener listener)
listeners_mon.enter();
try {
listeners.remove(listener);
} finally {
listeners_mon.exit();
}
|
public void | setBackground(java.lang.String sConfigID, java.lang.String sSuffix)
Image imageBG;
Image imageBGLeft;
Image imageBGRight;
if (sConfigID == null) {
return;
}
ImageLoader imageLoader = skin.getImageLoader(properties);
Image[] images = imageLoader.getImages(sConfigID + sSuffix);
if (images.length == 1 && ImageLoader.isRealImage(images[0])) {
imageBG = images[0];
imageBGLeft = imageLoader.getImage(sConfigID + sSuffix + "-left");
imageBGRight = imageLoader.getImage(sConfigID + sSuffix + "-right");
} else if (images.length == 3 && ImageLoader.isRealImage(images[2])) {
imageBGLeft = images[0];
imageBG = images[1];
imageBGRight = images[2];
} else {
return;
}
if (painter == null) {
//control.setBackgroundImage doesn't handle transparency!
//control.setBackgroundImage(image);
// Workaround: create our own image with shell's background
// for "transparent" area. Doesn't allow control's image to show
// through. To do that, we'd have to walk up the tree until we
// found a composite with an image
//control.setBackgroundMode(SWT.INHERIT_NONE);
//control.setBackgroundImage(imageBG);
String sTileMode = properties.getStringValue(sConfigID + ".drawmode");
int tileMode = SWTSkinUtils.getTileMode(sTileMode);
painter = new SWTBGImagePainter(control, imageBGLeft, imageBGRight,
imageBG, tileMode);
} else {
//System.out.println("setImage " + sConfigID + " " + sSuffix);
painter.setImage(imageBGLeft, imageBGRight, imageBG);
}
// XXX Is this needed? It causes flicker and slows things down.
// Maybe a redraw instead (if anything at all)?
//control.update();
|
public void | setControl(org.eclipse.swt.widgets.Control control)
this.control = control;
control.setData("ConfigID", sConfigID);
control.setData("SkinObject", this);
SWTSkinUtils.addMouseImageChangeListeners(control);
switchSuffix("", 1, false);
// setvisible is one time only
if (properties.getStringValue(sConfigID + ".visible", "true").equalsIgnoreCase(
"false")) {
setVisible(false);
}
|
public void | setDefaultVisibility()
if (sConfigID == null) {
return;
}
setVisible(properties.getStringValue(sConfigID + ".visible", "true").equalsIgnoreCase(
"true"));
|
public void | setProperties(SWTSkinProperties skinProperties)
this.properties = skinProperties;
|
public void | setTooltipAndChildren(org.eclipse.swt.widgets.Control c, java.lang.String sToolTip)
c.setToolTipText(sToolTip);
if (c instanceof Composite) {
Control[] children = ((Composite) c).getChildren();
for (int i = 0; i < children.length; i++) {
Control control = children[i];
setTooltipAndChildren(control, sToolTip);
}
}
|
protected void | setViewID(java.lang.String viewID)
sViewID = viewID;
|
public void | setVisible(boolean visible)
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
if (control != null && !control.isDisposed()) {
control.setVisible(visible);
}
triggerListeners(visible ? SWTSkinObjectListener.EVENT_SHOW
: SWTSkinObjectListener.EVENT_HIDE);
}
});
|
public java.lang.String | switchSuffix(java.lang.String suffix, int level, boolean walkUp)
if (walkUp) {
SWTSkinObject parentSkinObject = parent;
SWTSkinObject skinObject = this;
// Move up the tree until propogation stops
while ((parentSkinObject instanceof SWTSkinObjectContainer)
&& ((SWTSkinObjectContainer) parentSkinObject).getPropogation()) {
skinObject = parentSkinObject;
parentSkinObject = parentSkinObject.getParent();
}
if (skinObject != this) {
//System.out.println(sConfigID + suffix + "; walkup");
skinObject.switchSuffix(suffix, level, false);
return null;
}
}
//System.out.println(SystemTime.getCurrentTime() + ": " + this + suffix + "; switchy");
if (suffixes == null) {
suffixes = new String[level];
} else if (suffixes.length < level) {
String[] newSuffixes = new String[level];
System.arraycopy(suffixes, 0, newSuffixes, 0, suffixes.length);
suffixes = newSuffixes;
}
suffixes[level - 1] = suffix;
suffix = getSuffix();
if (sConfigID == null || control == null || control.isDisposed()) {
return suffix;
}
final String sSuffix = suffix;
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
if (control == null || control.isDisposed()) {
return;
}
Color color = properties.getColor(sConfigID + ".color" + sSuffix);
if (color != null) {
control.setBackground(color);
}
Color fg = properties.getColor(sConfigID + ".fgcolor" + sSuffix);
if (fg != null) {
control.setForeground(fg);
}
setBackground(sConfigID + ".background", sSuffix);
String sCursor = properties.getStringValue(sConfigID + ".cursor");
if (sCursor != null && sCursor.length() > 0) {
if (sCursor.equalsIgnoreCase("hand")) {
control.addListener(SWT.MouseEnter,
skin.getHandCursorListener(control.getDisplay()));
control.addListener(SWT.MouseExit,
skin.getHandCursorListener(control.getDisplay()));
}
}
String sTooltip = properties.getStringValue(sConfigID + ".tooltip"
+ sSuffix);
if (sTooltip != null) {
setTooltipAndChildren(control, sTooltip);
}
}
});
return suffix;
|
public java.lang.String | toString()
String s = "SWTSkinObjectBasic {" + sID;
if (!sID.equals(sConfigID)) {
s += "/" + sConfigID;
}
s += ", " + type + "; parent="
+ ((parent == null) ? null : parent.getSkinObjectID() + "}");
return s;
|
public void | triggerListeners(int eventType)
triggerListeners(eventType, null);
|
public void | triggerListeners(int eventType, java.lang.Object params)
// process listeners added locally
listeners_mon.enter();
try {
for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
try {
SWTSkinObjectListener l = (SWTSkinObjectListener) iterator.next();
l.eventOccured(this, eventType, params);
} catch (Exception e) {
Debug.out("Skin Event " + SWTSkinObjectListener.NAMES[eventType]
+ " caused an error for listener added locally", e);
}
}
} finally {
listeners_mon.exit();
}
// process listeners added to skin
SWTSkinObjectListener[] listeners = skin.getSkinObjectListeners(sViewID);
for (int i = 0; i < listeners.length; i++) {
try {
SWTSkinObjectListener l = listeners[i];
l.eventOccured(this, eventType, params);
} catch (Exception e) {
Debug.out("Skin Event " + SWTSkinObjectListener.NAMES[eventType]
+ " caused an error for listener added to skin", e);
}
}
|