Concept
When a user clicks a removeUser label, a text box pops up. Then, the user enters the username of the user they'd like to remove. Then, the user hits "Enter" to remove the user.
GWT Problem
I'm working with a class that implements an object of type, com.google.gwt.user.client.ui.Composite.
One of its fields includes a #UiField Label:
#UiField
Label removeUser;
And I've got a regular TextBox that should appear when the removeUser Label gets clicked.
private TextBox removeUserTextBox = new TextBox();
If my code is correct, then the removeUserTextBox will appear when removeUser gets clicked.
removeUser.addClickHandler(new ClickHandler()
{
public void onClick(final ClickEvent event)
{
removeUserTextBox.setVisible(true);
removeUserTextBox.setText("blah blah")
removeUserTextBox.addStyleName(StaticResourceBundle.
INSTANCE.coreCss().removeUserTextBox());
}
});
However, the removeUserTextBox does not show up when I click the removeUser label.
I don't think (or know) if it's a CSS problem since removeUserTextBox's CSS is similar to removeUser's CSS, which appears correctly.
Please advise.
Thanks,
Kevin
Why are you adding a style to the textbox in the handler? Simply setVisible(true) on click, and then setVisible(false) when a user confirms the deletion.
It seems like your textbox is not attached to the DOM. You may do either of following.
1) Include a textBox in a markup (uiBinder) and inject it with a #UiField annotation.
2) Add a textBox created with constructor to the RootPanel or other container which is already attached to the DOM.
3) Wrap a textBox into a popup panel and show it relative to a label. I like this variant most because there is no need in positioning with css.
Related
When I click on the form's caption the OnActivate event is not fired. The reason is apparently that the form parent is a TPanel. The form is brought to front when clicking its caption but the onActivate event is not fired.
My solution was radical, I set the border style to bsnone and I created my own caption with a panel aligned to the top of the form. Then I use the mouse event on the panel to move the form. But I now have the problem how to resize the form without the border. Please help, thanks.
I am making a simple webui in gwt and I want to implement the following functionality: once the user clicks a checkbox, a new text area with some wording appears. When the user unchecks the textbox, the textarea disappears. Can anyone show me the implementation on how to do this?
The CheckBox has a ValueChangeHander < Boolean >. You can use this to get the actual value, after the change.
There is also an example to get the value within the clickhandler.
http://www.gwtproject.org/javadoc/latest/com/google/gwt/event/logical/shared/HasValueChangeHandlers.html
I have as question mark icon with hover text attached. If the user puts their mouse over the icon and waits a second, the hover text shows up. However, if the user gets impatient and clicks on the icon, nothing happens, ever.
How can I make it so the hover text shows up on a hover or on a click?
Thank you,
Greg
Currently you use "title" property to show a tooltip. If you add a click event, you run the risk of showing two "tooltips" at the same time. The clean solution is not to use "title" property at all and use a PopupPanel instead with a simple MouseOver handler:
myWidget.addDomHandler(new MouseOverHandler() {
#Override
public void onMouseOver(MouseOverEvent event) {
myTooltipPopupPanel.showRelativeTo(myWidget);
}
}, MouseOverEvent.getType());
Obviously, if you can add a MouseOverHandler directly to myWidget, there is no need to add it as a DomHandler.
I'm trying to implement a button outside of the TinyMce editor, that would add text to the active editor upon clicking.
How can I do this?
(For example: There's a button on my website that should add "Test" into the editor, but it doesn't).
Thanks for help :)
Add this code to the onClick of your button:
// the editor id is the same id of your textarea, default "content" in case your textarea does not have an id
tinymce.get('your_editor_id').execCommand('mceInsertContent', false, "Test");
In case you have one single editor on your page you may also use tinymce.activeEditor instead of tinymce.get('your_editor_id').
I've a huge panel with drop-down lists and checkboxes. To manage them I have to implement the ClickListener interface so that on expanding the drop-down list or clicking on the checkbox some actions are executed.
Then I have to show the dialog box with just one 'OK' button and this dialog should be modal. I create it using via the following constructor
final DialogBox msg = new DialogBox(false, true);
so it should be modal and it is except for drop-down lists and checkboxes because clicking on them calls to the onClick(Widget sender) method which knows nothing about the modality of the dialog box so it could expand the drop-down list or tick the checkbox.
I see that this could be resolved by just one if in that onClick() method where it should check if there is no modal window or there is one. But is there another option to resolve this issue?
Are you looking for setGlassEnabled(boolean)?