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

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

Introduction

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

Prototype

public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) 

Source Link

Usage

From source file:cimav.visorglass.client.widgets.PanelesLayout.java

License:Apache License

public PanelesLayout(GWTServiceAsync gwtServiceAsync) {
    initWidget(uiBinder.createAndBindUi(this));

    this.gwtServiceAsync = gwtServiceAsync;

    // Crea el Modelo
    arbolModel = new ArbolModel();
    // Crea el node Root
    TreeItem root = new TreeItem(SafeHtmlUtils.fromString("<h2>La Root</h2>"));
    // Cambia  Recursos del Arbol
    CellTree.Resources cellTreeResources = GWT.create(ICellTreeResources.class);
    CellTree.CellTreeMessages cellTreeMsgs = GWT.<CellTree.CellTreeMessages>create(ICellTreeMessages.class);
    // Crea el arbol
    cellArbol = new CellTree(arbolModel, root, cellTreeResources, cellTreeMsgs);
    cellArbol.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.ENABLED);
    // agrega el arbol a su Panel
    //flowPanelArbol.add(cellArbol);
    cellArbol.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    cellArbol.getElement().getStyle().setTop(10, Style.Unit.PX);
    cellArbol.getElement().getStyle().setLeft(0, Style.Unit.PX);
    cellArbol.getElement().getStyle().setBottom(0, Style.Unit.PX);
    cellArbol.getElement().getStyle().setRight(0, Style.Unit.PX);
    scrollPanelArbol.add(cellArbol);//from   ww  w .  j  av  a  2 s.c  o m
    /* Inyectarle style absolute al Abuelo para que funcione el scroll del cellArbol */
    Element divAbue2 = cellArbol.getElement().getParentElement().getParentElement();
    divAbue2.getStyle().setPosition(Style.Position.ABSOLUTE);
    divAbue2.getStyle().setTop(0, Style.Unit.PX);
    divAbue2.getStyle().setLeft(0, Style.Unit.PX);
    divAbue2.getStyle().setBottom(0, Style.Unit.PX);
    divAbue2.getStyle().setRight(0, Style.Unit.PX);

    // Crea CellList de Documentos, sus resources, su Celda, su SelectionModel y su Listener.
    documentoSelectionModel = new SingleSelectionModel<Documento>();
    CellList.Resources cellListResources = GWT.create(ICellListResources.class);
    documentosCellList = new CellList<Documento>(new DocumentoCell(documentoSelectionModel), cellListResources);
    documentosCellList.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.ENABLED);
    documentosCellList.setSelectionModel(documentoSelectionModel);
    documentosCellList.setPageSize(500);
    // listener
    documentoSelectionModel.addSelectionChangeHandler(new DocumentoSelectionHandler());
    // Style absolute
    documentosCellList.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    documentosCellList.getElement().getStyle().setTop(0, Style.Unit.PX);
    documentosCellList.getElement().getStyle().setLeft(0, Style.Unit.PX);
    documentosCellList.getElement().getStyle().setBottom(0, Style.Unit.PX);
    documentosCellList.getElement().getStyle().setRight(0, Style.Unit.PX);
    // Agregarlo a su panel
    scrollPanelDocumentos.add(documentosCellList);

    /* Inyectarle style absolute al Abuelo para que funcione el scroll del cellList */
    Element divAbue = documentosCellList.getElement().getParentElement().getParentElement();
    divAbue.getStyle().setPosition(Style.Position.ABSOLUTE);
    divAbue.getStyle().setTop(0, Style.Unit.PX);
    divAbue.getStyle().setLeft(0, Style.Unit.PX);
    divAbue.getStyle().setBottom(0, Style.Unit.PX);
    divAbue.getStyle().setRight(0, Style.Unit.PX);

    // Listener de los Botones de Paneles
    btnArbol.addClickHandler(new BtnArbolClickHandler());
    btnDocumentos.addClickHandler(new BtnDocumentosClickHandler());
    btnVisor.addClickHandler(new BtnVisorClickHandler());

    // Arega etiquetas flotantes y sus listeners
    Label arbolLabel = new Label("Arbol");
    arbolLabel.setStyleName("jsfiddle_label");
    arbolLabel.addMouseOverHandler(new JSFiddlerMouseOver());
    arbolLabel.addMouseOutHandler(new JSFiddlerMouseOut());
    flowPanelArbol.add(arbolLabel);
    documentosLabel = new Label("Documentos");
    documentosLabel.setStyleName("jsfiddle_label");
    documentosLabel.addMouseOverHandler(new JSFiddlerMouseOver());
    documentosLabel.addMouseOutHandler(new JSFiddlerMouseOut());
    flowPanelDecoratorDocumentos.add(documentosLabel);
    Label visorLabel = new Label("Visor");
    visorLabel.setStyleName("jsfiddle_label");
    visorLabel.addMouseOverHandler(new JSFiddlerMouseOver());
    visorLabel.addMouseOutHandler(new JSFiddlerMouseOut());
    flowPanelDecoratorVisor.add(visorLabel);

    frameDocViewer.addLoadHandler(new FrameLoadHandler());

    reloadIcon = new Icon(IconType.ROTATE_RIGHT);
    reloadIcon.setSize(IconSize.LARGE);
    reloadIcon.setMuted(false);
    reloadIcon.setSpin(false);
    reloadIcon.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    reloadIcon.getElement().getStyle().setTop(3, Style.Unit.PX);
    reloadIcon.getElement().getStyle().setLeft(3, Style.Unit.PX);
    reloadIcon.getElement().getStyle().setColor("gray");
    reloadIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    reloadIcon.addDomHandler(new ReloadGoogleDocMouseDownHandler(), MouseDownEvent.getType());
    //        flowPanelDecoratorVisor.add(reloadIcon);

    // NOTE Quitar documentos 
    btnDocumentos.setVisible(false);

}

