Example usage for com.google.gwt.user.client.ui Label addMouseListener

List of usage examples for com.google.gwt.user.client.ui Label addMouseListener

Introduction

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

Prototype

@Deprecated
public void addMouseListener(MouseListener listener) 

Source Link

Usage

From source file:com.dimdim.conference.ui.common.client.user.NewChatPanel.java

License:Open Source License

/**
 * Same chat panel is used for global as well as personal chats. Global
 * chat is simply identified by using 'other' argument as null.
 *//*from w  ww .  ja  v a  2 s  .c o  m*/
public NewChatPanel(UIRosterEntry me, UIRosterEntry other) {
    this.me = me;
    this.other = other;
    if (other != null) {
        this.toId = other.getUserId();
    }
    this.lastActivityTime = System.currentTimeMillis();
    if (ConferenceGlobals.isBrowserIE()) {
        spaceSequence = "DIMDIM_LTwbr>";
    }

    //   Add the central scroll panel that will hold the messages.

    scrollPanel = new ScrollPanel();
    scrollPanel.add(this.chatMessages);
    scrollPanel.setStyleName("dm-chat-message-area");

    //   A small and short instructions / message area.

    instructionPanel = new HorizontalPanel();
    instructionPanel.setStyleName("chat-instruction-panel");
    instructionPanel.setWidth("248px");

    //in public chat add powered by dimdim logo else have the help text
    if (null == toId) {
        HorizontalPanel hp = new HorizontalPanel();

        HorizontalPanel tempSpacer = new HorizontalPanel();
        tempSpacer.setWidth("10px");
        tempSpacer.add(new Label("  "));
        hp.add(tempSpacer);
        hp.setCellHorizontalAlignment(tempSpacer, HorizontalPanel.ALIGN_LEFT);
        hp.setCellVerticalAlignment(tempSpacer, VerticalPanel.ALIGN_MIDDLE);

        PNGImage image = new PNGImage("images/logo_powered.png", 8, 14);
        hp.add(image);
        //instructionPanel.setCellWidth(image,"100%");
        hp.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT);
        hp.setCellVerticalAlignment(image, VerticalPanel.ALIGN_MIDDLE);

        //hp.setBorderWidth(1);
        HTML instruction = new HTML("Powered By <a href='#'><u> Dimdim </u></a>");
        instruction.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                openDimdimWebSite();
            }
        });
        instruction.setStyleName("poweredby-text");
        hp.add(instruction);
        //instructionPanel.setCellWidth(instruction,"100%");
        hp.setCellHorizontalAlignment(instruction, HorizontalPanel.ALIGN_LEFT);
        hp.setCellVerticalAlignment(instruction, VerticalPanel.ALIGN_MIDDLE);

        instructionPanel.add(hp);
        //instructionPanel.setCellWidth(instruction,"100%");
        instructionPanel.setCellHorizontalAlignment(hp, HorizontalPanel.ALIGN_LEFT);
        instructionPanel.setCellVerticalAlignment(hp, VerticalPanel.ALIGN_MIDDLE);

    } else {
        Label instruction = new Label(UIStrings.getChatPanelInstruction());
        instruction.setStyleName("chat-instruction");
        instructionPanel.add(instruction);
        //instructionPanel.setCellWidth(instruction,"100%");
        instructionPanel.setCellHorizontalAlignment(instruction, HorizontalPanel.ALIGN_LEFT);
        instructionPanel.setCellVerticalAlignment(instruction, VerticalPanel.ALIGN_MIDDLE);
    }

    Label emoticon = new Label(UIStrings.getChatPanelEmoticonInstruction());
    emoticon.setStyleName("chat-emoticon-lable");
    instructionPanel.add(emoticon);
    //instructionPanel.setCellWidth(emoticon,"30%");
    instructionPanel.setCellHorizontalAlignment(emoticon, HorizontalPanel.ALIGN_RIGHT);
    instructionPanel.setCellVerticalAlignment(emoticon, VerticalPanel.ALIGN_MIDDLE);

    //   Add the text area that the users will type their messages in.

    sendText = new TextArea();
    sendText.setText("");
    if (null == toId) {
        sendText.setText(UIStrings.getChatPanelInstruction());
        sendText.setStyleName("chat-instruction");
    }
    //if (ConferenceGlobals.isBrowserIE())
    //{
    sendText.setVisibleLines(2);
    //}
    //else
    //{
    //   sendText.setVisibleLines(1);
    //}
    sendText.setStyleName("chat-text-area");

    keyboardListener = new KeyboardListenerAdapter() {
        public void onKeyDown(Widget sender, char keyCode, int modifiers) {
        }

        public void onKeyUp(Widget sender, char keyCode, int modifiers) {
            if (keyCode == KeyboardListener.KEY_ENTER) {
                sendChatMessage();
            }
        }
    };
    sendText.addKeyboardListener(keyboardListener);
    sendText.addFocusListener(this);

    //   Assemble the overall chat panel.

    initWidget(pane);
    pane.setWidth("100%");
    pane.add(outer);
    outer.setWidth("100%");

    outer.add(scrollPanel);
    scrollPanel.addStyleName("dm-chat-message-area-pane");

    outer.add(this.instructionPanel);
    outer.setCellWidth(this.instructionPanel, "100%");
    outer.setCellHorizontalAlignment(this.instructionPanel, HorizontalPanel.ALIGN_LEFT);

    outer.add(this.sendText);
    outer.setCellWidth(this.sendText, "100%");
    outer.setCellHorizontalAlignment(this.sendText, HorizontalPanel.ALIGN_CENTER);
    this.sendText.setStyleName("dm-chat-text-area");

    this.rosterModel = ClientModel.getClientModel().getRosterModel();

    //      Window.alert("created popup..");
    //setting up emoticons popup panel
    ePopUP = new EmoticonsPopup(sendText);
    emoticon.addMouseListener(new MouseListenerAdapter() {
        public void onMouseEnter(Widget sender) {
            int left = sender.getAbsoluteLeft() - 5;
            int top = sender.getAbsoluteTop() - 75;
            ePopUP.setPopupPosition(left, top);
            ePopUP.showHoverPopup();
            ePopUP.popupVisible();
        }
    });

    if (emoticonsMap == null) {
        emoticonsMap = new HashMap();
        prepareEmoticonsList();
        //         this is to handle :) and :( also         
    }
}

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

