本文整理汇总了Java中com.google.gwt.core.client.GWT类的典型用法代码示例。如果您正苦于以下问题:Java GWT类的具体用法?Java GWT怎么用?Java GWT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GWT类属于com.google.gwt.core.client包,在下文中一共展示了GWT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadMainDocument
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public void loadMainDocument(String url) {
if (mode == DataSourceManagerMode.LOADING_ASSESSMENT || mode == DataSourceManagerMode.LOADING_ITEMS || "".equals(url)) {
return;
}
mode = DataSourceManagerMode.LOADING_ASSESSMENT;
String resolvedURL;
resolvedURL = PathUtil.resolvePath(url, GWT.getHostPageBaseURL());
new eu.ydp.empiria.player.client.util.file.xml.XmlDocument(resolvedURL, new DocumentLoadCallback<Document>() {
@Override
public void finishedLoading(Document document, String baseURL) {
assesmentXML = new XmlData(document, baseURL);
assessmentDataManager.initializeAssessmentData(assesmentXML);
}
@Override
public void loadingError(String error) {
assessmentDataManager.setAssessmentLoadingError(error);
onLoadFinished();
}
});
}
示例2: testParseResponseFromNodeTest
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public void testParseResponseFromNodeTest() {
ResponseNodeJAXBParserFactory responseNodeJAXBParserFactory = GWT.create(ResponseNodeJAXBParserFactory.class);
responseNodeParser = new ResponseNodeParser(responseNodeJAXBParserFactory, new ResponseBeanConverter());
Response response = responseNodeParser.parseResponseFromNode(getResponseDeclaration());
assertEquals(response.cardinality, Cardinality.MULTIPLE);
assertEquals(response.identifier, "CONNECTION_RESPONSE_1");
assertEquals(response.evaluate, Evaluate.CORRECT);
assertEquals(response.cardinality, Cardinality.MULTIPLE);
assertEquals(response.getCheckMode(), CheckMode.EXPRESSION);
assertEquals(3, response.correctAnswers.getAllAnswers().size());
assertEquals(response.correctAnswers.getAllAnswers().get(0), "CONNECTION_RESPONSE_1_0 CONNECTION_RESPONSE_1_1");
assertEquals(response.correctAnswers.getAllAnswers().get(1), "CONNECTION_RESPONSE_1_0 CONNECTION_RESPONSE_1_2");
assertEquals(response.correctAnswers.getAllAnswers().get(2), "CONNECTION_RESPONSE_1_3 CONNECTION_RESPONSE_1_4");
assertEquals(response.getID(), "CONNECTION_RESPONSE_1"); // checkMode
assertEquals(response.getAppropriateCountMode(), CountMode.SINGLE);
assertEquals(response.groups.get(0), "x1");
assertEquals(response.groups.get(1), "x2");
}
示例3: onModuleLoad
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public void onModuleLoad() {
ScriptInjector.fromUrl(GWT.getModuleBaseURL()+"bower_components/webcomponents-lite.min.js").setWindow(ScriptInjector.TOP_WINDOW).setCallback(
new Callback<Void, Exception>() {
@Override
public void onSuccess(Void result) {
LOGGER.info("injection success");
importPolymer();
}
@Override
public void onFailure(Exception reason) {
}
}).inject();
LOGGER.info("Initializing Layout client UI module ...");
new ModuleConfigurator().configureModule(new LayoutUIModuleConfiguration());
}
示例4: afterInitialization
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
@AfterInitialization
public void afterInitialization() {
authenticationServiceCaller.call(new RemoteCallback<User>() {
@Override
public void callback(User user) {
Label userLabel = new Label(
"User logged in: username=" + user.getIdentifier() + ", roles=" + user.getRoles());
RootPanel.get().add(userLabel);
SimplePanel panel = new SimplePanel();
Anchor logoutLink = new Anchor("Spring Security Logout URL", GWT.getHostPageBaseURL() + "logout");
panel.add(logoutLink);
RootPanel.get().add(panel);
initBtns();
}
}).getUser();
}
示例5: GeoprocessComboBox
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public GeoprocessComboBox(Collection<Geoprocess> spatialOperations) {
super(new ListStore<Geoprocess>(
((GeoprocessProperties)GWT.create(GeoprocessProperties.class)).key()),
((GeoprocessProperties)GWT.create(GeoprocessProperties.class)).name());
initialize();
getStore().addAll(spatialOperations);
}
示例6: ensureInjected
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
/**
* Injects ChartJS if not injected yet.
*/
static void ensureInjected() {
if (!injected) {
// gets resource
Resources res = GWT.create(Resources.class);
// gets source of ChartJS
String source = res.chartJsSource().getText();
// creates a script element
ScriptElement scriptElement = Document.get().createScriptElement();
// sets ID
scriptElement.setId(CHART_JS_SCRIPT_ELEMENT_ID);
// sets the script content with ChartJS source
scriptElement.setInnerText(source);
// appends to the body
Document.get().getBody().appendChild(scriptElement);
injected = true;
}
}
示例7: load
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
/**
* TODO: query the programs by users
*
* @param userEmail used to filter myDatasets
*/
public static DatasetTree load(final String userEmail) {
final DatasetTree tree = new DatasetTree();
DatasetServiceAsync svc = GWT.create(DatasetService.class);
svc.load(new AsyncCallback<List<Dataset>>() {
@Override
public void onFailure(Throwable caught) {
logger.info("Failed to load data component:" + caught.getMessage());
}
@Override
public void onSuccess(List<Dataset> result) {
for (Dataset m : result) {
if (!m.getDeprecated()) {
DatasetLeaf node = new DatasetLeaf(m);
addDatasetLeaf(tree, node, userEmail);
addContextMenu(tree,node);
}
}
}
});
return tree;
}
示例8: createDownloadData
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
/**
* Create DownloadDataItem
* @param com
* @return DownloadDataItem
*/
public static MenuItem createDownloadData(HasRightMouseUpMenu com) {
Command command = new MenuItemCommand(com) {
@Override
public void execute() {
DatasetWidget widget = (DatasetWidget) this.component;
widget.getContextMenu().hide();
OutNodeShape shape = widget.getOutNodeShapes().get(0);
String filename = shape.getAbsolutePath() + "/" + shape.getFileId();
String url = GWT.getModuleBaseURL().split("EMLStudio")[0]
+ "EMLStudioMonitor/filedownload?filename=" + filename;
Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");
}
};
MenuItem item = new MenuItem("Download", command);
return item;
}
示例9: safeObjectAppend
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
private static void safeObjectAppend(StringBuilder sbuf, Object o) {
try {
sbuf.append(o.toString());
} catch (Throwable t) {
GWT.log("SLF4J: Failed toString() invocation on an object of type ["
+ o.getClass().getName() + "]", t);
/*
System.err
.println("SLF4J: Failed toString() invocation on an object of type ["
+ o.getClass().getName() + "]");
t.printStackTrace();
*/
sbuf.append("[FAILED toString()]");
}
}
示例10: init
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public static void init() {
GWT.setUncaughtExceptionHandler(throwable -> LOGGER.error("Uncaught Exception", throwable));
ClientRouter clientRouter = new ClientRouter(new ClientEventFactory());
ServerRouter serverRouter = new ServerRouter(new GwtRequestAsyncSender(new ServerEventFactory()));
RequestEventProcessor requestEventProcessor = new RequestEventProcessor();
SimpleEventsBus eventBus = new SimpleEventsBus(requestEventProcessor);
ClientApp.ClientAppBuilder
.clientRouter(clientRouter)
.serverRouter(serverRouter)
.eventsBus(eventBus)
.requestRepository(new InMemoryCommandsRepository())
.presentersRepository(new InMemoryPresentersRepository())
.viewsRepository(new InMemoryViewRepository())
.contributionsRepository(new InMemoryContributionRepository())
.requestSendersRepository(new InMemoryRequestRestSendersRepository())
.history(new StateHistory())
.asyncRunner(new GwtAsyncRunner())
.mainExtensionPoint(new CoreMainExtensionPoint())
.dominoOptions(new RestyGwtOptions())
.build();
}
示例11: createUrlToShare
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
private SelectHandler createUrlToShare(final VerticalPanel geoDataContainer) {
return new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
urlToShareAnchor.setHref(getHref());
urlToShareAnchor.setText(
UIMessages.INSTANCE.seeOtherWindow("GeoWE Project"),
Direction.LTR);
urlShared.setText(getHref());
urlPanel.setVisible(true);
urlShared.setVisible(true);
}
private String getHref() {
String baseUrl = GWT.getHostPageBaseURL();
baseUrl += "?projectUrl="
+ URL.encodeQueryString(urlTextField.getValue());
return baseUrl;
}
};
}
示例12: write
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
@Override
public String write() throws IOException {
TypeSpec.Builder senderBuilder = makeSenderBuilder();
if (hasServiceRoot())
senderBuilder.addField(addServiceRoot());
senderBuilder.addField(addPathField());
TypeSpec serviceInterface = new ServiceInterfaceBuilder().build();
senderBuilder.addType(serviceInterface);
ClassName serviceInterfaceType = ClassName.bestGuess(serviceInterface.name);
FieldSpec serviceInterfaceField = FieldSpec.builder(serviceInterfaceType, "service")
.addModifiers(Modifier.PRIVATE)
.initializer("$T.create($T.class)", GWT.class, serviceInterfaceType)
.build();
senderBuilder.addField(serviceInterfaceField);
senderBuilder.addMethod(new SendMethodBuilder().build());
StringBuilder asString = new StringBuilder();
JavaFile.builder(processorElement.elementPackage(), senderBuilder.build()).skipJavaLangImports(true).build().writeTo(asString);
return asString.toString();
}
示例13: initPageAsync
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public void initPageAsync(final String page) {
GWT.runAsync(new RunAsyncCallback() {
public void onSuccess() {
init(page);
LoadingWidget.getInstance().hide();
}
public void onFailure(Throwable reason) {
Label error = new Label(MESSAGES.failedToLoadPage(reason.getMessage()));
error.setStyleName("unitime-ErrorMessage");
RootPanel loading = RootPanel.get("UniTimeGWT:Loading");
if (loading != null) loading.setVisible(false);
RootPanel.get("UniTimeGWT:Body").add(error);
LoadingWidget.getInstance().hide();
UniTimeNotifications.error(MESSAGES.failedToLoadPage(reason.getMessage()), reason);
}
});
}
示例14: initLayerCombo1
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
private ComboBox<VectorLayerInfo> initLayerCombo1() {
VectorLayerProperties properties = GWT
.create(VectorLayerProperties.class);
layerStore1 = new ListStore<VectorLayerInfo>(properties.key());
layerCombo1 = new ComboBox<VectorLayerInfo>(layerStore1,
properties.name());
layerCombo1.setEmptyText((UIMessages.INSTANCE.sbLayerComboEmptyText()));
layerCombo1.setTypeAhead(true);
layerCombo1.setTriggerAction(TriggerAction.ALL);
layerCombo1.setForceSelection(true);
layerCombo1.setEditable(false);
layerCombo1.enableEvents();
layerCombo1.setWidth(width);
layerCombo1.addSelectionHandler(new SelectionHandler<VectorLayerInfo>() {
@Override
public void onSelection(SelectionEvent<VectorLayerInfo> event) {
layerCombo1.setValue(event.getSelectedItem(), true);
}
});
return layerCombo1;
}
示例15: authenticate
import com.google.gwt.core.client.GWT; //导入依赖的package包/类
public void authenticate() {
if (!CONSTANTS.allowUserLogin()) {
if (isAllowLookup())
doLookup();
else
ToolBox.open(GWT.getHostPageBaseURL() + "login.do?target=" + URL.encodeQueryString(Window.Location.getHref()));
return;
}
AriaStatus.getInstance().setText(ARIA.authenticationDialogOpened());
iError.setVisible(false);
iDialog.center();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
iUserName.selectAll();
iUserName.setFocus(true);
}
});
}