MiG InfoCom MiG Calendar InfoCom AB User Manual

Page 7

Advertising
background image

© 2007 MiG InfoCom AB

Color.PINK);

A more generic and flexible way is the new static generic overriders
introduced in v5.2.

For instance to set a yellow border on all recurring events:

ActivityInteractor.setStaticOverride("outline", AShape.A_PAINT,
new OverrideFilter() {
public Object getOverride(Object subject, Object defaultObject) {
if (((ActivityView) subject).getModel().isRecurrent()) {
return Color.YELLOW;
} else {
return defaultObject;
}
}
});

Since you have the Activity at hand you can base your override on
anything you like, such as for instance a custom property in the Activity.

One of things you need to know for the above to work is the name of the
subshape to target. If you create you own AShape that's no problem since
you are in control of everything. The default shape created by the
framework if nothing else is provided have constants for the names. They
are unlikely to change.

public static final String DEFAULT_CONTAINER_SHAPE_NAME
public static final String DEFAULT_BACKGROUND_SHAPE_NAME
public static final String DEFAULT_TITLE_TEXT_SHAPE_NAME
public static final String DEFAULT_MAIN_TEXT_SHAPE_NAME
public static final String DEFAULT_OUTLINE_SHAPE_NAME
public static final String DEFAULT_SHADOW_SHAPE_SHAPE_NAME
public static final String DEFAULT_SHADOW_SHAPE_NAME

They are defined in the class AShapeUtil and the source code for the
shape is available here:

http://www.miginfocom.com/forum/viewtopic.php?t=18

Yet another way is to provide different AShapes (or rather RootAShapes..)

for different paintContexts. This is automatically handled by the

framework. You simply register a RootAShape for a paintContext by:

Statically for all DefaultAShapeProviders:

DefaultAShapeProvider.setShapeGlobally(<rootAShape>, <paintContext>)

Advertising