private void setPrevButtonActive(boolean b) {
if (b) {
DOM.sinkEvents(up, Event.ONCLICK);
- DOM.setElementProperty(up, "className", CLASSNAME
- + "-prevpage");
+ DOM
+ .setElementProperty(up, "className", CLASSNAME
+ + "-prevpage");
} else {
DOM.sinkEvents(up, 0);
DOM.setElementProperty(up, "className", CLASSNAME
public void onBrowserEvent(Event event) {
Element target = DOM.eventGetTarget(event);
- if (DOM.compare(target, up) || DOM.compare(target, DOM.getChild(up, 0))) {
+ if (DOM.compare(target, up)
+ || DOM.compare(target, DOM.getChild(up, 0))) {
filterOptions(currentPage - 1, lastFilter);
- } else if (DOM.compare(target, down) || DOM.compare(target, DOM.getChild(down, 0))) {
+ } else if (DOM.compare(target, down)
+ || DOM.compare(target, DOM.getChild(down, 0))) {
filterOptions(currentPage + 1, lastFilter);
}
tb.setFocus(true);
+ "px");
}
if (offsetHeight + getPopupTop() > Window.getClientHeight()) {
- int top = Window.getClientHeight() - offsetHeight - EXTRASPACE/2;
+ int top = Window.getClientHeight() - offsetHeight - EXTRASPACE
+ / 2;
setPopupPosition(getPopupLeft(), top);
}
}
MenuItem item = this.getSelectedItem();
if (item != null) {
doItemAction(item, true);
+ } else if (allowNewItem) {
+ String newItemValue = tb.getText();
+ if(!newItemValue.equals("")) {
+ client.updateVariable(paintableId, "newitem", newItemValue, true);
+ }
}
suggestionPopup.hide();
}
public static final int FILTERINGMODE_STARTSWITH = 1;
public static final int FILTERINGMODE_CONTAINS = 2;
-
private static final String CLASSNAME = "i-filterselect";
public static final int PAGELENTH = 15;
private ArrayList allSuggestions;
private int totalMatches;
+ private boolean allowNewItem;
public IFilterSelect() {
selectedItemIcon.setVisible(false);
if (filter.equals(lastFilter) && currentPage == page) {
if (!suggestionPopup.isAttached())
suggestionPopup.showSuggestions(currentSuggestions,
- currentPage, totalSuggestions);
+ currentPage, totalMatches);
return;
}
if (!filter.equals(lastFilter)) {
clientSideFiltering = true;
}
+ allowNewItem = uidl.hasAttribute("allownewitem");
+
currentSuggestions.clear();
UIDL options = uidl.getChildUIDL(0);
totalSuggestions = uidl.getIntAttribute("totalitems");
totalMatches = uidl.getIntAttribute("totalMatches");
-
+
String captions = "";
if (clientSideFiltering) {
allSuggestions = new ArrayList();
if (filtering && lastFilter.equals(uidl.getStringVariable("filter"))) {
suggestionPopup.showSuggestions(currentSuggestions, currentPage,
- totalSuggestions);
+ totalMatches);
filtering = false;
}
target.addAttribute("template", templateName);
// Adds all items in all the locations
for (Iterator i = slots.keySet().iterator(); i.hasNext();) {
-
// Gets the (location,component)
String location = (String) i.next();
Component c = (Component) slots.get(location);
-
- // Writes the item
- target.startTag("location");
- target.addAttribute("name", location);
- c.paint(target);
- target.endTag("location");
+ if (c != null) {
+ // Writes the item
+ target.startTag("location");
+ target.addAttribute("name", location);
+ c.paint(target);
+ target.endTag("location");
+ }
}
}
* CustomLayout's template selecting was previously implemented with
* setStyle. Overriding to improve backwards compatibility.
*
- * @param name template name
+ * @param name
+ * template name
*/
public void setStyle(String name) {
setTemplateName(name);
}
-
/** Get the name of the template */
public String getTemplateName() {
return templateName;
}
- /** Set the name of the template used to draw custom layout.
+ /**
+ * Set the name of the template used to draw custom layout.
*
- * With GWT-adapter, the template with name 'templatename' is
- * loaded from ITMILL/themes/themename/layouts/templatename.html.
- * If the theme has not been set (with Application.setTheme()),
- * themename is 'default'.
+ * With GWT-adapter, the template with name 'templatename' is loaded from
+ * ITMILL/themes/themename/layouts/templatename.html. If the theme has not
+ * been set (with Application.setTheme()), themename is 'default'.
*
* @param templateName
*/