working, need tuning now
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@73379 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c7c5f6d2f6
commit
d406884a86
|
@ -145,9 +145,9 @@ public class PickUsersDialog extends PopupPanel {
|
|||
case ENTER: //selectd with keyboard
|
||||
SingleUserTemplate ut = null;
|
||||
if (mainPanel.getWidgetCount() > 0) {
|
||||
if (displayIndexSelected < 0) //when there's only one left sometimes here i get -sth, no time to see why :)
|
||||
if (displayIndexSelected < 0 || displayIndexSelected >= mainPanel.getWidgetCount()) //when there's only one left sometimes here i get -sth, no time to see why :)
|
||||
ut = (SingleUserTemplate) mainPanel.getWidget(0);
|
||||
else
|
||||
else
|
||||
ut = (SingleUserTemplate) mainPanel.getWidget(displayIndexSelected);
|
||||
eventBus.fireEvent(new PickedUserEvent(new PickingUser("id", "username", ut.getFullName(), "thumb")));
|
||||
hide();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.portlets.user.shareupdates.client.elements;
|
||||
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Element;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasText;
|
||||
|
||||
|
@ -31,7 +30,6 @@ public class ContentEditDiv extends HTML implements HasText {
|
|||
|
||||
public static native void setEndOfContenteditable() /*-{
|
||||
var contentEditableElement = $doc.getElementById("mycontentEditableElement");
|
||||
//alert(contentEditableElement.innerHTML);
|
||||
var range,selection;
|
||||
if($doc.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
|
||||
{
|
||||
|
|
|
@ -10,14 +10,12 @@ import com.google.gwt.user.client.ui.TextBox;
|
|||
public class TagBox extends TextBox {
|
||||
|
||||
public TagBox() {
|
||||
|
||||
}
|
||||
|
||||
public TagBox(String text) {
|
||||
super();
|
||||
this.setStylePrimaryName("user-token");
|
||||
setValue(text);
|
||||
setText(text);
|
||||
getElement().setAttribute("value", text);
|
||||
//random heuristic, the "i" and "l" char occupies very few px :)
|
||||
int iCounter = 12 - 2*(text.split("i").length + (text.split("l").length));
|
||||
setWidth((text.length()*6+iCounter)+"px");
|
||||
|
|
|
@ -46,7 +46,7 @@ public class SmartTextArea extends ContentEditDiv {
|
|||
eventBus.addHandler(PickedUserEvent.TYPE, new PickedUserEventHandler() {
|
||||
@Override
|
||||
public void onSelectedUser(PickedUserEvent event) {
|
||||
String[] toSplit = getText().split("@"); //get the interesting part
|
||||
String[] toSplit = getHTML().split("@"); //get the interesting part
|
||||
TagBox span = new TagBox(event.getSelectedUser().getFullName());
|
||||
setHTML(toSplit[0]);
|
||||
getElement().appendChild(span.getElement());
|
||||
|
|
Loading…
Reference in New Issue