Java Code Examples for com.codename1.ui.Dialog#getCommandCount()

The following examples show how to use com.codename1.ui.Dialog#getCommandCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonTransitions.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
private void drawDialogCmp(Graphics g, Dialog dlg) {
    Painter p = dlg.getStyle().getBgPainter();
    dlg.getStyle().setBgPainter(null);
    g.setClip(0, 0, dlg.getWidth(), dlg.getHeight());
    g.translate(-getDialogParent(dlg).getX(), -getDialogParent(dlg).getY() + getDialogTitleHeight(dlg));
    getDialogParent(dlg).paintComponent(g, false);
    if(drawDialogMenu && dlg.getCommandCount() > 0) {
        Component menuBar = dlg.getSoftButton(0).getParent();
        if(menuBar != null) {
            g.setClip(0, 0, dlg.getWidth(), dlg.getHeight());
            menuBar.paintComponent(g, false);
        }
    }

    dlg.getStyle().setBgPainter(p);
}
 
Example 2
Source File: BubbleTransition.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
private void drawDialogCmp(Graphics g, Dialog dlg) {
    Painter p = dlg.getStyle().getBgPainter();
    dlg.getStyle().setBgPainter(null);
    g.setClip(0, 0, dlg.getWidth(), dlg.getHeight());
    g.translate(-getDialogParent(dlg).getX(), -getDialogParent(dlg).getY());
    getDialogParent(dlg).paintComponent(g, false);
    if (dlg.getCommandCount() > 0) {
        Component menuBar = dlg.getSoftButton(0).getParent();
        if (menuBar != null) {
            g.setClip(0, 0, dlg.getWidth(), dlg.getHeight());
            menuBar.paintComponent(g, false);
        }
    }

    dlg.getStyle().setBgPainter(p);
}
 
Example 3
Source File: CommonTransitions.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
private void paint(Graphics g, Component cmp, int x, int y, boolean background) {
    
    boolean b = cmp.isVisible();
    cmp.setVisible(true);
    int cx = g.getClipX();
    int cy = g.getClipY();
    int cw = g.getClipWidth();
    int ch = g.getClipHeight();
    if (cmp instanceof Dialog) {
        if (transitionType == TYPE_FADE && Display.getInstance().areMutableImagesFast()) {
            cmp.paintComponent(g, background);
            return;
        }
        if (!(getSource() instanceof Dialog && getDestination() instanceof Dialog
                && cmp == getDestination())) {
            Painter p = cmp.getStyle().getBgPainter();
            cmp.getStyle().setBgPainter(null);
            g.translate(x, y);
            Dialog dlg = (Dialog) cmp;
            g.setClip(0, 0, cmp.getWidth(), cmp.getHeight());
            getDialogParent(dlg).paintComponent(g, false);
            g.translate(-x, -y);
            if (drawDialogMenu && dlg.getCommandCount() > 0) {
                Component menuBar = dlg.getSoftButton(0).getParent();
                if (menuBar != null) {
                    g.setClip(0, 0, cmp.getWidth(), cmp.getHeight());
                    menuBar.paintComponent(g, false);
                }
            }
            g.setClip(cx, cy, cw, ch);
            cmp.getStyle().setBgPainter(p);
        }else{
            cmp.paintComponent(g, background);            
        }
        return;
    }
    //g.clipRect(cmp.getAbsoluteX(), cmp.getAbsoluteY(), cmp.getWidth(), cmp.getHeight());
     g.translate(x, y);
    //g.clipRect(cmp.getAbsoluteX(), cmp.getAbsoluteY(), cmp.getWidth(), cmp.getHeight());
    cmp.paintComponent(g, background);
    g.translate(-x, -y);
    
    g.setClip(cx, cy, cw, ch);
    cmp.setVisible(b);
}