License:Open Source License

private void writeListPanel(DockPanel outer) {
    Vector vec = new Vector();
    UIResourceObject currentActiveResource = ConferenceGlobals.getCurrentSharedResource();
    numberOfItems = 0;//w  ww .  j  a  v  a  2s  .c  o  m

    int size = this.resourceList.getListSize();
    for (int i = 0; i < size; i++) {
        UIResourceObject res = ((ResourceListEntry) this.resourceList.getListEntryAt(i)).getResource();
        if (res.getResourceType().equals(this.typeName)) {
            Label resLabel = new FixedLengthLabel(res.getResourceName(), 26);
            //            resLabel.setStyleName("tool-entry");
            resLabel.setStyleName("resource-entry");
            resLabel.addStyleName("anchor-cursor");
            resLabel.addClickListener(this);
            resLabel.addClickListener(this.rtpcp.getNameLabelClickListener(res));

            HorizontalPanel h1 = new HorizontalPanel();
            Widget img = new HorizontalPanel();

            if (currentActiveResource != null
                    && currentActiveResource.getResourceId().equals(res.getResourceId())) {
                img = this.getSharingInProgressImageUrl();
                //               h2.add(img);
                //               h2.setCellVerticalAlignment(img, VerticalPanel.ALIGN_MIDDLE);
                //               h2.setCellHorizontalAlignment(img, HorizontalPanel.ALIGN_CENTER);
            } else {
                img = new Label(" ");
                img.setWidth("18px");
                //               h2.add(filler);
            }
            //            h2.setWidth("18px");
            h1.add(img);
            //            h1.setCellWidth(img, "100%");
            h1.setCellHeight(img, "100%");
            h1.setCellHorizontalAlignment(img, HorizontalPanel.ALIGN_LEFT);
            h1.setCellVerticalAlignment(img, VerticalPanel.ALIGN_MIDDLE);
            h1.add(resLabel);
            h1.setCellWidth(resLabel, "100%");
            h1.setCellHeight(resLabel, "100%");
            h1.setCellVerticalAlignment(resLabel, VerticalPanel.ALIGN_MIDDLE);
            h1.setStyleName("resource-entry-panel");
            if (numberOfItems == 0) {
                h1.addStyleName("first-resource-entry-panel");
            }
            resLabel.addMouseListener(new ResourceHoverStyler(h1));
            vec.add(h1);
            //            panel.add(h1);
            //            panel.setCellWidth(h1, "100%");
            //            panel.setCellHorizontalAlignment(h1, HorizontalPanel.ALIGN_LEFT);
            //            panel.setCellVerticalAlignment(h1, VerticalPanel.ALIGN_MIDDLE);
            numberOfItems++;
        }
    }

    if (numberOfItems != 0) {
        int scrollLimit = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_limit", 5);
        if (numberOfItems > scrollLimit) {
            ScrollPanel sp = new ScrollPanel();
            int width = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_width", 250);
            int barWidth = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_bar_width",
                    250);
            int height = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_height", 150);
            sp.setSize(width + "px", height + "px");
            VerticalPanel panel = new VerticalPanel();
            panel.setSize((width - barWidth) + "px", height + "px");
            sp.add(panel);
            outer.add(sp, DockPanel.NORTH);
            outer.setCellHorizontalAlignment(sp, HorizontalPanel.ALIGN_LEFT);
            outer.setCellVerticalAlignment(sp, VerticalPanel.ALIGN_MIDDLE);
            int size2 = vec.size();
            for (int i = 0; i < size2; i++) {
                HorizontalPanel h = (HorizontalPanel) vec.elementAt(i);
                panel.add(h);
                panel.setCellWidth(h, "100%");
                panel.setCellHorizontalAlignment(h, HorizontalPanel.ALIGN_LEFT);
                panel.setCellVerticalAlignment(h, VerticalPanel.ALIGN_MIDDLE);
            }
        } else {
            int size2 = vec.size();
            for (int i = 0; i < size2; i++) {
                HorizontalPanel h = (HorizontalPanel) vec.elementAt(i);
                outer.add(h, DockPanel.NORTH);
                outer.setCellWidth(h, "100%");
                outer.setCellHorizontalAlignment(h, HorizontalPanel.ALIGN_LEFT);
                outer.setCellVerticalAlignment(h, VerticalPanel.ALIGN_MIDDLE);
            }
        }
    } else {
    }
}

