use of com.codename1.ui.Dialog in project CodenameOne by codenameone.
the class InteractionDialog method disposeToTheLeft.
/**
* Removes the interaction dialog from view with an animation to the left
*/
public void disposeToTheLeft() {
disposed = true;
final Container p = getParent();
if (p != null) {
final Form f = p.getComponentForm();
if (f != null) {
setX(-getWidth());
if (animateShow) {
p.animateUnlayout(400, 255, new Runnable() {
public void run() {
if (p.getParent() != null) {
Container pp = getLayeredPane(f);
remove();
p.remove();
pp.removeAll();
pp.revalidate();
cleanupLayer(f);
}
}
});
} else {
p.revalidate();
Container pp = getLayeredPane(f);
remove();
p.remove();
pp.removeAll();
pp.revalidate();
}
} else {
remove();
}
}
}
use of com.codename1.ui.Dialog in project CodenameOne by codenameone.
the class InteractionDialog method showPopupDialog.
/**
* A popup dialog is shown with the context of a component and its selection, it is disposed seamlessly if the back button is pressed
* or if the user touches outside its bounds. It can optionally provide an arrow in the theme to point at the context component. The popup
* dialog has the PopupDialog style by default.
*
* @param c the context component which is used to position the dialog and can also be pointed at
*/
public void showPopupDialog(Component c) {
disposed = false;
Rectangle componentPos = c.getSelectedRect();
componentPos.setX(componentPos.getX() - c.getScrollX());
componentPos.setY(componentPos.getY() - c.getScrollY());
showPopupDialog(componentPos);
}
use of com.codename1.ui.Dialog in project CodenameOne by codenameone.
the class InteractionDialog method dispose.
/**
* Removes the interaction dialog from view
*/
public void dispose() {
disposed = true;
Container p = getParent();
if (p != null) {
Form f = p.getComponentForm();
if (f != null) {
if (animateShow) {
if (repositionAnimation) {
setX(getX() + getWidth() / 2);
setY(getY() + getHeight() / 2);
setWidth(1);
setHeight(1);
}
p.animateUnlayoutAndWait(400, 100);
}
Container pp = getLayeredPane(f);
remove();
p.remove();
pp.removeAll();
pp.revalidate();
cleanupLayer(f);
} else {
p.remove();
}
}
}
use of com.codename1.ui.Dialog in project CodenameOne by codenameone.
the class ToastBar method getToastBarComponent.
private ToastBarComponent getToastBarComponent() {
Form f = Display.getInstance().getCurrent();
if (f != null && !(f instanceof Dialog)) {
ToastBarComponent c = (ToastBarComponent) f.getClientProperty("ToastBarComponent");
if (c == null || c.getParent() == null) {
c = new ToastBarComponent();
c.hidden = true;
f.putClientProperty("ToastBarComponent", c);
Container layered = f.getLayeredPane(this.getClass(), true);
layered.setLayout(new BorderLayout());
layered.addComponent(position == Component.TOP ? BorderLayout.NORTH : BorderLayout.SOUTH, c);
updateStatus();
}
if (position == Component.BOTTOM && f.getInvisibleAreaUnderVKB() > 0) {
Style s = c.getAllStyles();
s.setMarginUnit(Style.UNIT_TYPE_PIXELS);
s.setMarginBottom(f.getInvisibleAreaUnderVKB());
}
return c;
}
return null;
}
use of com.codename1.ui.Dialog in project CodenameOne by codenameone.
the class ComboBox method createPopupDialog.
/**
* Subclasses can override this method to change the creation of the dialog
*
* @param l the list of the popup
* @return a dialog instance
*/
protected Dialog createPopupDialog(List<T> l) {
Dialog popupDialog = new Dialog(getUIID() + "Popup", getUIID() + "PopupTitle") {
void sizeChangedInternal(int w, int h) {
// resize the popup just resize the parent form
if (getWidth() == w && getHeight() != h) {
Form frm = getPreviousForm();
if (frm != null) {
frm.sizeChangedInternal(w, h);
}
setSize(new Dimension(w, h));
repaint();
} else {
dispose();
}
}
};
popupDialog.setScrollable(false);
popupDialog.getContentPane().setAlwaysTensile(false);
popupDialog.setAlwaysTensile(false);
popupDialog.getContentPane().setUIID("PopupContentPane");
popupDialog.setDisposeWhenPointerOutOfBounds(true);
popupDialog.setTransitionInAnimator(CommonTransitions.createEmpty());
popupDialog.setTransitionOutAnimator(CommonTransitions.createEmpty());
popupDialog.setLayout(new BorderLayout());
popupDialog.addComponent(BorderLayout.CENTER, l);
return popupDialog;
}
Aggregations