Example usage for com.google.gwt.user.client.ui DockPanel remove

List of usage examples for com.google.gwt.user.client.ui DockPanel remove

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui DockPanel remove.

Prototype

@Override
    public boolean remove(Widget w) 

Source Link

Usage

From source file:com.dimdim.conference.ui.common.client.list.ListEntryPanel.java

License:Open Source License

protected Image setImage(DockPanel imagePanel, Image image, Image imageUrl, ClickListener clickListener,
        HorizontalPanel subPanel, String tooltip, boolean rightAlign) {
    Image image2 = image;//  www.  j  a v a  2  s  .c  om
    if (image != null) {
        //Window.alert("prev image = is not null");
        if (subPanel != null) {
            //Window.alert("subpanel = is not null so removing..");
            subPanel.remove(image);
            image2 = null;
        } else if (imagePanel != null) {
            imagePanel.remove(image);
            image2 = null;
        }

    }
    if (imageUrl != null) {
        /*
        if (imageUrl.endsWith("xxx"))
        {
           Image image = new Image(imageUrl);
           image.addStyleName("list-entry-panel-image");
           imagePanel.add(image,DockPanel.WEST);
           imagePanel.setCellHorizontalAlignment(image,HorizontalPanel.ALIGN_CENTER);
           imagePanel.setCellVerticalAlignment(image,VerticalPanel.ALIGN_MIDDLE);
           if (clickListener != null)
           {
              image.addClickListener(clickListener);
           }
        }
        else
        */
        //         else
        {
            image2 = imageUrl;
            image2.addStyleName("list-entry-panel-image");
            if (subPanel != null) {
                subPanel.add(image2);
                subPanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                subPanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
            } else {
                if (rightAlign) {
                    imagePanel.add(image2, DockPanel.EAST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_RIGHT);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                } else {
                    imagePanel.add(image2, DockPanel.WEST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                }
            }
            if (clickListener != null) {
                image2.addClickListener(clickListener);
                //image2.addStyleName("anchor-cursor");
            }
            if (tooltip != null) {
                image2.setTitle(tooltip);
            }
        }
    }
    return image2;
}

From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPanel.java

License:Open Source License

protected Image setImage(DockPanel imagePanel, Image currentImage, Image newImage, ClickListener clickListener,
        HorizontalPanel subPanel, String tooltip, boolean rightAlign) {
    Image image2 = currentImage;/*from   w w  w  .ja  va 2s  .  c  o  m*/
    if (currentImage != null) {
        if (subPanel != null) {
            //Window.alert("subpanel = is not null so removing..");
            subPanel.remove(currentImage);
            image2 = null;
        } else if (imagePanel != null) {
            imagePanel.remove(currentImage);
            image2 = null;
        }
    }
    if (newImage != null) {
        {
            image2 = newImage;
            image2.addStyleName("list-entry-panel-image");
            if (subPanel != null) {
                subPanel.add(image2);
                subPanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                subPanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
            } else {
                if (rightAlign) {
                    imagePanel.add(image2, DockPanel.EAST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_RIGHT);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                } else {
                    imagePanel.add(image2, DockPanel.WEST);
                    imagePanel.setCellHorizontalAlignment(image2, HorizontalPanel.ALIGN_CENTER);
                    imagePanel.setCellVerticalAlignment(image2, VerticalPanel.ALIGN_MIDDLE);
                }
            }
            if (clickListener != null) {
                image2.addClickListener(clickListener);
                //image2.addStyleName("anchor-cursor");
            }
            if (tooltip != null) {
                image2.setTitle(tooltip);
            }
        }
    }
    return image2;
}

From source file:edu.caltech.ipac.firefly.ui.panels.SearchPanel.java

private void layout() {

    formPanel.clear();//from  w w w.  ja v  a  2s.  co  m
    navPanel.clear();

    if (lists.size() == 1 && lists.get(0).getWidgetCount() == 1) {
        navPanel.setVisible(false);
        if (navPanel.getParent() instanceof DockPanel) {
            DockPanel dp = (DockPanel) navPanel.getParent();
            dp.remove(navPanel);
        }
    } else {
        for (int i = 0; i < lists.size(); i++) {
            if (i != 0) {
                SimplePanel spacer = new SimplePanel();
                spacer.setPixelSize(1, 10);
                navPanel.add(spacer);
            }
            LinksPanel.ULList l = lists.get(i);
            if (l != null) {
                navPanel.add(l);
            }
        }
    }
}

From source file:fr.aliasource.webmail.client.composer.AttachmentUploadWidget.java

License:GNU General Public License

private void buildUpload(final DockPanel dp) {
    setEncoding(FormPanel.ENCODING_MULTIPART);
    setMethod(FormPanel.METHOD_POST);//from   w ww  . ja v  a 2 s. c om
    setAction(GWT.getModuleBaseURL() + "attachements");

    Label l = new Label();
    dp.add(l, DockPanel.WEST);
    dp.setCellVerticalAlignment(l, VerticalPanel.ALIGN_MIDDLE);
    upload = new FileUpload();
    upload.setName(attachementId);
    dp.add(upload, DockPanel.CENTER);

    droppAttachmentLink = new Anchor(I18N.strings.delete());
    droppAttachmentLink.addClickHandler(createDropAttachmentClickListener());
    HorizontalPanel eastPanel = new HorizontalPanel();
    upSpinner = new Image("minig/images/spinner_moz.gif");
    upSpinner.setVisible(false);
    eastPanel.add(upSpinner);
    eastPanel.add(droppAttachmentLink);
    dp.add(eastPanel, DockPanel.EAST);

    addSubmitHandler(new SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            GWT.log("on submit " + attachementId, null);
            upSpinner.setVisible(true);
            droppAttachmentLink.setVisible(false);
            attachPanel.notifyUploadStarted(attachementId);

        }
    });

    addSubmitCompleteHandler(new SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            GWT.log("on submit complete " + attachementId, null);
            upSpinner.setVisible(false);
            droppAttachmentLink.setVisible(true);
            attachPanel.notifyUploadComplete(attachementId);

            HorizontalPanel hp = new HorizontalPanel();
            Label uploadInfo = new Label();
            uploadInfo.setText("File '" + attachementId + "' attached.");
            hp.add(uploadInfo);

            dp.remove(upload);
            dp.add(hp, DockPanel.CENTER);
            updateMetadata(hp);
        }
    });

    Timer t = new Timer() {
        public void run() {
            if (upload.getFilename() != null && upload.getFilename().length() > 0) {
                GWT.log("filename before upload: " + upload.getFilename(), null);
                cancel();
                submit();
            }
        }
    };
    t.scheduleRepeating(300);
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationOpera.java

