本文整理汇总了Java中com.google.gwt.core.shared.GWT类的典型用法代码示例。如果您正苦于以下问题:Java GWT类的具体用法?Java GWT怎么用?Java GWT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GWT类属于com.google.gwt.core.shared包,在下文中一共展示了GWT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDoubleClick
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
@Override
public void onDoubleClick(DoubleClickEvent event) {
GWT.log("onDoubleClick(DoubleClickEvent)");
if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
doubleClickDetectionMaxTimer.cancel();
if (!insideDoubleClickDetectionInterval && numberOfMouseClicksDetected < 2) {
return; // ignore double-click
}
if (targetBarElement != null) {
disableClickOnNextMouseUp();
targetBarElement = null;
}
Element bar = getBar(event.getNativeEvent());
if (bar != null && numberOfMouseClicksDetected > 1) {
fireClickRpc(bar, event.getNativeEvent());
}
cancelDoubleClickDetection();
}
}
示例2: testJAXB
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
public void testJAXB() {
DrawingModuleJAXBParserFactory jaxbFactory = GWT.create(DrawingModuleJAXBParserFactory.class);
JAXBParser<DrawingBean> jaxbParser = jaxbFactory.create();
DrawingBean drawingBean = jaxbParser.parse(xml);
assertEquals(drawingBean.getId(), ID);
ImageBean imageBean = drawingBean.getImage();
assertEquals(imageBean.getWidth(), WIDTH);
assertEquals(imageBean.getHeight(), HEIGHT);
assertEquals(imageBean.getSrc(), SRC);
List<ColorBean> colorBeans = drawingBean.getPalette().getColors();
int size = colorBeans.size();
assertEquals(3, size);
for (int x = 0; x < size; ++x) {
ColorBean colorBean = colorBeans.get(x);
assertEquals(colorBean.getDescription(), colorNames.get(x));
assertEquals(colorBean.getRgb(), colors.get(x));
}
}
示例3: getContainerOffsetLeft
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
protected int getContainerOffsetLeft() {
if (containerOffsetLeft < 0 || !sync) {
int scrollLeft = 0;
Element parent = DOM.getParent(getWidget().getElement());
while (parent != null) {
if (getScrollLeft(parent) > 0) {
scrollLeft += getScrollLeft(parent);
GWT.log("Scroll left detected : " + scrollLeft);
}
if (containerFinder.isContainer(parent)) {
containerOffsetLeft = DOM.getAbsoluteLeft(parent) - scrollLeft;
}
parent = DOM.getParent(parent);
}
}
return containerOffsetLeft;
}
示例4: getContainerOffsetTop
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
protected int getContainerOffsetTop() {
if (containerOffsetTop < 0 || !sync) {
int scrollTop = 0;
Element parent = DOM.getParent(getWidget().getElement());
while (parent != null) {
if (getScrollTop(parent) > 0) {
scrollTop += getScrollTop(parent);
GWT.log("Scroll Top detected : " + scrollTop);
}
if (containerFinder.isContainer(parent)) {
containerOffsetTop = DOM.getAbsoluteTop(parent) - scrollTop;
}
parent = DOM.getParent(parent);
}
}
return containerOffsetTop;
}
示例5: getPresenter
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
@Override
public Presenter getPresenter() {
return new Presenter() {
public void go(HasWidgets hasWidgets) {
hasWidgets.add(widget);
String id=GWTEnvironment.getHomeTemplateId();
RPCS.getFileManagerService().getHomeFile(id, new AbstractAsyncCallback<FileModel>() {
public void onSuccess(FileModel result) {
widget.setContent(result.getContent());
}
@Override
public void onFailure(Throwable caught) {
TemplateResources templates=GWT.create(TemplateResources.class);
widget.setContent(templates.home().getText());
}
});
}
@Override
public PlatformContext getPlatformContext() {
return null;
}
};
}
示例6: createWidget
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
@Override
public Button createWidget() {
final Button b = GWT.create(Button.class);
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder
.buildMouseEventDetails(event.getNativeEvent(),
b.getElement());
Element e = b.getElement();
rpc.onClick(e.getPropertyString(ROW_KEY_PROPERTY),
e.getPropertyString(COLUMN_ID_PROPERTY),mouseEventDetails);
event.stopPropagation();
}
});
b.setStylePrimaryName("v-nativebutton");
return b;
}
示例7: delete
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
public void delete(String[] pids, Map<?,?> options) {
final ClientMessages i18n = GWT.create(ClientMessages.class);
HashMap<String, String> deleteParams = new HashMap<String, String>();
deleteParams.put(DigitalObjectResourceApi.DELETE_PURGE_PARAM,
option(options.get(DigitalObjectResourceApi.DELETE_PURGE_PARAM), Boolean.FALSE.toString()));
deleteParams.put(DigitalObjectResourceApi.DELETE_HIERARCHY_PARAM,
option(options.get(DigitalObjectResourceApi.DELETE_HIERARCHY_PARAM), Boolean.TRUE.toString()));
DSRequest dsRequest = new DSRequest();
dsRequest.setPromptStyle(PromptStyle.DIALOG);
dsRequest.setPrompt(i18n.DeleteAction_Deleting_Msg());
dsRequest.setParams(deleteParams);
Record query = new Record();
query.setAttribute(FIELD_PID, pids);
DigitalObjectDataSource.getInstance().removeData(query, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
if (RestConfig.isStatusOk(response)) {
StatusView.getInstance().show(i18n.DeleteAction_Done_Msg());
DigitalObjectDataSource.this.updateCaches(response, request);
SearchDataSource.getInstance().updateCaches(response, request);
RelationDataSource.getInstance().updateCaches(response, request);
}
}
}, dsRequest);
}
示例8: showResults
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
public void showResults(JsonRiskAnalysis summary, JSONObject response) {
risksLabel = new Label("Risks");
risksLabel.setStyleName("smallTitle");
goalsLabel = new Label("Goals");
goalsLabel.setStyleName("smallTitle");
this.response = response;
this.summary = summary;
this.jsonArgumentation = response.get("argumentation");
Codec codec = GWT.create( Codec.class );
if( jsonArgumentation != null ) {
argumentation = codec.decode( jsonArgumentation );
}
results = new HashMap<>();
tree.clear();
if (response.get("hresults") != null ) generateTree(tree, response.get("hresults"));
else {
leftPanel.setWidth("0px");
results.put(summary.getTarget(), response.get("results").isArray());
}
setSelectedEntity(summary.getTarget());
}
示例9: initSoftware
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
private void initSoftware(String softwarename) {
loading.setVisible(true);
this.api.getSoftware(softwarename, new Callback<Software, Throwable>() {
@Override
public void onSuccess(Software sw) {
software = sw;
initSoftwareRDF();
loading.setVisible(false);
if(vocabulary != null)
showSoftware(software);
}
@Override
public void onFailure(Throwable exception) {
GWT.log("Error fetching Software", exception);
}
}, false);
}
示例10: getNewEntity
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
private Entity getNewEntity(Object value) {
String proptype = property.getRange();
String id = GUID.randomEntityId(software.getId(), proptype);
// Convert software entities to enumerations
MetadataClass topclass = vocabulary.getType(KBConstants.ONTNS()+"Software");
MetadataClass eclass = vocabulary.getType(proptype);
if(vocabulary.isA(eclass, topclass)) {
proptype = KBConstants.ONTNS()+"EnumerationEntity";
id = id.replace(software.getName()+"#", "");
}
try {
Entity entity = EntityRegistrar.getEntity(id, value, proptype);
entity.setType(property.getRange());
return entity;
} catch (Exception e) {
GWT.log("Coult not get a new entity", e);
return null;
}
}
示例11: getInput
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
public static IEntityInput getInput(Entity entity, MetadataProperty mprop, Vocabulary vocabulary)
throws Exception {
String inputClass = inputClasses.get(mprop.getRange());
if(inputClass != null) {
Object item = entityFactory.instantiate(inputClass);
if(item == null) {
GWT.log("Cannot instantiate input for "+mprop.getRange());
throw new Exception("Cannot instantiate input for "+mprop.getRange());
}
else if(item instanceof IEntityInput) {
((IEntityInput) item).createWidget(entity, mprop, vocabulary);
return (IEntityInput) item;
}
else {
GWT.log("Item not an extension of IEntityInput");
throw new Exception("Item not an extension of IEntityInput");
}
}
return null;
}
示例12: getEntity
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
public static Entity getEntity(String id, Object value, String type)
throws Exception {
String entityClass = entityClasses.get(type);
if(entityClass != null) {
Object item = entityFactory.instantiate(entityClass);
if(item == null) {
GWT.log("Cannot instantiate entity for "+type);
throw new Exception("Cannot instantiate entity for "+type);
}
else if(item instanceof Entity) {
Entity entity = (Entity) item;
entity.setId(id);
entity.setType(type);
if(value != null)
entity.setValue(value);
return entity;
}
else {
GWT.log("Item not an extension of Entity");
throw new Exception("Item not an extension of Entity");
}
}
return null;
}
示例13: registerEntityInputs
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
private void registerEntityInputs() {
final String pkg = EntityInput.class.getName().replaceAll("(.*\\.).*?$", "$1");
for(MetadataType type : vocabulary.getTypes().values()) {
ArrayList<String> queue = new ArrayList<String>();
//GWT.log("-------- "+type.getName());
queue.add(type.getId());
boolean registered = false;
while(!queue.isEmpty()) {
MetadataType qtype = vocabulary.getType(queue.remove(0));
if(qtype != null) {
String qInputWidgetClass = pkg + qtype.getName() + "Input";
//GWT.log("Checking for "+qtype.getName()+ " = "+qInputWidgetClass);
if(EntityRegistrar.registerInputClass(type.getId(), qInputWidgetClass)) {
registered = true;
break;
}
queue.add(qtype.getParent());
}
}
if(!registered)
GWT.log("** Cannot find adapter for "+type.getId());
}
}
示例14: registerEntities
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
private void registerEntities() {
final String pkg = Entity.class.getName().replaceAll("(.*\\.).*?$", "$1");
for(MetadataType type : vocabulary.getTypes().values()) {
ArrayList<String> queue = new ArrayList<String>();
//GWT.log("-------- "+type.getName());
queue.add(type.getId());
boolean registered = false;
while(!queue.isEmpty()) {
MetadataType qtype = vocabulary.getType(queue.remove(0));
if(qtype != null) {
String qInputWidgetClass = pkg + qtype.getName();
//GWT.log("Checking for "+qtype.getName()+ " = "+qInputWidgetClass);
if(EntityRegistrar.registerEntityClass(type.getId(), qInputWidgetClass)) {
registered = true;
break;
}
queue.add(qtype.getParent());
}
}
if(!registered)
GWT.log("** Cannot find adapter for "+type.getId());
}
}
示例15: decodePage
import com.google.gwt.core.shared.GWT; //导入依赖的package包/类
private boolean decodePage(PageItem pageItem) {
DjVuPage page = pageItem.page;
try {
if (page == null) {
page = pageItem.page = document.getPage(pageItem.pageNum);
if (page == null)
return true; // not downloaded yet
GWT.log("Decoding page " + pageItem.pageNum);
}
if (page.decodeStep()) {
pageItem.isDecoded = true;
if (pageItem.info == null) {
pageItem.setInfo(page.getInfo());
pageItem.setText(page.getText());
}
pageItem.memoryUsage = page.getMemoryUsage();
pagesMemoryUsage += pageItem.memoryUsage;
}
return true;
} catch (IOException e) {
GWT.log("Error while decoding page " + pageItem.pageNum, e);
return false;
}
}