X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/fa556159ea2c8ac52af0f96764efceefa3d89fb4..0241bb3c2b120f9095ef460396b09b733cceb163:/src/gr/ebs/gss/client/DisplayHelper.java diff --git a/src/gr/ebs/gss/client/DisplayHelper.java b/src/gr/ebs/gss/client/DisplayHelper.java index eddc45a..f60d14c 100644 --- a/src/gr/ebs/gss/client/DisplayHelper.java +++ b/src/gr/ebs/gss/client/DisplayHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2009 Electronic Business Systems Ltd. + * Copyright 2009, 2010 Electronic Business Systems Ltd. * * This file is part of GSS. * @@ -22,7 +22,6 @@ import java.util.List; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.ListBox; -import com.google.gwt.user.client.ui.SuggestBox; /** @@ -40,30 +39,6 @@ public class DisplayHelper { public static final int NO_SELECTION = -1; /** - * Hide the SuggestBox's PopupPanel before updating the oracle suggestions. - * Since SuggestBox is not meant to be extended and its internals are - * inaccessible, we have to resort to JSNI to call the required methods. - * - * @param sb the SuggestBox whose panel will be hidden - */ - public static final native void hideSuggestions(SuggestBox sb) /*-{ - sb.@com.google.gwt.user.client.ui.SuggestBox::suggestionPopup.@com.google.gwt.user.client.ui.PopupPanel::hide()(); - sb.@com.google.gwt.user.client.ui.SuggestBox::suggestionMenu.@com.google.gwt.user.client.ui.MenuBar::clearItems()(); - }-*/; - - /** - * Display the SuggestBox's PopupPanel after updating the oracle suggestions. - * Since SuggestBox is not meant to be extended and its internals are - * inaccessible, we have to resort to JSNI to call the required method. - * - * @param sb the SuggestBox whose panel will be shown - * @param query the query whose suggestions will be shown - */ - public static final native void showSuggestions(SuggestBox sb, String query) /*-{ - sb.@com.google.gwt.user.client.ui.SuggestBox::showSuggestions(Ljava/lang/String;)(query); - }-*/; - - /** * Clear any current selection in the specified ListBox. */ public static void clearSelections(ListBox listBox) { @@ -107,6 +82,8 @@ public class DisplayHelper { var logger = $wnd.console; if (logger && logger.debug) logger.debug(message); + else if (logger && logger.log) + logger.log(message); }-*/; /** @@ -143,5 +120,22 @@ public class DisplayHelper { styleRow(table, row, true, styleName); return row; } + /** + * The implementation of this trim method also checks for + * no brake space characters (nbsp) = '\00A0' + * and removes them + * + * @param input + * @return the new trimmed string without whitespace or no brake space + */ + public static native String trim(String input) /*-{ + if(input.length == 0) + return input; + if((input[0]||input[input.length-1]) != '\u0020' && (input[0]||input[input.length-1]) != '\u00A0') + return input; + var r1 = input.replace(/^(\s*)/, ''); + var r2 = r1.replace(/\s*$/, ''); + return r2; + }-*/; }