/*
- * Copyright 2009 Electronic Business Systems Ltd.
+ * Copyright 2009, 2010 Electronic Business Systems Ltd.
*
* This file is part of GSS.
*
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.SuggestBox;
/**
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) {
}
public static native void log(String message) /*-{
- $wnd.console.debug(message);
+ var logger = $wnd.console;
+ if (logger && logger.debug)
+ logger.debug(message);
+ else if (logger && logger.log)
+ logger.log(message);
}-*/;
/**
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;
+ }-*/;
}