From source file:com.ait.toolkit.clientio.uploader.client.Uploader.java

License:Apache License

@Override
protected void onLoad() {

    // Make sure our entire panel fits the size that they wanted for the button
    if (this.buttonWidth >= 0) {
        this.setWidth(this.buttonWidth + "px");
    }/*from  w w  w  .j a  v a 2 s .  c  om*/
    if (this.buttonHeight >= 0) {
        this.setHeight(this.buttonHeight + "px");
    }

    if (ajaxUploadEnabled && isAjaxUploadWithProgressEventsSupported()) {

        // If the browser supports the XMLHttpRequest Level 2 type then we can avoid rendering the flash component
        // and just stick with a DOM/Ajax approach.

        // Use a hidden file input component to handle allowing the user to popup the file system dialog
        // (but keep it outside of the button itself so it doesn't interfere with the mouse events)
        this.add(createFileUpload());

        // Create the main element that will hold all of the inner workings of the uploader component
        Label button = new Label();
        button.setWidth("100%");
        button.setHeight("100%");
        if (this.buttonCursor != null) {
            switch (this.buttonCursor) {
            case ARROW:
                button.getElement().getStyle().setCursor(Style.Cursor.DEFAULT);
                break;
            case HAND:
                button.getElement().getStyle().setCursor(Style.Cursor.POINTER);
                break;
            }
        }

        // Setup what we want to happen when someone clicks anywhere on the button
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                if (buttonDisabled) {
                    return;
                }
                switch (buttonAction) {
                case START_UPLOAD:
                    startUpload();
                    break;
                case SELECT_FILES:
                    openFileDialog(fileUpload, true);
                    break;
                case SELECT_FILE:
                default:
                    openFileDialog(fileUpload, false);
                    break;
                }
            }
        });

        button.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(MouseOverEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition",
                            "0px -" + buttonHeight + "px");
                }
            }
        });
        button.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(MouseOutEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition", "0px 0px");
                }
            }
        });
        button.addMouseDownHandler(new MouseDownHandler() {
            public void onMouseDown(MouseDownEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition",
                            "0px -" + (buttonHeight * 2) + "px");
                }
            }
        });
        button.addMouseUpHandler(new MouseUpHandler() {
            public void onMouseUp(MouseUpEvent event) {
                if (buttonImageURL != null && buttonHeight >= 0 && !buttonDisabled) {
                    buttonImageElement.getStyle().setProperty("backgroundPosition", "0px 0px");
                }
            }
        });

        // Depending on the way they wanted the uploader button rendered, create the appropriate elements
        // in the DOM that the user will click on.
        if (this.buttonTextStyle != null) {
            buttonTextStyleElement = Document.get().createStyleElement();
            buttonTextStyleElement.setInnerText(this.buttonTextStyle);
            button.getElement().appendChild(buttonTextStyleElement);
        }
        if (this.buttonText != null) {
            buttonTextElement = Document.get().createDivElement();
            buttonTextElement.setInnerHTML(this.buttonText);
            buttonTextElement.getStyle().setWidth(100, Style.Unit.PCT);
            buttonTextElement.getStyle().setHeight(100, Style.Unit.PCT);
            if (this.buttonTextLeftPadding > Integer.MIN_VALUE) {
                buttonTextElement.getStyle().setPaddingLeft(this.buttonTextLeftPadding, Style.Unit.PX);
            }
            if (this.buttonTextTopPadding > Integer.MIN_VALUE) {
                buttonTextElement.getStyle().setPaddingTop(this.buttonTextTopPadding, Style.Unit.PX);
            }
            button.getElement().appendChild(buttonTextElement);
        }

        if (this.buttonImageURL != null) {
            buttonImageElement = Document.get().createDivElement();
            buttonImageElement.getStyle().setBackgroundImage("url(\"" + this.buttonImageURL + "\")");
            if (this.buttonDisabled) {
                buttonImageElement.getStyle().setProperty("backgroundPosition",
                        "0px -" + (buttonHeight * 3) + "px");
            } else {
                buttonImageElement.getStyle().setProperty("backgroundPosition", "0px 0px");
            }
            buttonImageElement.getStyle().setWidth(100, Style.Unit.PCT);
            buttonImageElement.getStyle().setHeight(100, Style.Unit.PCT);
            button.getElement().appendChild(buttonImageElement);
        }

        // Add the entire button to the DOM
        this.add(button);

    } else {

        // If the browser doesn't support the XMLHttpRequest Level 2 type, then our only option is to use
        // the Flash/SWFUpload component.

        // The SWFUpload JS code completely replaces the DOM element that you give it as a target,
        // so we're creating an inner component that it can replace - leaving the outer component
        // for the caller to use as the GWT Widget that they can manage and style within the appropriate
        // container within their GWT application
        DivElement swfUploadElement = Document.get().createDivElement();
        swfUploadElement.setId(Document.get().createUniqueId());
        this.getElement().appendChild(swfUploadElement);

        JavaScriptObject nativeOptions = createNativeOptions(swfUploadElement.getId());

        // Build a map that we'll use during the native creation process to setup
        // the necessary JSNI bridges to our Java event handlers...
        JSONObject eventHandlers = new JSONObject();
        eventHandlers.put("swfupload_loaded_handler", JSONBoolean.getInstance(swfUploadLoadedHandler != null));
        eventHandlers.put("file_dialog_start_handler", JSONBoolean.getInstance(fileDialogStartHandler != null));
        eventHandlers.put("file_queued_handler", JSONBoolean.getInstance(fileQueuedHandler != null));
        eventHandlers.put("file_queue_error_handler", JSONBoolean.getInstance(fileQueueErrorHandler != null));
        eventHandlers.put("file_dialog_complete_handler",
                JSONBoolean.getInstance(fileDialogCompleteHandler != null));
        eventHandlers.put("upload_start_handler", JSONBoolean.getInstance(uploadStartHandler != null));
        eventHandlers.put("upload_progress_handler", JSONBoolean.getInstance(uploadProgressHandler != null));
        eventHandlers.put("upload_error_handler", JSONBoolean.getInstance(uploadErrorHandler != null));
        eventHandlers.put("upload_success_handler", JSONBoolean.getInstance(uploadSuccessHandler != null));
        eventHandlers.put("upload_complete_handler", JSONBoolean.getInstance(uploadCompleteHandler != null));

        swfUpload = nativeCreateSWFUpload(nativeOptions, eventHandlers.getJavaScriptObject());
    }
}

