After setting setShowHover true, how do I create the tooltip? Right now it is a blank tooltip.
ListGridField exportField = new IconField(FIELD_EXPORT, REDO_ICON.jpg, EXPORT_CUSTOM_GROUP_HANDLER);
exportField.setShowHover(true);
Tried exportField.setPrompt("a tooltip message");, but this did not give every single icon a tooltip when i mouse over it.
This a picture showing the tooltip is blank when i hover over the blue-pointer button, the message "a tooltip message" only appear when I hover over the very top blue-pointer button. I want it to show a tooltip for every blue-pointer button.
Use exportField.setHoverCustomizer() to show a customized prompt message.
Try this one
ListGrid grid = new ListGrid();
grid.setCanHover(true);
grid.setShowHover(true);
...
exportField.setHoverCustomizer(new HoverCustomizer() {
#Override
public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
// you can customize the prompt and can get the values from current record also
return "a tooltip message";
}
});
Related
I show a context menu on right click but for every second click the right side of the menu gets clipped (about 1 to 2 character width) The basics that I can put here:
void initialise(Handler eventHandler) {
addMenuItem(eventHandler, "New", new NewAction(shell),false);
addMenuItem(eventHandler, "Edit", new EditAction(shell),false);
menuItems.add(new SeparatorMenuItem());
... more items
}
void addMenuItem(Handler eventHandler, String text, Action action, boolean isCheck) {
actions.add(action);
MenuItem it = isCheck ? new CheckMenuItem() : new MenuItem();
it.setText(text);
it.setData(action);
it.setDisable(true);
menuItems.add(it);
}
....
menu = new ContextMenu();
menu.getItems().clear();
menu.getItems().addAll(getMenuItems(getSelection()));
menu.setAutoHide(true);
...
What I've figured out is that it happens on every second right click and although the menu occupy the same rectangle, the drawn part is shifted by 12 pixels, giving the appearance that it's been clipped
You need to set the effect style to null in the code or the css file
I have a list page where it has button menu. While i select a record and click on that button menu a new page will be open with the corresponding code from the selected record.
From the opened page's doAfterCompose, how can i get the name of the previous page from where we clicked the button and opened the new page?
Please anyone help me with this...
What you should do (although I haven't seen your code) is to generate an event that passes as a value the previous page number when 'that button menu' is clicked. The event will then be picked up by the event queue together with the passed value.
So inside the method that handles the event generated by the click of the button menu you should add the following:
EventQueues.lookup("myqueue", EventQueues.DESKTOP, true)
.publish(new Event("buttonClicked", null, previousPage));
where previousPage is the value passed (an integer for the sake of the example).
Then inside the doAfterCompose() method you extrapolate the data passed:
EventQueues.lookup("myqueue", EventQueues.DESKTOP, true).subscribe(
new EventListener() {
public void onEvent(Event evt) {
if (evt.getName().equalsIgnoreCase("buttonClicked")) {
int thePreviousPage = (int) evt.getData();
.......
I have an editable GWT Label which shows a strange behavior. That is if I click the text “Add note…” the cursor does not appear until I click a second time. But if I click on the label outside the text the cursor appears on first click. How do I solve that? My guess is that replacing the text also removes the cursor when the cursor is in the text. So how can I get the cursor back on first click?
public class EditableLabel extends Label implements FocusHandler {
public EditableLabel() {
super();
getElement().setAttribute("contenteditable", "true");
getElement().setAttribute("tabindex", "1");
this.sinkEvents(Event.ONBLUR);
this.sinkEvents(Event.ONFOCUS);
addHandler(this, FocusEvent.getType());
setText("Add note...");
}
#Override
public void onFocus(FocusEvent event) {
setText("");
}
}
I think your problem depends on the browser. On FF it works fine for me.
I assume you want to write something, if so try to change Label for TextBox, it should work.
When I have a input such as a checkbox in the celltable cell, I noticed the cell actaully is clickable or focusable. If I click in the cell but outside of the checkbox, the cursor blinks there in the cell but ourside the checkbox. This behavior happens on all the cells with any inputs. or no inputs such as text only cell.
It is very anoying because, to toggle the checkbox, you have to click precisly on the little check box. Clicking anyware outside the checkbox but inside the cell will get the cell focused and cursor blinks there.
Any solutions?
below is an example of a checkbox rendered in a CellTable cell:
final CheckboxCell requiredCell = new CheckboxCell();
Column<MyInfo, Boolean> requiredCol = new Column<MyInfo, Boolean>(requiredCell) {
#Override
public Boolean getValue(MyInfo info) {
return info.isRequired();
}
};
cellTable.addColumn(requiredCol, "Required");
cellTable.setColumnWidth(requiredCol, 10, com.google.gwt.dom.client.Style.Unit.PCT);
You could add a click listener (or more precisely, a browser event listener that handles clicks) to your cell and just have it manually check the box.
I'm using UploadItem, RadioGroupItem and some other widgets. RadioButton is having onChangeHandler which will decide what all other components need to be displayed. I've uploaded some file using UploadItem. Then I changed the radio button selection. On changing the radio button, required widgets are getting displayed properly but whatever file I'd selected using UploadItem is going away. Fresh UploadItem widget is getting displayed. In other words page is getting refreshed.
My requirement is whenever I change radio button option, required widget should displayed along with that whatever file I had selected using UploadItem should remain same.
My Code is something like this:
UploadItem upload = new UploadItem();
RadioGroupItem radioGroup = new RadioGroupItem();
HashMap map = new HashMap();
map.put("option1","option1");
map.put("option2","option2");
radioGroup.setValueMap(map);
TextItem textbox = new TextItem();
radioGroup.addChangeHandler(new ChangeHandler(){
public void onChanged(ChangedEvent event) {
String radioValue =((String)event.getValue());
if(radioValue.equalsIgnoreCase("option2")){
textbox.show();
}else{
textbox.hide();
}
}
});
Add all created widgets to DynamicForm object using dynamicForm.setFields(all created widgets)
Changing the radio button should hide and show the textBox. But while doing that page is getting refreshed and whatever file we had selected using UploadItem is lost.
As per the documentation for hide() and show() of FormItem class, invocation of any of these methods, will cause the DynamicForm to be redrawn.
So it may cause the problem you're getting.
To overcome this issue, I would suggest you to put UploadItem in a separate DynamicForm.
fire an event on radio Selection change as
radioButton.addListener(Events.Change, new Listener<BaseEvent>() {
#Override
public void handleEvent(BaseEvent be) {
if(radioButton.getValue()){
//fire an event here for ur widget
}
}
});