List of usage examples for com.google.gwt.user.client.ui Image addMouseOverHandler
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
From source file:ch.heftix.mailxel.client.MailOverviewCellTable.java
License:Open Source License
public void fillGrid(List<Envelope> result) { envelopes = result;/*from w w w. ja va2s. c o m*/ // checkboxes = new ArrayList<CheckBox>(envelopes.size()); // clean all except header int rows = grid.getRowCount(); for (int i = rows - 1; i >= first_payload_row; i--) { grid.removeRow(i); } int row = first_payload_row; for (final Envelope envelope : result) { grid.setText(row, C_SELECT, Integer.toString(envelope.count)); setTextHelper(grid, row, C_FROM, envelope.from, 12); setTextHelper(grid, row, C_TO, envelope.to, 12); Label dateTime = dateTimeLabel(envelope.date, envelope.time); if (envelope.urgency > 0) { String style = "background-color:#FA5858;"; switch (envelope.urgency) { case 4: style = "background-color:#FA5858;"; break; case 3: style = "background-color:#FAAC58;"; break; case 2: style = "background-color:#F4FA58;"; break; default: style = "background-color:#ACFA58;"; break; } DOM.setElementAttribute(dateTime.getElement(), "style", style); } grid.setWidget(row, C_DATE, dateTime); // GTD label (unless label is 'not categorized') if (990 != envelope.curcatid) { Label gtdLabel = createLabel(envelope.GTD, 16); grid.setWidget(row, C_GTD, gtdLabel); // see if there is an icon for it Image img = setIconForGTD(grid, row, envelope.curcatid, envelope.GTD); img.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(final MouseOverEvent event) { final PopupPanel pop = new PopupPanel(true); pop.setPopupPosition(event.getClientX(), event.getClientY()); mailxelService.getCategoryHistory(envelope.id, new AsyncCallback<List<AttachedCategoryTO>>() { public void onFailure(Throwable caught) { // } public void onSuccess(List<AttachedCategoryTO> result) { if (null == result || result.size() < 1) { return; } FlexTable ft = new FlexTable(); pop.add(ft); int row = 0; for (AttachedCategoryTO cat : result) { ft.setText(row, 0, cat.date); String url = DirectMailServiceUtil.getIconURL(cat.category.iconid); if (null != url) { Image img = new Image(url); ft.setWidget(row, 1, img); } ft.setText(row, 2, cat.category.name); row++; } pop.show(); } }); } }); } if (envelope.nattach > 0) { Image attach = new Image("img/attach.png"); grid.setWidget(row, C_ATTACHMENT, attach); } Label subject = setTextHelper(grid, row, C_SUBJECT, envelope.subject, 64); // subject.addMouseOverHandler(new MouseOverHandler() { // // public void onMouseOver(MouseOverEvent event) { // // System.out.println("on mouse over:" + event + "/" + // // envelope); // mailxelService.snippet(envelope.id, // new AsyncCallback<String>() { // // public void onFailure(Throwable caught) { // System.out.println("E snippet: " + caught); // } // // public void onSuccess(String result) { // System.out.println("I snippet: " + result); // // } // }); // } // }); if (row % 2 == 0) { rf.setStylePrimaryName(row, "row-bg"); } row++; } cl = new CursoredList<Envelope>(envelopes); cl.setCursorPosition(0); }
From source file:com.mashery.examples.api.client.EtsyExample.java
License:Open Source License
private Image createFeaturedListingImg(final Listing listing) { final Image img = createListingImg(listing); if (img != null) { img.getElement().setId("listing_" + listing.getListingId()); dragController.makeDraggable(img); img.addMouseOverHandler(new MouseOverHandler() { @Override/*from w w w. j av a 2 s. com*/ public void onMouseOver(MouseOverEvent event) { onFeaturedListingSelected(img, listing); } }); } return img; }
From source file:com.mashery.examples.api.client.EtsyExample.java
License:Open Source License
private Image createFavoriteListingImg(final Listing listing) { final Image img = createListingImg(listing); if (img != null) { img.addMouseOverHandler(new MouseOverHandler() { @Override/*from www. j av a 2 s .c o m*/ public void onMouseOver(MouseOverEvent event) { onFavoriteListingSelected(img, listing); } }); } return img; }
From source file:de.eckhartarnold.client.Filmstrip.java
License:Apache License
/** * The constructor of class <code>Filmstrip</code> * @param thumbnailImages the thumb nail images to be displayed on the * film strip// ww w . j av a 2 s. co m */ public Filmstrip(Thumbnails thumbnailImages) { this.thumbnails = thumbnailImages; envelope = new SimplePanel(); envelope.addStyleName("filmstripEnvelope"); panel = new AbsolutePanel(); panel.addStyleName("filmstripPanel"); envelope.setWidget(panel); initWidget(envelope); // sinkEvents(Event.ONMOUSEWHEEL); ClickHandler imageClickHandler = new ClickHandler() { public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); if (pickImageCallback != null) { pickImageCallback.onPickImage(thumbnails.indexOf((Image) sender)); } } }; MouseDownHandler imageMouseDownHandler = new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { Widget sender = (Widget) event.getSource(); if (pickImageCallback != null && sender != thumbnails.get(cursor)) { sender.addStyleName("filmstripPressed"); } } }; MouseOverHandler imageMouseOverHandler = new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { Widget sender = (Widget) event.getSource(); if (pickImageCallback != null && sender != thumbnails.get(cursor)) { sender.addStyleName("filmstripTouched"); } } }; MouseOutHandler imageMouseOutHandler = new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { Widget sender = (Widget) event.getSource(); if (pickImageCallback != null && sender != thumbnails.get(cursor)) { sender.removeStyleName("filmstripTouched"); sender.removeStyleName("filmstripPressed"); } } }; MouseUpHandler imageMouseUpHandler = new MouseUpHandler() { public void onMouseUp(MouseUpEvent event) { Widget sender = (Widget) event.getSource(); if (pickImageCallback != null && sender != thumbnails.get(cursor)) { sender.removeStyleName("filmstripPressed"); } } }; for (int i = 0; i < thumbnails.size(); i++) { Image img = thumbnails.get(i); if (i == cursor) img.setStyleName("filmstripHighlighted"); else img.setStyleName("filmstrip"); img.addClickHandler(imageClickHandler); img.addMouseDownHandler(imageMouseDownHandler); img.addMouseOverHandler(imageMouseOverHandler); img.addMouseOutHandler(imageMouseOutHandler); img.addMouseUpHandler(imageMouseUpHandler); } visible = new HashSet<Image>(); }
From source file:de.eckhartarnold.client.GalleryWidget.java
License:Apache License
private void initRawGallery() { assert panel == null; panel = new VerticalPanel(); panel.addStyleName("gallery"); panel.getElement().setAttribute("align", "center"); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // add a filler so that the vertical panel is not empty (and its // horizontal size not zero) when the thumbnail pictures are added. // filler = new HTML(" "); // panel.add(filler); ClickHandler imageClickHandler = new ClickHandler() { public void onClick(ClickEvent event) { Widget sender = (Widget) event.getSource(); // String id = DOM.getElementAttribute(sender.getElement(), "id"); String id = sender.getElement().getAttribute("id"); firePickImage(Integer.parseInt(id)); sender.removeStyleName("galleryTouched"); sender.removeStyleName("galleryPressed"); }/*from ww w .j a v a 2 s .c om*/ }; MouseDownHandler imageMouseDownHandler = new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { Widget sender = (Widget) event.getSource(); sender.addStyleName("galleryPressed"); } }; MouseOverHandler imageMouseOverHandler = new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { Widget sender = (Widget) event.getSource(); sender.addStyleName("galleryTouched"); } }; MouseOutHandler imageMouseOutHandler = new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { Widget sender = (Widget) event.getSource(); sender.removeStyleName("galleryTouched"); sender.removeStyleName("galleryPressed"); } }; for (int i = 0; i < thumbnails.size(); i++) { Image img = thumbnails.get(i); img.setStyleName("galleryImage"); Element imgElement = img.getElement(); // DOM.setElementAttribute(imgElement, "id", String.valueOf(i)); imgElement.setAttribute("id", String.valueOf(i)); img.addClickHandler(imageClickHandler); img.addMouseDownHandler(imageMouseDownHandler); img.addMouseOverHandler(imageMouseOverHandler); img.addMouseOutHandler(imageMouseOutHandler); } initWidget(panel); }
From source file:org.bonitasoft.console.client.view.ItemFilterEditor.java
License:Open Source License
protected SimplePanel createNaturalSearchElement(HTML aSearchScopeExplanations) { DecoratorPanel theNaturalSearchPanel = new DecoratorPanel(); theNaturalSearchPanel.setStylePrimaryName(ROUNDED_STYLE); final SuggestBox theSearchSB = new SuggestBox(mySearchOracle); HorizontalPanel theNaturalSearch = new HorizontalPanel(); final Image theMagnifyIcon = new Image(PICTURE_PLACE_HOLDER); theMagnifyIcon.setStylePrimaryName(CSSClassManager.SEARCH_ICON); if (aSearchScopeExplanations != null) { final DecoratedPopupPanel theExplanationsPopup = new DecoratedPopupPanel(true, false); theExplanationsPopup.setWidget(aSearchScopeExplanations); theMagnifyIcon.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent aEvent) { theExplanationsPopup.setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int anOffsetWidth, int anOffsetHeight) { int left = theMagnifyIcon.getAbsoluteLeft() - (anOffsetWidth / 2); int top = theMagnifyIcon.getAbsoluteTop() + theMagnifyIcon.getHeight() + 7; theExplanationsPopup.setPopupPosition(left, top); }// w w w .j a v a 2 s . c o m }); } }); theMagnifyIcon.addMouseOutHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent aEvent) { theExplanationsPopup.hide(); } }); } final Image theActionIcon = new Image(PICTURE_PLACE_HOLDER); theActionIcon.setStylePrimaryName(CSSClassManager.SEARCH_CLEAR_ICON); theActionIcon.setVisible(false); theActionIcon.addClickHandler(new ClickHandler() { public void onClick(ClickEvent aEvent) { theSearchSB.setValue(null); theActionIcon.setVisible(false); clearFilterPatternAndNotify(); } }); final DecoratedPopupPanel theClearTooltip = new DecoratedPopupPanel(true, false); theClearTooltip.setWidget(new HTML(constants.clearFilter())); theActionIcon.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent aEvent) { theClearTooltip.setPopupPositionAndShow(new PopupPanel.PositionCallback() { public void setPosition(int anOffsetWidth, int anOffsetHeight) { int left = theActionIcon.getAbsoluteLeft() - (anOffsetWidth / 2); int top = theActionIcon.getAbsoluteTop() + theActionIcon.getHeight() + 7; theClearTooltip.setPopupPosition(left, top); } }); } }); // theActionIcon.addMouseMoveHandler(new MouseMoveHandler() { // // public void onMouseMove(MouseMoveEvent aEvent) { // theClearTooltip.setPopupPositionAndShow(new PopupPanel.PositionCallback() // { // public void setPosition(int anOffsetWidth, int anOffsetHeight) { // int left = theActionIcon.getAbsoluteLeft() - (anOffsetWidth / 2); // int top = theActionIcon.getAbsoluteTop() + theActionIcon.getHeight() + 7; // theClearTooltip.setPopupPosition(left, top); // } // }); // } // // }); theActionIcon.addMouseOutHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent aEvent) { theClearTooltip.hide(); } }); theSearchSB.getTextBox().addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent anEvent) { int theKey = anEvent.getNativeKeyCode(); if (KeyCodes.KEY_ENTER == theKey) { if (performNaturalSearch(theSearchSB)) { theActionIcon.setVisible(true); } else { theActionIcon.setVisible(false); } } } }); theSearchSB.getTextBox().addBlurHandler(new BlurHandler() { public void onBlur(BlurEvent aEvent) { theSearchSB.setValue(myFilter.getSearchPattern()); if (theSearchSB.getValue() == null || theSearchSB.getValue().length() == 0) { theActionIcon.setVisible(false); } else { theActionIcon.setVisible(true); } } }); theNaturalSearch.add(theMagnifyIcon); theNaturalSearch.add(theSearchSB); theNaturalSearch.add(theActionIcon); theNaturalSearchPanel.add(theNaturalSearch); return theNaturalSearchPanel; }
From source file:org.bonitasoft.console.client.view.labels.LabelAssociationWidget.java
License:Open Source License
/** * Update the UI./*from w w w .j av 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 ww .jav 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.clevermore.monitor.client.widgets.AbstractMonitoringWidget.java
License:Apache License
/** * @param name - the name of the widget/* w ww . j av a2 s.co m*/ * @param refreshDelay - referesh rate in ms. */ public AbstractMonitoringWidget(final String name, final int refreshDelay, SR service) { this.name = name; this.service = service; header.setStyleName("header"); Image img = new Image(); img.setUrl("img/header-icon.png"); img.addClickHandler(zoom); img.addMouseOverHandler(handCursor); header.add(img); lable.setText(name); lable.setStyleName("lable"); header.add(lable); mainPanel.add(header); mainPanel.add(dataPanel); dataPanel.setStyleName("data"); initWidget(mainPanel); setStyleName("monitoringWidget"); if (refreshDelay > 0) { // first time do the request faster then the original one Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override public boolean execute() { forceRefresh(); Scheduler.get().scheduleFixedDelay(refreshCommand, refreshDelay); return false; } }, 1); } setRefresh(true); }
From source file:org.drools.guvnor.client.simulation.TimeLineWidget.java
License:Apache License
private Image createStepWidget(SimulationPathModel path, final SimulationStepModel step) { ImageResource imageResource = simulationResources.stepEmpty(); final Image image = new Image(imageResource); final PopupPanel popupPanel = new PopupPanel(true); popupPanel.setWidget(/*from w w w .jav a 2 s. c o m*/ new Label(path.getName() + " @ " + SimulationTestUtils.formatMillis(step.getDistanceMillis()))); image.addMouseOverHandler(new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { popupPanel.showRelativeTo(image); } }); image.addMouseOutHandler(new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { popupPanel.hide(); } }); popupPanel.setAutoHideOnHistoryEventsEnabled(true); image.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { simulationTestEventHandler.selectStep(step); } }); return image; }