From source file:com.github.a2g.core.objectmodel.DialogTreePanel.java

License:Apache License

@Override
public void update(DialogTree dialogTree, final EventBus bus) {
    // destroy old
    for (int i = 0; i < getRowCount(); i++) {
        this.setWidget(i, 0, null);
    }//from  w  ww .  java 2 s .  co  m

    for (int i = 0; i < getRowCount() && i < dialogTree.getSubBranchIds().size(); i++) {
        int subBranchId = dialogTree.getSubBranchIds().get(i).intValue();
        String lineOfDialog = dialogTree.getLinesOfDialog().get(i);
        Label label = new Label(lineOfDialog);

        this.setWidget(i, 0, label);
        label.getElement().getStyle().setProperty("color", foregroundColor.toString());

        label.addMouseOverHandler(new DialogTreeMouseOverHandler(label, rolloverColor));
        label.addMouseOutHandler(new DialogTreeMouseOutHandler(label, foregroundColor));
        label.addClickHandler(new DialogTreeMouseClickHandler(bus, label, subBranchId));

    }
}

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

License:Open Source License

public void addElement(Label l, ClickHandler cH) {
    l.addClickHandler(cH);//ww w .ja  v  a2 s .  c  o  m
    l.addClickHandler(hideOnClickHandler);
    l.addStyleName("contextMenuItem");

    l.addMouseOutHandler(new DEMouseOutHandler<Label>(l) {
        @Override
        public void onMouseOut(MouseOutEvent event) {
            data.removeStyleName("contextMenuItemHover");
        }
    });
    l.addMouseOverHandler(new DEMouseOverHandler<Label>(l) {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            data.addStyleName("contextMenuItemHover");
        }
    });
    vP.add(l);
}

