1
0
forked from GitHub/gf-core

Fridge: minor refactoring.

This commit is contained in:
bjorn
2008-11-06 13:47:40 +00:00
parent 637bdfdb93
commit 68ee5c15a1
2 changed files with 9 additions and 7 deletions

View File

@@ -5,7 +5,6 @@ import java.util.List;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.allen_sauer.gwt.dnd.client.drop.DropController;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.HistoryListener;
import com.google.gwt.user.client.ui.Button;
@@ -245,7 +244,6 @@ public class FridgeApp implements EntryPoint {
}
public void onAvailableLanguagesChanged() {
if (pgf.getInputLanguage() == null) {
GWT.log("Setting input language to user language: " + pgf.getUserLanguage(), null);
pgf.setInputLanguage(pgf.getUserLanguage());
}
}

View File

@@ -1,19 +1,24 @@
package se.chalmers.cs.gf.gwt.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
public class FridgeBagPanel extends FlowPanel {
public class FridgeBagPanel extends Composite {
private PGFWrapper pgf;
private MagnetFactory magnetFactory;
protected JSONRequest completeRequest = null;
private JSONRequest completeRequest = null;
private FlowPanel mainPanel;
public FridgeBagPanel (PGFWrapper pgf, MagnetFactory magnetFactory) {
this.pgf = pgf;
this.magnetFactory = magnetFactory;
mainPanel = new FlowPanel();
initWidget(mainPanel);
setStylePrimaryName("my-FridgeBagPanel");
}
@@ -22,7 +27,7 @@ public class FridgeBagPanel extends FlowPanel {
}
public void updateBag (final String text, String prefix) {
clear();
mainPanel.clear();
int limit = 100;
if (completeRequest != null) {
completeRequest.cancel();
@@ -30,7 +35,6 @@ public class FridgeBagPanel extends FlowPanel {
completeRequest = pgf.complete(text + " " + prefix,
limit, new PGF.CompleteCallback() {
public void onResult(PGF.Completions completions) {
clear();
for (PGF.Completion completion : completions.iterable()) {
String newText = completion.getText();
if (!newText.equals(text + " ")) {
@@ -38,7 +42,7 @@ public class FridgeBagPanel extends FlowPanel {
if (words.length > 0) {
String word = words[words.length - 1];
Magnet magnet = magnetFactory.createMagnet(word, completion.getFrom());
add(magnet);
mainPanel.add(magnet);
}
}
}