New Form and List

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 26: Zeile 26:
 
         this.hideDisplayable();
 
         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>
 
</pre>

Version vom 21. Juni 2016, 20:00 Uhr

  • 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.


Inhaltsverzeichnis

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();
    }
}
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
Werkzeuge
Translate