From source file:com.vaadin.client.debug.internal.AnalyzeLayoutsPanel.java

License:Apache License

private void printClientSideDetectedIssues(Set<ComponentConnector> zeroSized, ApplicationConnection ac) {

    // keep track of already highlighted parents
    HashSet<String> parents = new HashSet<String>();

    for (final ComponentConnector connector : zeroSized) {
        final ServerConnector parent = connector.getParent();
        final String parentId = parent.getConnectorId();

        final Label errorDetails = new Label(connector.getClass().getSimpleName() + "["
                + connector.getConnectorId() + "]" + " inside " + parent.getClass().getSimpleName());

        if (parent instanceof ComponentConnector) {
            final ComponentConnector parentConnector = (ComponentConnector) parent;
            if (!parents.contains(parentId)) {
                parents.add(parentId);/*from w w w  . jav  a  2 s.c o  m*/
                Highlight.show(parentConnector, "yellow");
            }

            errorDetails.addMouseOverHandler(new MouseOverHandler() {
                @Override
                public void onMouseOver(MouseOverEvent event) {
                    Highlight.hideAll();
                    Highlight.show(parentConnector, "yellow");
                    Highlight.show(connector);
                    errorDetails.getElement().getStyle().setTextDecoration(TextDecoration.UNDERLINE);
                }
            });
            errorDetails.addMouseOutHandler(new MouseOutHandler() {
                @Override
                public void onMouseOut(MouseOutEvent event) {
                    Highlight.hideAll();
                    errorDetails.getElement().getStyle().setTextDecoration(TextDecoration.NONE);
                }
            });
            errorDetails.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    fireSelectEvent(connector);
                }
            });

        }

        Highlight.show(connector);
        add(errorDetails);

    }
}

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

private Widget makeClosedWidget() {
    FlowPanel fp = new FlowPanel();
    final Label tLabel = new Label("Search Again");
    //tLabel.addStyleName("collapsible-panel-deflabel-standoutsize");

    tLabel.addMouseOverHandler(new MouseOverHandler() {
        public void onMouseOver(MouseOverEvent event) {
            tLabel.addStyleName("marked-text");
        }//  w w  w  .jav a  2  s . com
    });

    tLabel.addMouseOutHandler(new MouseOutHandler() {
        public void onMouseOut(MouseOutEvent event) {
            tLabel.removeStyleName("marked-text");
        }
    });

    String s = " - " + "<span style= \"font-size:80%;font-weight:normal;\">"
            + "Click here to refine your search or do another search" + "</span>";
    HTML html = new HTML(s);

    DOM.setStyleAttribute(tLabel.getElement(), "display", "inline");
    DOM.setStyleAttribute(html.getElement(), "display", "inline");

    fp.add(tLabel);
    fp.add(html);
    fp.addStyleName("title-font-family");
    fp.addStyleName("title-label");
    fp.addStyleName("title-color");

    return fp;
}

