Search in sources :

Example 21 with Transition

use of com.codename1.ui.animations.Transition in project CodenameOne by codenameone.

the class ChartComponent method zoomToShapeInChartCoords.

/**
 * Zooms the view port to show a specified shape.  The shape should be
 * expressed in chart coordinates (not screen coordinates).
 * @param s The shape that should be shown.
 * @param duration The duration of the transition.
 * @see #zoomTo(double, double, double, double, int)
 */
public void zoomToShapeInChartCoords(Shape s, int duration) {
    Rectangle r = s.getBounds();
    zoomTransition(r.getX(), r.getX() + r.getWidth(), r.getY(), r.getY() + r.getHeight(), duration);
}
Also used : Rectangle(com.codename1.ui.geom.Rectangle)

Example 22 with Transition

use of com.codename1.ui.animations.Transition in project CodenameOne by codenameone.

the class LazyValueC method reloadForm.

/**
 * Useful tool to refresh the current state of a form shown using show form
 * without pushing another instance to the back stack
 */
public void reloadForm() {
    Form currentForm = Display.getInstance().getCurrent();
    Command backCommand = currentForm.getBackCommand();
    Form newForm = (Form) createContainer(fetchResourceFile(), currentForm.getName());
    if (backCommand != null) {
        setBackCommand(newForm, backCommand);
        // trigger listener creation if this is the only command in the form
        getFormListenerInstance(newForm, null);
        for (int iter = 0; iter < currentForm.getCommandCount(); iter++) {
            if (backCommand == currentForm.getCommand(iter)) {
                newForm.addCommand(backCommand, newForm.getCommandCount());
                break;
            }
        }
    }
    beforeShow(newForm);
    Transition tin = newForm.getTransitionInAnimator();
    Transition tout = newForm.getTransitionOutAnimator();
    currentForm.setTransitionInAnimator(CommonTransitions.createEmpty());
    currentForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
    newForm.setTransitionInAnimator(CommonTransitions.createEmpty());
    newForm.setTransitionOutAnimator(CommonTransitions.createEmpty());
    newForm.layoutContainer();
    newForm.show();
    postShowImpl(newForm);
    newForm.setTransitionInAnimator(tin);
    newForm.setTransitionOutAnimator(tout);
}
Also used : Form(com.codename1.ui.Form) Command(com.codename1.ui.Command) Transition(com.codename1.ui.animations.Transition)

Aggregations

Form (com.codename1.ui.Form)7 Transition (com.codename1.ui.animations.Transition)7 Component (com.codename1.ui.Component)6 Container (com.codename1.ui.Container)4 Dialog (com.codename1.ui.Dialog)3 Graphics (com.codename1.ui.Graphics)3 Animation (com.codename1.ui.animations.Animation)3 BorderLayout (com.codename1.ui.layouts.BorderLayout)3 XYSeries (com.codename1.charts.models.XYSeries)2 BubbleTransition (com.codename1.ui.animations.BubbleTransition)2 Rectangle (com.codename1.ui.geom.Rectangle)2 LookAndFeel (com.codename1.ui.plaf.LookAndFeel)2 UIManager (com.codename1.ui.plaf.UIManager)2 XYMultipleSeriesDataset (com.codename1.charts.models.XYMultipleSeriesDataset)1 XYValueSeries (com.codename1.charts.models.XYValueSeries)1 BrowserComponent (com.codename1.ui.BrowserComponent)1 Command (com.codename1.ui.Command)1 Display (com.codename1.ui.Display)1 Image (com.codename1.ui.Image)1 Label (com.codename1.ui.Label)1