From source file:com.dimdim.conference.ui.user.client.MoodControlPopup.java

License:Open Source License

protected HorizontalPanel getMoodPanel(UserMood mood, boolean custom) {
    /*/*from  w w w  .j  a  v  a 2s .  co m*/
    FocusPanel   pane = new FocusPanel();
    pane.addMouseListener(new MouseListenerAdapter()
    {
       public void onMouseEnter(Widget sender)
       {
    sender.addStyleName("mood-menu-entry-selected");
       }
       public void onMouseLeave(Widget sender)
       {
    sender.removeStyleName("mood-menu-entry-selected");
       }
    });
    */
    final HorizontalPanel moodPanel = new HorizontalPanel();
    //      pane.add(moodPanel);
    moodPanel.setStyleName("mood-menu-entry");
    if (!custom) {
        moodPanel.addStyleName("mood-menu-entry-border");
    }
    Image moodImage = UIImages.getImageBundle(UIImages.defaultSkin).getNewMoodImageUrl(mood.getMood());
    moodImage.setStyleName(mood.getImageStyleName());
    moodPanel.add(moodImage);
    moodPanel.setCellVerticalAlignment(moodImage, VerticalPanel.ALIGN_MIDDLE);

    Label moodLabel = getMoodLabel(mood, custom);
    moodLabel.addStyleName("mood-label");
    moodPanel.add(moodLabel);
    moodPanel.setCellVerticalAlignment(moodLabel, VerticalPanel.ALIGN_MIDDLE);
    moodLabel.addMouseListener(new MouseListenerAdapter() {
        public void onMouseEnter(Widget sender) {
            moodPanel.addStyleName("mood-menu-entry-selected");
        }

        public void onMouseLeave(Widget sender) {
            moodPanel.removeStyleName("mood-menu-entry-selected");
        }
    });
    moodPanel.setTitle(mood.getDisplayLabel());
    return moodPanel;
}

From source file:com.dimdim.conference.ui.user.client.UserListEntryHoverPopup.java

License:Open Source License