From source file:org.bonitasoft.console.client.view.labels.LabelAssociationWidget.java

License:Open Source License

/**
 * Update the UI./*from w ww . ja v  a2 s.c o  m*/
 */
private void update() {
    // first of all clean the panel
    myLabelSelection.clear();

    final List<LabelModel> theLabels = myLabelDataSource.getAllLabels();

    // CheckBox theCheckBox;
    Image theSelectorImage;
    LabelModel theLabelModel;
    Image theLabelIcon;
    Label theLabel;
    MouseHandler theMouseHandler;
    LabelClickHandler theClickHandler;
    int theNbSelectedCaseHavingCurrentLabel;
    int theNbCaseSelected = myCaseSelection.getSelectedItems().size();
    int row = 0;
    // Create an entry for each label.
    for (int i = 0; i < theLabels.size(); i++) {
        theLabelModel = theLabels.get(i);
        if (theLabelModel.isAssignableByUser()) {
            // The state of the checkbox depends on the number of
            // occurrences.
            // If the label is associated to all cases it must be
            // selected.
            // If the label is not associated to any case it must NOT be
            // selected.
            // If it is associated at least one but not all cases, it must
            // be
            // "partially" selected.

            theSelectorImage = new Image(PICTURE_PLACE_HOLDER);
            theNbSelectedCaseHavingCurrentLabel = countSelectedCases(theLabelModel.getUUID()); // myCaseSelection.getSelectedCaseCount(theLabelModel);

            if (theNbSelectedCaseHavingCurrentLabel == 0 || theNbCaseSelected == 0) {
                // Empty checkbox
                theSelectorImage.setStylePrimaryName(EMPTY_TRISTATECHECKBOX);
                theClickHandler = new LabelClickHandler(theLabelModel.getUUID(), TriState.EMPTY,
                        theSelectorImage);
                theSelectorImage.addClickHandler(theClickHandler);
            } else {
                if (theNbSelectedCaseHavingCurrentLabel == theNbCaseSelected) {
                    // Checkbox fully checked
                    theSelectorImage.setStylePrimaryName(CHECKED_TRISTATECHECKBOX);
                    theClickHandler = new LabelClickHandler(theLabelModel.getUUID(), TriState.FULL,
                            theSelectorImage);
                    theSelectorImage.addClickHandler(theClickHandler);
                } else {
                    // Checkbox partially checked
                    theSelectorImage.setStylePrimaryName(PARTIALLY_CHECKED_TRISTATECHECKBOX);
                    theClickHandler = new LabelClickHandler(theLabelModel.getUUID(), TriState.PARTIAL,
                            theSelectorImage);
                    theSelectorImage.addClickHandler(theClickHandler);
                }
            }

            theLabel = new Label(LocaleUtil.translate(theLabelModel.getUUID()));
            theMouseHandler = new MouseHandler(row);
            theLabel.addMouseOverHandler(theMouseHandler);
            theLabel.addMouseOutHandler(theMouseHandler);
            // Bind the same click handler as the checkbox, to allow the
            // user to click on the label or the check box to achieve the
            // same result.
            theLabel.addClickHandler(theClickHandler);

            theLabelIcon = new Image(PICTURE_PLACE_HOLDER);
            if (theLabelModel.getIconCSSStyle() != null
                    && theLabelModel.getIconCSSStyle().trim().length() > 0) {
                theLabelIcon.setStylePrimaryName(theLabelModel.getIconCSSStyle());
            } else {
                theLabelIcon.setWidth("60%");
            }
            theLabelIcon.addMouseOverHandler(theMouseHandler);
            theLabelIcon.addMouseOutHandler(theMouseHandler);
            // Bind the same click handler as the checkbox, to allow the
            // user to click on the label or the check box to achieve the
            // same result.
            theLabelIcon.addClickHandler(theClickHandler);

            myLabelSelection.setWidget(row, 0, theSelectorImage);
            myLabelSelection.setWidget(row, 1, theLabel);
            myLabelSelection.setWidget(row, 2, theLabelIcon);

            myLabelSelection.getRowFormatter().setStyleName(row, CSSClassManager.POPUP_MENU_ENTRY);
            myLabelSelection.getFlexCellFormatter().setColSpan(row, 0, 1);
            row++;
        }
    }
    if (row > 0) {
        myLabelSelection.getRowFormatter().setStyleName(row, "menu_separator");
        myLabelSelection.getFlexCellFormatter().setColSpan(row, 0, 3);
        row++;

        myLabelSelection.setWidget(row, 0, myApplyLabel);
        myLabelSelection.getFlexCellFormatter().setColSpan(row, 0, 3);
        myLabelSelection.getFlexCellFormatter().setHorizontalAlignment(row, 0,
                HasHorizontalAlignment.ALIGN_CENTER);
        myLabelSelection.getRowFormatter().setStyleName(row, CSSClassManager.POPUP_MENU_ENTRY);

        theMouseHandler = new MouseHandler(row);
        myApplyLabel.addMouseOverHandler(theMouseHandler);
        myApplyLabel.addMouseOutHandler(theMouseHandler);
    }
}

