com.asayama.gwt.angular.tutorial.client.SampleController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-angular-tutorial Show documentation
Show all versions of gwt-angular-tutorial Show documentation
The tutorial section of GWT Angular demo website.
The newest version!
package com.asayama.gwt.angular.tutorial.client;
import com.asayama.gwt.angular.client.AbstractController;
import com.asayama.gwt.jsni.client.JSArray;
import com.asayama.gwt.jsni.client.JSON;
import com.google.gwt.user.client.Event;
public class SampleController extends AbstractController {
private JSArray entries = JSArray.create();
private String quickEntryCaption = "";
@Override
public void onControllerLoad() {
}
public void onChangeQuickEntry(String quickEntryCaption) {
setQuickEntryCaption(quickEntryCaption);
}
public String onKeyPressQuickEntry(Event event) {
int keyCode = event.getKeyCode();
if (keyCode == 13) {
getEntries().add(Entry.create(quickEntryCaption));
setQuickEntryCaption("");
}
return getQuickEntryCaption();
}
public void onClickClear() {
entries.clear();
setQuickEntryCaption("");
}
public JSArray getEntries() {
return entries;
}
public void setEntries(JSArray entries) {
this.entries = entries;
}
public String getQuickEntryCaption() {
return quickEntryCaption;
}
public void setQuickEntryCaption(String quickEntryCaption) {
this.quickEntryCaption = quickEntryCaption;
}
}
class Entry extends JSON {
public static Entry create(String caption) {
Entry entry = JSON.create();
entry.setCaption(caption);
return entry;
}
protected Entry() {
}
public final void setCaption(String caption) {
put("caption", caption);
}
}