/**
 * This will create a menu item with one label
 * @param panel/*  w  ww. j  a  v a 2s.co m*/
 * @param labelText
 * @param clickListener
 * @param hideOnClick
 */
private void addMoodControl(VerticalPanel panel, String labelText, ClickListener clickListener,
        boolean hideOnClick) {
    HorizontalPanel imageNText = new HorizontalPanel();
    //      FocusPanel   focusPanel = new FocusPanel();
    Label lbl = new Label(labelText);
    lbl.setStyleName("user-menu-entry");
    imageNText.add(lbl);
    imageNText.setCellHorizontalAlignment(lbl, HorizontalPanel.ALIGN_LEFT);

    HTML lbl2 = new HTML("&raquo;");
    //lbl2.setStyleName("user-menu-item");
    imageNText.add(lbl2);
    imageNText.setCellHorizontalAlignment(lbl2, HorizontalPanel.ALIGN_RIGHT);
    imageNText.setCellWidth(lbl, "100%");
    imageNText.setCellHeight(lbl2, "100%");
    imageNText.setWidth("100%");
    //imageNText.setBorderWidth(1);
    //      focusPanel.add(imageNText);

    if (null != clickListener) {
        HoverStyler hs = new HoverStyler(moodListener, imageNText, null);
        lbl.addMouseListener(hs);
        lbl.addStyleName("user-menu-entry-enabled");
        lbl.addClickListener(clickListener);
        lbl2.addMouseListener(hs);
        lbl2.addClickListener(clickListener);
    } else {
        lbl.addStyleName("user-menu-entry-disabled");
    }
    if (hideOnClick) {
        ClickListener clickListener2 = new ClickListener() {
            public void onClick(Widget w) {
                //Window.alert(" clicked on an item now hiding menu");
                hide();
            }
        };
        lbl.addClickListener(clickListener2);
    }

    panel.add(imageNText);
    panel.setCellWidth(imageNText, "100%");
}

From source file:com.dimdim.conference.ui.user.client.UserListEntryHoverPopup.java

License:Open Source License

/**
 * This will create a menu item with one label
 * @param panel/*from  www.j av  a2  s  .com*/
 * @param labelText
 * @param clickListener
 * @param hideOnClick
 */
private void addControl(VerticalPanel panel, String labelText, ClickListener clickListener,
        boolean hideOnClick) {
    //      HorizontalPanel imageNText = new HorizontalPanel();
    //      FocusPanel   focusPanel = new FocusPanel();
    Label lbl = new Label(labelText);
    //      lbl.setStyleName("user-menu-item");
    lbl.setStyleName("user-menu-entry");
    //      imageNText.add(lbl);
    //      imageNText.setCellWidth(lbl, "100%");
    //      imageNText.setCellHorizontalAlignment(lbl, HorizontalPanel.ALIGN_LEFT);

    //      focusPanel.add(imageNText);
    if (null != clickListener) {
        lbl.addMouseListener(new HoverStyler(moodListener));
        lbl.addStyleName("user-menu-entry-enabled");
        lbl.addClickListener(clickListener);
    } else {
        lbl.addStyleName("user-menu-entry-disabled");
    }
    if (hideOnClick) {
        ClickListener clickListener2 = new ClickListener() {
            public void onClick(Widget w) {
                //Window.alert(" clicked on an item now hiding menu");
                hide();
            }
        };
        lbl.addClickListener(clickListener2);
    }
    panel.add(lbl);
    panel.setCellWidth(lbl, "100%");
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.ContextMenu.java

License:Open Source License

/**
 * @deprecated/*  ww w. j  a  v  a2  s. c  om*/
 * @param l
 * @param cL
 */
public void addElement(Label l, ClickListener cL) {
    l.addClickListener(cL);
    l.addClickHandler(hideOnClickHandler);
    l.addStyleName("contextMenuItem");
    l.addMouseListener(new DataEmbededMouseListener<Label>(l) {

        public void onMouseEnter(Widget sender) {
            data.addStyleName("contextMenuItemHover");
        }

        public void onMouseLeave(Widget sender) {
            data.removeStyleName("contextMenuItemHover");
        }

        public void onMouseDown(Widget sender, int x, int y) {
        }

        public void onMouseMove(Widget sender, int x, int y) {
        }

        public void onMouseUp(Widget sender, int x, int y) {
        }
    });
    vP.add(l);
}