From source file:org.bonitasoft.console.client.view.StartCasePanel.java

License:Open Source License

/**
 * Update the User Interface./* w w w  .  j  av a2  s  .  com*/
 * 
 * @param aProcessesList
 * 
 */
private void update(Collection<BonitaProcess> aProcessesList) {

    // First of all clean up the panel.
    myVisibleEntries.clear();
    myHiddenEntries.clear();
    // myProcessOracle.clear();
    if (aProcessesList != null && !aProcessesList.isEmpty()) {

        // Create an entry for each process the current user is allowed to
        // start.
        Label theLabel;
        ProcessMouseHandler theMouseHandler;
        Image theStartIcon;
        int theRow = 0;
        String theProcessDisplayName = null;
        for (BonitaProcess theProcessDefinition : aProcessesList) {
            theMouseHandler = new ProcessMouseHandler(theProcessDefinition, new Label(constants.startCase()));

            // When the name of the process is to long, add of "..." a the end of the name
            if (theProcessDefinition.getDisplayName() != null) {
                StringBuilder nameDisplayed = new StringBuilder();
                String[] nameSplitted = theProcessDefinition.getDisplayName().split(" ");
                for (int i = 0; i < nameSplitted.length; i++) {
                    if (nameSplitted[i].length() > 22) {
                        nameDisplayed.append(nameSplitted[i].substring(0, 19));
                        nameDisplayed.append("...");
                        break;
                    } else {
                        nameDisplayed.append(nameSplitted[i]);
                        nameDisplayed.append(" ");
                    }
                }
                theProcessDisplayName = nameDisplayed.toString();
            }

            theLabel = new Label(theProcessDisplayName);
            theLabel.addMouseOverHandler(theMouseHandler);
            theLabel.addMouseOutHandler(theMouseHandler);
            theLabel.addClickHandler(new ProcessClickHandler(theProcessDefinition));
            theLabel.setStyleName("menu_choice");

            theStartIcon = new Image(PICTURE_PLACE_HOLDER);
            theStartIcon.addMouseOverHandler(theMouseHandler);
            theStartIcon.addMouseOutHandler(theMouseHandler);
            theStartIcon.addClickHandler(new ProcessClickHandler(theProcessDefinition));
            theStartIcon.setStyleName("start_case_icon");

            if (theProcessDefinition.isVisible()) {
                myVisibleEntries.setWidget(theRow, 0, theLabel);
                myVisibleEntries.setWidget(theRow, 1, theStartIcon);
            } else {
                myHiddenEntries.setWidget(theRow, 0, theLabel);
                myHiddenEntries.setWidget(theRow, 1, theStartIcon);
            }
            // add the process into the suggestbox's oracle
            // myProcessOracle.add(theProcessDisplayName);
            theRow++;
        }

        if (myHiddenEntries.getRowCount() > 0) {
            myOuterPanel.add(myMoreMenu);
        } else {
            myOuterPanel.remove(myMoreMenu);
        }
    } else {
        myVisibleEntries.setWidget(0, 0, myEmptyListMessage);
        myOuterPanel.remove(myMoreMenu);
    }

}

