New Form and List
Aus apemap-wiki
(Unterschied zwischen Versionen)
Mkurz (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „* The existing Form and List classes have been renamed to ListLegacy and FormLegacy. * 2 new classes have been created List and Form. * For the moment both ext…“) |
Mkurz (Diskussion | Beiträge) |
||
| (2 dazwischenliegende Versionen von einem Benutzer werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
| + | |||
| + | == Introduction == | ||
* The existing Form and List classes have been renamed to ListLegacy and FormLegacy. | * The existing Form and List classes have been renamed to ListLegacy and FormLegacy. | ||
* 2 new classes have been created List and Form. | * 2 new classes have been created List and Form. | ||
| Zeile 4: | Zeile 6: | ||
* The new classes Form and List can not be used with Display.setCurrent, if used an exception is thrown. | * The new classes Form and List can not be used with Display.setCurrent, if used an exception is thrown. | ||
* The methods showDisplayable and hideDisplayable do not affect the the Display.getCurrent state. | * The methods showDisplayable and hideDisplayable do not affect the the Display.getCurrent state. | ||
| + | |||
| + | == Sample usages of the new class == | ||
| + | Form and List offer the same constructor and the same showDisplayable/hideDisplayable semantics. | ||
| + | |||
| + | === Form as Overlay === | ||
| + | <pre> | ||
| + | public class MyOverlayForm extends Form { | ||
| + | public MyOverlayForm() { | ||
| + | super("MyTitle", VisualisationMode.DisplayAsOverlay | ||
| + | .configAnimation(new AnimationParameters(AnimationParameters.AnimationType.ShiftFromTop))); | ||
| + | } | ||
| + | |||
| + | public void showHideSample(){ | ||
| + | // Showing an overlay from top requires a displable and a top offset. | ||
| + | final Displayable disp = null; // Some displayable used for the 0,0 of the top position. | ||
| + | this.showDisplayable(new ShowAsOverlayTopParameter(disp, 20)); | ||
| + | |||
| + | |||
| + | // hide the thing again. | ||
| + | this.hideDisplayable(); | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Form as Widget === | ||
| + | <pre> | ||
| + | public class MyWidgetForm extends Form { | ||
| + | public MyWidgetForm() { | ||
| + | super("MyTitle", VisualisationMode.DisplayAsWidget | ||
| + | .configWidgetIsHideable() | ||
| + | .configWidgetHasMenu()); | ||
| + | } | ||
| + | |||
| + | public void showHideSample(){ | ||
| + | // Showing as widget, does not require parameters for the moment. | ||
| + | this.showDisplayable(null); | ||
| + | |||
| + | // hide the thing again. | ||
| + | this.hideDisplayable(); | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | === Form as Popup === | ||
| + | <pre> | ||
| + | public class MyPopupForm extends Form { | ||
| + | public MyPopupForm() { | ||
| + | super("MyTitle", VisualisationMode.DisplayAsPopup); | ||
| + | } | ||
| + | |||
| + | public void showHideSample(){ | ||
| + | // Showing as popup, does not require parameters for the moment. | ||
| + | this.showDisplayable(null); | ||
| + | |||
| + | // hide the thing again. | ||
| + | this.hideDisplayable(); | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
Aktuelle Version vom 21. Juni 2016, 20:03 Uhr
Inhaltsverzeichnis |
Introduction
- The existing Form and List classes have been renamed to ListLegacy and FormLegacy.
- 2 new classes have been created List and Form.
- For the moment both extend the legacy classes and offer a cleaner type safe constructor and showDisplayable and hideDisplayable methods.
- The new classes Form and List can not be used with Display.setCurrent, if used an exception is thrown.
- The methods showDisplayable and hideDisplayable do not affect the the Display.getCurrent state.
Sample usages of the new class
Form and List offer the same constructor and the same showDisplayable/hideDisplayable semantics.
Form as Overlay
public class MyOverlayForm extends Form {
public MyOverlayForm() {
super("MyTitle", VisualisationMode.DisplayAsOverlay
.configAnimation(new AnimationParameters(AnimationParameters.AnimationType.ShiftFromTop)));
}
public void showHideSample(){
// Showing an overlay from top requires a displable and a top offset.
final Displayable disp = null; // Some displayable used for the 0,0 of the top position.
this.showDisplayable(new ShowAsOverlayTopParameter(disp, 20));
// hide the thing again.
this.hideDisplayable();
}
}
Form as Widget
public class MyWidgetForm extends Form {
public MyWidgetForm() {
super("MyTitle", VisualisationMode.DisplayAsWidget
.configWidgetIsHideable()
.configWidgetHasMenu());
}
public void showHideSample(){
// Showing as widget, does not require parameters for the moment.
this.showDisplayable(null);
// hide the thing again.
this.hideDisplayable();
}
}
Form as Popup
public class MyPopupForm extends Form {
public MyPopupForm() {
super("MyTitle", VisualisationMode.DisplayAsPopup);
}
public void showHideSample(){
// Showing as popup, does not require parameters for the moment.
this.showDisplayable(null);
// hide the thing again.
this.hideDisplayable();
}
}