License:Apache License

/**
 * Reflects an image/*from   w w w .  j  av  a 2  s . c  om*/
 */
@Override
public void reflectImage(NEffectPanel thePanel, int height, double opacity, int gap, boolean setUp) {

    DockPanel container;
    Widget w;
    Canvas v;
    SimplePanel gapPanel;

    if (setUp) {
        w = (Image) ((DockPanel) thePanel.getPanelWidget()).getWidget(0);
        v = (Canvas) ((DockPanel) thePanel.getPanelWidget()).getWidget(WHERE_IS_REFLECTION);
        v.setSize(1, 1);
        // v = new Canvas();
        container = (DockPanel) thePanel.getPanelWidget();
        // Remove from panel now as this may make any animations look much
        // smoother
        // If not, there is a danger on slow(er) systems that the reflection hangs
        // out from image until re-drawn.
        container.remove(WHERE_IS_REFLECTION);
    } else {
        container = new DockPanel();
        w = getReflectedImage(thePanel, setUp);
        v = new Canvas();
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML("&nbsp;"));
    gapPanel.setHeight(gap + "px");

    int imgHeight = w.getOffsetHeight();
    int canvasHeight = (int) ((imgHeight * height) / 100);

    reflect(v.getElement(), w.getElement(), canvasHeight, opacity);

    if (setUp) {
        container.add(v, DockPanel.SOUTH);
    } else {
        container.add(w, DockPanel.NORTH);
        container.add(v, DockPanel.SOUTH);
        thePanel.add(container);
    }
    container.add(gapPanel, DockPanel.CENTER);
    container.getElement().getStyle().setProperty("overflow", "hidden");
    //DOM.setElementAttribute(container.getElement(), "overflow", "hidden");
    container.setHeight(imgHeight + canvasHeight + "px");
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationStandard.java

License:Apache License

/**
 * Reflects an image by creating a DockPanel where the original image is place
 * in the top and a canvas object containing a refection of the original image
 * is placed below. At the moment I can't seem to reuse the original canvas so
 * if any action is performed requiring the reflection to be re-drawn a new
 * canvas object is required (compare that to the Opera version where reuse is
 * possible)/*  ww w  . ja  v a  2s . c o  m*/
 * 
 * @param gap
 */
public void reflectImage(NEffectPanel thePanel, int height, double opacity, int gap, boolean setUp) {

    DockPanel container;
    Widget w;
    SimplePanel gapPanel;
    Canvas v;

    w = getReflectedImage(thePanel, setUp);
    if (setUp) {
        v = new Canvas();
        container = (DockPanel) thePanel.getPanelWidget();
        // Remove from panel now as this may make any animations look much
        // smoother
        // If not, there is a danger on slow(er) systems that the reflection hangs
        // out from image until re-drawn.
        container.remove(WHERE_IS_REFLECTION);
    } else {
        container = new DockPanel();
        v = new Canvas();
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML("&nbsp;"));
    gapPanel.setHeight(gap + "px");

    int imgWidth = w.getOffsetWidth();
    int imgHeight = w.getOffsetHeight();
    int canvasHeight = (int) ((imgHeight * height) / 100);
    v.setSize(imgWidth, canvasHeight);

    reflect(v.getElement(), w.getElement(), canvasHeight, opacity);
    if (setUp) {
        container.add(v, DockPanel.SOUTH);
    } else {
        container.add(w, DockPanel.NORTH);
        container.add(v, DockPanel.SOUTH);
        thePanel.add(container);
    }
    container.add(gapPanel, DockPanel.CENTER);
}