From source file:org.ebayopensource.turmeric.monitoring.client.view.ServiceListWidget.java

License:Open Source License

/**
 * Sets the services map./*from   w  w w . java2s.c o m*/
 * 
 * @param map
 *            the map
 */
public void setServicesMap(Map<String, Set<String>> map) {
    serviceTree.removeItems();
    if (map == null)
        return;

    Label rootLabel = new Label(ConsoleUtil.constants.services() + "(" + map.size() + ")");
    rootLabel.getElement().setId("service-tree-root");
    root = new TreeItem(rootLabel);
    root.addStyleName("turmeric-selectable");

    TreeItem selectedItem = null;

    for (Map.Entry<String, Set<String>> e : map.entrySet()) {
        Label label = new Label(e.getKey());
        TreeItem serviceItem = new TreeItem(label);
        if (selectedService != null && selectedService.equals(e.getKey()))
            selectedItem = serviceItem;

        serviceItem.addStyleName("turmeric-selectable");
        for (String s : e.getValue()) {
            Label opLabel = new Label(s);
            TreeItem opItem = new TreeItem(opLabel);
            opItem.addStyleName("turmeric-op");
            if (selectedOperation != null && selectedOperation.equals(s) && selectedService != null
                    && selectedService.equals(e.getKey()))
                selectedItem = opItem;

            opLabel.addMouseOverHandler(new MouseOverHandler() {

                public void onMouseOver(MouseOverEvent event) {
                    ((Label) event.getSource()).getElement().setId("op-highlight");
                }
            });
            opLabel.addMouseOutHandler(new MouseOutHandler() {

                public void onMouseOut(MouseOutEvent event) {
                    ((Label) event.getSource()).getElement().setId("");
                }

            });
            serviceItem.addItem(opItem);

        }
        root.addItem(serviceItem);
    }
    serviceTree.addItem(root);
    if (selectedItem != null) {
        serviceTree.setSelectedItem(selectedItem, false);
        selectedItem.setState(true, false);
    }

    serviceTree.ensureSelectedItemVisible();
    root.setState(true, false);
}

From source file:org.ebayopensource.turmeric.policy.adminui.client.view.ServiceListWidget.java

License:Open Source License

/**
* Sets the services map./*  w ww . ja va  2 s.co  m*/
* 
* @param map
*            the map
*/
public void setServicesMap(Map<String, Set<String>> map) {
    serviceTree.removeItems();
    if (map == null)
        return;

    Label rootLabel = new Label(PolicyAdminUIUtil.constants.services() + "(" + map.size() + ")");
    rootLabel.getElement().setId("service-tree-root");
    root = new TreeItem(rootLabel);
    root.addStyleName("turmeric-selectable");

    TreeItem selectedItem = null;

    for (Map.Entry<String, Set<String>> e : map.entrySet()) {
        Label label = new Label(e.getKey());
        TreeItem serviceItem = new TreeItem(label);
        if (selectedService != null && selectedService.equals(e.getKey()))
            selectedItem = serviceItem;

        serviceItem.addStyleName("turmeric-selectable");
        for (String s : e.getValue()) {
            Label opLabel = new Label(s);
            TreeItem opItem = new TreeItem(opLabel);
            opItem.addStyleName("turmeric-op");
            if (selectedOperation != null && selectedOperation.equals(s) && selectedService != null
                    && selectedService.equals(e.getKey()))
                selectedItem = opItem;

            opLabel.addMouseOverHandler(new MouseOverHandler() {

                public void onMouseOver(MouseOverEvent event) {
                    ((Label) event.getSource()).getElement().setId("op-highlight");
                }
            });
            opLabel.addMouseOutHandler(new MouseOutHandler() {

                public void onMouseOut(MouseOutEvent event) {
                    ((Label) event.getSource()).getElement().setId("");
                }

            });
            serviceItem.addItem(opItem);

        }
        root.addItem(serviceItem);
    }
    serviceTree.addItem(root);
    if (selectedItem != null) {
        serviceTree.setSelectedItem(selectedItem, false);
        selectedItem.setState(true, false);
    }

    serviceTree.ensureSelectedItemVisible();
    root.setState(true, false);
}