Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

com.smartgwt.client.widgets.Label aren't created in the compiled version but for FF

$
0
0
Hello,

I'm using the 4.1d I have dowloaded today 22.11.

This code, which produces some Label that can be dragged, works on all browsers in development mode. Compiled only in Firefox 24...The labels aren't simply created....Any hints?

Code:

package test.client;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.FocusChangedEvent;
import com.smartgwt.client.widgets.events.FocusChangedHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripButton;

public class TestDrawPane extends ToolStrip implements EntryPoint {

        Label m_oSelectedLabel;

        public void onModuleLoad() {
                final VLayout m_oImageFrame = new VLayout();
               
                ToolStripButton m_oAddTextButton = new ToolStripButton();
                m_oAddTextButton.setIcon("[SKIN]/MultiUploadItem/icon_add_files.png");
                m_oAddTextButton.setPrompt("Add Text");

                ClickHandler oClickHandler = new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                                final Label newText = createLabel();
                                newText.setCanDrag(true);

                                FocusChangedHandler oFocusHandler = new FocusChangedHandler() {
                                        @Override
                                        public void onFocusChanged(FocusChangedEvent event) {
                                                if (event.getHasFocus()) {
                                                        m_oSelectedLabel = newText;
                                                }
                                        }
                                };
                                newText.setCanFocus(true);
                                newText.addFocusChangedHandler(oFocusHandler);
                                newText.setCanDrag(true);

                                m_oImageFrame.addChild(newText);
                                // add a Container

                                newText.moveTo(m_oImageFrame.getAbsoluteLeft(),
                                                m_oImageFrame.getAbsoluteTop());

                        }
                };
                m_oAddTextButton.addClickHandler(oClickHandler);
                addButton(m_oAddTextButton);
                m_oImageFrame.addMember(this);
                m_oImageFrame.draw();
        }

        private Label createLabel() {
                Label label = new Label("Ciao");

                label.setPadding(0);
                label.setMargin(0);
                label.setWidth(100);
                label.setOpacity(30);
                label.setBackgroundColor("white");
                label.setCanDragResize(true);

                label.setDragAppearance(DragAppearance.TARGET);
                label.setShowEdges(false);
                label.setKeepInParentRect(true);
                label.setCanDrag(true);

                return label;
        }

}

Thank you for your help
Regards
Fabio

Viewing all articles
Browse latest Browse all 4756

Trending Articles