List of usage examples for com.google.gwt.user.client.ui Label getText
public String getText()
From source file:carteirainveste.client.DateUtil.java
License:Creative Commons License
public void onClick(ClickEvent event) { Carteira curr = CarteiraInveste.carteiraAtual; if (curr.quoteService == null) curr.quoteService = (QuoteServiceAsync) GWT.create(QuoteService.class); Date quoteDate = curr.portfolioEndDate.getValue(); int rowCount = curr.portfolioTab.getRowCount() - 1; for (int row = 1; row < rowCount; ++row) { QuoteServiceGetQuoteCallback callback = new QuoteServiceGetQuoteCallback(row); Label asset = (Label) curr.portfolioTab.getWidget(row, 0); String assetName = asset.getText(); curr.portfolioDebug(// w w w . j a v a 2s . c om "QuoteService.getQuote: " + Preference.dateFormat.format(quoteDate) + " " + assetName); curr.quoteService.getQuote(quoteDate, assetName, callback); } }
From source file:com.allen_sauer.gwt.dnd.demo.client.example.palette.PaletteWidget.java
License:Apache License
public PaletteWidget cloneWidget() { Widget clone;// www . j av a 2 s . com // Clone our internal widget if (widget instanceof Label) { Label label = (Label) widget; clone = new Label(label.getText()); } else if (widget instanceof RadioButton) { RadioButton radioButton = (RadioButton) widget; clone = new RadioButton(radioButton.getName(), radioButton.getHTML(), true); } else if (widget instanceof CheckBox) { CheckBox checkBox = (CheckBox) widget; clone = new CheckBox(checkBox.getHTML(), true); } else { throw new IllegalStateException("Unhandled Widget class " + widget.getClass().getName()); } // Copy a few obvious common widget properties clone.setStyleName(widget.getStyleName()); clone.setTitle(widget.getTitle()); // Wrap the cloned widget in a new PaletteWidget instance return new PaletteWidget(clone); }
From source file:com.dimdim.conference.ui.layout.client.widget.ConsoleTopPanel.java
License:Open Source License
public void onDisplayNameChanged() { UIRosterEntry user = ClientModel.getClientModel().getRosterModel().getCurrentUser(); //Window.alert("the name that is changed is "+user.getDisplayName()); this.currentUser = user; String nm = this.currentUser.getDisplayName(); Label temp = new FixedLengthLabel(nm, 25); nameLabel.setText(temp.getText()); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.DetailScreen.java
License:Apache License
/** * displayGuts Renders the guts of the DetailView and sets up handlers for the node record after it has been retrieved and is available */// ww w.ja va 2 s . c o m public void displayGuts() { if (fullScreen) { PageAssembler.ready(new HTML(Russel.htmlTemplates.getDetailPanel().getText())); PageAssembler.buildContents(); DOM.getElementById("r-menuWorkspace").getParentElement().removeClassName("active"); DOM.getElementById("r-menuCollections").getParentElement().removeClassName("active"); DOM.getElementById("r-menuProjects").getParentElement().removeClassName("active"); DOM.getElementById("r-fullScreen").setAttribute("style", "display:none"); DOM.getElementById("r-metadata-hide").setAttribute("style", "display:none"); DOM.getElementById("r-metadata-show").setAttribute("style", ""); } else { DOM.getElementById("r-fullScreen").setAttribute("style", ""); PageAssembler.attachHandler(PageAssembler.getElementByClass(".reveal-modal-bg"), Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { if (tile != null) tile.refreshTile(null); } }); PageAssembler.attachHandler(PageAssembler.getElementByClass(".close-reveal-modal"), Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { if (tile != null) tile.refreshTile(null); } }); } if (record.getFilename().substring(record.getFilename().lastIndexOf(".") + 1).equalsIgnoreCase("rpf")) { DOM.getElementById("r-editEPSSContainer").removeAttribute("style"); PageAssembler.attachHandler("r-editEPSS", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { RusselApi.getResource(tile.getSearchRecord().getGuid(), true, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket alfrescoPacket) { ProjectRecord pr = new ProjectRecord(alfrescoPacket.getContentString(), record); Russel.screen.loadScreen(new EPSSScreen(pr), true); } @Override public void onFailure(Throwable caught) { StatusHandler.createMessage( StatusHandler.getProjectLoadMessageError(record.getFilename()), StatusRecord.ALERT_ERROR); } }); } }); } else DOM.getElementById("r-editEPSSContainer").setAttribute("style", "display:none"); setDisplayIE(DOM.getElementById("r-metadata-hide"), "block"); setDisplayIE(DOM.getElementById("r-metadata-show"), "none"); setDisplayIE(DOM.getElementById("r-generalMetadata"), "block"); setDisplayIE(DOM.getElementById("r-educationalMetadata"), "none"); setDisplayIE(DOM.getElementById("r-technicalMetadata"), "none"); setDisplayIE(DOM.getElementById("r-relatedMetadata"), "none"); if (record.getGuid() == "" && record.getFilename().endsWith(".flr")) { setDisplayIE(DOM.getElementById("r-postFlr"), "none"); setDisplayIE(DOM.getElementById("r-saveFromFlr"), "block"); setDisplayIE(DOM.getElementById("r-detailGenerateMetadata"), "none"); } else { setDisplayIE(DOM.getElementById("r-postFlr"), "block"); setDisplayIE(DOM.getElementById("r-saveFromFlr"), "none"); setDisplayIE(DOM.getElementById("r-detailGenerateMetadata"), "block"); } ((Label) PageAssembler.elementToWidget("general-section", PageAssembler.LABEL)) .removeStyleName("collapsed"); ((Label) PageAssembler.elementToWidget("educational-section", PageAssembler.LABEL)) .addStyleName("collapsed"); ((Label) PageAssembler.elementToWidget("technical-section", PageAssembler.LABEL)).addStyleName("collapsed"); ((Label) PageAssembler.elementToWidget("related-section", PageAssembler.LABEL)).addStyleName("collapsed"); ((TextBox) PageAssembler.elementToWidget("input-comment", PageAssembler.TEXT)).setText(""); DOM.getElementById("detailLevel1").setAttribute("disabled", ""); DOM.getElementById("detailDistribution1").setAttribute("disabled", ""); ((Label) PageAssembler.elementToWidget("r-detailIcon", PageAssembler.LABEL)).setStyleName("r-icon"); ((Label) PageAssembler.elementToWidget("r-detailIcon", PageAssembler.LABEL)) .addStyleName(AssetExtractor.getFileType(record.getFilename())); removeUnsavedEffects0(); PageAssembler.attachHandler("r-saveFromFlr", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { RusselApi.uploadResource(record.getFileContents(), record.getFilename(), new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { record.setGuid(esbPacket.getPayloadString()); ESBPacket pack = new ESBPacket(record.toString()); pack.remove("uploadDate_l"); pack.remove("updatedDate_l"); RusselApi.updateResourceMetadata(record.getGuid(), pack, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { PageAssembler.closePopup("objDetailModal"); } @Override public void onFailure(Throwable caught) { } }); } @Override public void onFailure(Throwable caught) { } }); } }); PageAssembler.attachHandler("r-detailGenerateMetadata", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { final StatusRecord status = StatusHandler.createMessage( StatusHandler.getGenerateMetaDataBusy(record.getFilename()), StatusRecord.ALERT_BUSY); final ESBCallback<ESBPacket> callback = new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { status.setState(StatusRecord.ALERT_ERROR); status.setMessage(StatusHandler.getGenerateMetaDataError(record.getFilename())); StatusHandler.alterMessage(status); } @Override public void onSuccess(ESBPacket esbPacket) { status.setState(StatusRecord.ALERT_SUCCESS); status.setMessage(StatusHandler.getGenerateMetaDataDone(record.getFilename())); StatusHandler.alterMessage(status); final RUSSELFileRecord fr = new RUSSELFileRecord(esbPacket); meta.addMetaDataFields(fr); addUnsavedEffects0(); } }; RusselApi.generateResourceMetadata(record.getGuid(), record.getFilename().endsWith(".rlk") ? true : false, callback); } }); PageAssembler.attachHandler("r-detailEditUpdate", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { final StatusRecord status = StatusHandler.createMessage( StatusHandler.getUpdateMetadataMessageBusy(record.getFilename()), StatusRecord.ALERT_BUSY); RusselApi.updateResourceMetadata(record.getGuid(), meta.buildMetaPacket(record).toObject(), new ESBCallback<ESBPacket>() { @Override public void onSuccess(final ESBPacket nullPack) { status.setMessage(StatusHandler.getUpdateMetadataMessageDone(record.getFilename())); status.setState(StatusRecord.ALERT_SUCCESS); StatusHandler.alterMessage(status); RusselApi.getResourceMetadata(record.getGuid(), false, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket ap) { removeUnsavedEffects0(); record.parseESBPacket(ap); meta.addMetaDataFields(record); Label title = ((Label) PageAssembler .elementToWidget("r-detailTitle", PageAssembler.LABEL)); if (tile != null) tile.fillTile(null); if (title.getText().equalsIgnoreCase("n/a")) title.setText(record.getFilename()); } @Override public void onFailure(Throwable caught) { removeUnsavedEffects0(); } }); } @Override public void onFailure(Throwable caught) { status.setMessage( StatusHandler.getUpdateMetadataMessageError(record.getFilename())); status.setState(StatusRecord.ALERT_ERROR); StatusHandler.alterMessage(status); } }); } }); PageAssembler.attachHandler("r-fullScreen", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { PageAssembler.closePopup("objDetailModal"); PageAssembler.removeElement("objDetailModal"); PageAssembler.removeByClass("reveal-modal-bg"); Russel.screen.loadScreen(new DetailScreen(record, FULL_SCREEN), false); } }); PageAssembler.attachHandler("r-deleteDoc", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { if (Window.confirm("Are you sure you wish to delete this item?")) { final StatusRecord status = StatusHandler.createMessage( StatusHandler.getDeleteMessageBusy(record.getFilename()), StatusRecord.ALERT_BUSY); RusselApi.deleteResource(record.getGuid(), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { status.setMessage(StatusHandler.getDeleteMessageError(record.getFilename())); status.setState(StatusRecord.ALERT_ERROR); StatusHandler.alterMessage(status); } @Override public void onSuccess(ESBPacket result) { status.setMessage(StatusHandler.getDeleteMessageDone(record.getFilename())); status.setState(StatusRecord.ALERT_SUCCESS); StatusHandler.alterMessage(status); ((TextBox) PageAssembler.elementToWidget("r-menuSearchBar", PageAssembler.TEXT)) .setText(""); PageAssembler.closePopup("objDetailModal"); if (record instanceof RUSSELFileRecord) { if (((RUSSELFileRecord) record).getFlrDocId() != "") RusselApi .publishToFlr(record.getGuid(), FLRPacketGenerator .buildFlrDeleteNsdlPacket(((RUSSELFileRecord) record)), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { StatusHandler.createMessage( StatusHandler.getFLRDeleteMessageError( record.getFilename()), StatusRecord.ALERT_ERROR); } @Override public void onSuccess(ESBPacket esbPacket) { final StatusRecord status = StatusHandler.createMessage( StatusHandler.getFLRDeleteMessageDone( record.getFilename()), StatusRecord.ALERT_SUCCESS); } }); if (((RUSSELFileRecord) record).getFlrParadataId() != "") RusselApi .publishToFlr(record.getGuid(), FLRPacketGenerator.buildFlrDeleteParadataPacket( ((RUSSELFileRecord) record)), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { StatusHandler.createMessage( StatusHandler.getFLRDeleteActivityError( record.getFilename()), StatusRecord.ALERT_ERROR); } @Override public void onSuccess(ESBPacket esbPacket) { final StatusRecord status = StatusHandler.createMessage( StatusHandler.getFLRDeleteParadataDone( record.getFilename()), StatusRecord.ALERT_SUCCESS); } }); } } }); } } }); PageAssembler.attachHandler("comment-submit", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { final String comment = ((TextBox) PageAssembler.elementToWidget("input-comment", PageAssembler.TEXT)).getText().trim(); if (comment != null && comment.trim() != "" && !comment.equalsIgnoreCase("add comment")) { RusselApi.addComment(record.getGuid(), comment, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { esbPacket = esbPacket.getObject("obj"); record.parseESBPacket(esbPacket.getObject("m")); CommentRecord commentRecord = new CommentRecord( new ESBPacket(esbPacket.getString("c"))); fillComment0(commentRecord); ((TextBox) PageAssembler.elementToWidget("input-comment", PageAssembler.TEXT)) .setText(""); } @Override public void onFailure(Throwable caught) { ((TextBox) PageAssembler.elementToWidget("input-comment", PageAssembler.TEXT)) .setText(""); StatusHandler.createMessage(StatusHandler.getCommentMessageError(record.getFilename()), StatusRecord.ALERT_ERROR); } }); } } }); Document.get().getElementById("r-downloadDoc").setAttribute("href", RusselApi.downloadContentUrl(record.getGuid(), true)); ((Label) PageAssembler.elementToWidget("r-rating-info", PageAssembler.LABEL)).setText("Current rating: " + MathUtil.roundNumber(record.getRating(), 2) + " (" + record.getVotes() + " votes)"); DOM.getElementById("r-ratingLabel").setAttribute("style", "width: " + MathUtil.roundNumber((record.getRating() / 5.0) * 100, 2) + "%"); fillComments0(); ((Label) PageAssembler.elementToWidget("detailMetaFilename", PageAssembler.LABEL)) .setText(record.getFilename()); String ext = record.getFilename().substring(record.getFilename().lastIndexOf(".") + 1); if (ext.equalsIgnoreCase("png") || ext.equalsIgnoreCase("tiff") || ext.equalsIgnoreCase("tif") || ext.equalsIgnoreCase("bmp") || ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg") || ext.equalsIgnoreCase("gif")) { DOM.getElementById("r-preview").setInnerHTML(""); RootPanel.get("r-preview").add(new Image(RusselApi.downloadContentUrl(record.getGuid(), false))); } else if (ext.equalsIgnoreCase("rlk")) { RusselApi.getResource(record.getGuid(), false, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { record.setFileContents(esbPacket.getContentString()); DOM.getElementById("r-preview").setInnerHTML("<a href=" + record.getFileContents() + " target=\"_blank\">" + record.getFileContents().replaceAll("\"", "") + "</a>"); } @Override public void onFailure(Throwable caught) { } }); } else if (isTextFormat(ext)) { RusselApi.getResource(record.getGuid(), false, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { record.setFileContents(esbPacket.getContentString()); DOM.getElementById("r-preview").setInnerHTML(record.getFileContents()); } @Override public void onFailure(Throwable caught) { } }); } else if (ext.equalsIgnoreCase("Mp4") || ext.equalsIgnoreCase("WebM") || ext.equalsIgnoreCase("Ogg")) { String videoType = (ext.equalsIgnoreCase("Mp4")) ? "audio/mp4" : (ext.equalsIgnoreCase("WebM")) ? "audio/webm" : (ext.equalsIgnoreCase("Ogg")) ? "audio/ogg" : ""; String htmlString = "<video controls=\"controls\"><source src=\"" + RusselApi.downloadContentUrl(record.getGuid(), false) + "\" type=\"" + videoType + "\"></source></video>"; RootPanel.get("r-preview").getElement().setInnerHTML(htmlString); } else if (ext.equalsIgnoreCase("Mp3") || ext.equalsIgnoreCase("Wav") || ext.equalsIgnoreCase("Ogg")) { String audioType = (ext.equalsIgnoreCase("Mp3")) ? "audio/mp3" : (ext.equalsIgnoreCase("Wav")) ? "audio/wav" : (ext.equalsIgnoreCase("Ogg")) ? "audio/ogg" : ""; String htmlString = "<audio controls=\"controls\"><source src=\"" + RusselApi.downloadContentUrl(record.getGuid(), false) + "\" type=\"" + audioType + "\"></source></audio>"; RootPanel.get("r-preview").getElement().setInnerHTML(htmlString); } else if (ext.equalsIgnoreCase("swf")) { String htmlString = "<object id=\"FlashID\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" data=\"" + RusselApi.downloadContentUrl(record.getGuid(), false) + "\" height=\"100%\" width=\"100%\">" + "<param name=\"movie\" value=\"" + RusselApi.downloadContentUrl(record.getGuid(), false) + "\">" + "<param name=\"quality\" value=\"high\">" + "<param name=\"wmode\" value=\"transparent\">" + "<param name=\"swfversion\" value=\"10.0\">" + "<param name=\"allowScriptAccess\" value=\"always\">" + "<param name=\"BGCOLOR\" value=\"#000000\">" + "<param name=\"expressinstall\" value=\"Scripts/expressInstall.swf\">" + "<!--[if !IE]>-->" + "<object id=\"FlashID2\" type=\"application/x-shockwave-flash\" data=\"" + RusselApi.downloadContentUrl(record.getGuid(), false) + "\" height=\"100%\" width=\"100%\">" + "<!--<![endif]-->" + "<param name=\"movie\" value=\"" + RusselApi.downloadContentUrl(record.getGuid(), false) + "\">" + "<param name=\"quality\" value=\"high\">" + "<param name=\"wmode\" value=\"transparent\">" + "<param name=\"swfversion\" value=\"10.0\">" + "<param name=\"allowScriptAccess\" value=\"always\">" + "<param name=\"BGCOLOR\" value=\"#000000\">" + "<param name=\"expressinstall\" value=\"Scripts/expressInstall.swf\">" + "<div>" + "<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>" + "<p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" width=\"112\" height=\"33\" /></a></p>" + "</div>" + "<!--[if !IE]>-->" + "</object>" + "<!--<![endif]-->" + "</object>" + "<!--[if !IE]>-->" + "<script type=\"text/javascript\">" + "swfobject.registerObject(\"FlashID2\");" + "</script>" + "<!--<![endif]-->" + "<!--[if IE]>" + "<script type=\"text/javascript\">" + "swfobject.registerObject(\"FlashID\");" + "</script>" + "<![endif]-->"; RootPanel.get("r-preview").getElement().setInnerHTML(htmlString); } else DOM.getElementById("r-preview").setInnerHTML("<p>No Preview Available</p>"); meta.addMetaDataFields(record); if (record.getFOUO()) { ((Label) PageAssembler.elementToWidget("r-detailWarning", PageAssembler.LABEL)).setText(Constants.FOUO); ((Label) PageAssembler.elementToWidget("r-detailWarning", PageAssembler.LABEL)) .setStyleName("r-warning"); } else { ((Label) PageAssembler.elementToWidget("r-detailWarning", PageAssembler.LABEL)).setText(""); ((Label) PageAssembler.elementToWidget("r-detailWarning", PageAssembler.LABEL)) .setStyleName("r-warning hide"); } if (DOM.getElementById("r-detailTitle").getInnerText().equalsIgnoreCase("n/a")) ((Label) PageAssembler.elementToWidget("r-detailTitle", PageAssembler.LABEL)) .setText(record.getFilename()); PageAssembler.attachHandler("r-postFlr", Event.ONCLICK, new EventCallback() { @Override public void onEvent(Event event) { if (FLRApi.FLR_ACTIVITY_MODE.equals(FLRApi.FLR_ACTIVITY_ACTIONS_FEEDBACK) || FLRApi.FLR_ACTIVITY_MODE.equals(FLRApi.FLR_ACTIVITY_ACTIONS_ISD) || FLRApi.FLR_ACTIVITY_MODE.equals(FLRApi.FLR_ACTIVITY_ACTIONS_ALL)) { final StatusRecord flrStatus = StatusHandler.createMessage( StatusHandler.getFLRActivityBusy(record.getFilename()), StatusRecord.ALERT_BUSY); if (record instanceof RUSSELFileRecord) { RusselApi.publishToFlr(record.getGuid(), FLRPacketGenerator.buildFlrParadataPacket(((RUSSELFileRecord) record)), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { flrStatus.setMessage( StatusHandler.getFLRActivityError(record.getFilename())); flrStatus.setState(StatusRecord.ALERT_ERROR); StatusHandler.alterMessage(flrStatus); } @Override public void onSuccess(ESBPacket esbPacket) { flrStatus .setMessage(StatusHandler.getFLRActivityDone(record.getFilename())); flrStatus.setState(StatusRecord.ALERT_SUCCESS); StatusHandler.alterMessage(flrStatus); FLRPacket packet = new FLRPacket(esbPacket.getObject(ESBPacket.OBJECT)); record.setFlrParadataId(packet.getResponseDocID()); RusselApi.updateResourceMetadata(((RUSSELFileRecord) record).getGuid(), ((RUSSELFileRecord) record).toObject(), new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { postFlrNsdl(); } @Override public void onFailure(Throwable caught) { StatusHandler.createMessage( StatusHandler.getMetadataMessageError( record.getFilename()), StatusRecord.ALERT_ERROR); } }); } }); } } else { StatusHandler.createMessage(StatusHandler.getFLRDisabledError("Activity Stream publish"), StatusRecord.ALERT_WARNING); } } }); attachRatingListeners0(); }
From source file:com.eduworks.russel.ui.client.pagebuilder.screen.DetailScreen.java
License:Apache License
private void postFlrNsdl() { if (FLRApi.FLR_PUBLISH_MODE.equals(FLRApi.FLR_PUBLISH_ACTIONS_GENERAL) || FLRApi.FLR_PUBLISH_MODE.equals(FLRApi.FLR_PUBLISH_ACTIONS_ALL)) { final StatusRecord flrStatus = StatusHandler .createMessage(StatusHandler.getFLRMessageBusy(record.getFilename()), StatusRecord.ALERT_BUSY); if (record instanceof RUSSELFileRecord) { RusselApi.publishToFlr(record.getGuid(), FLRPacketGenerator.buildFlrNsdlPacket(((RUSSELFileRecord) record)), new ESBCallback<ESBPacket>() { @Override public void onFailure(Throwable caught) { flrStatus.setMessage(StatusHandler.getFLRMessageError(record.getFilename())); flrStatus.setState(StatusRecord.ALERT_ERROR); StatusHandler.alterMessage(flrStatus); }// w ww . j a v a 2s .co m @Override public void onSuccess(ESBPacket esbPacket) { flrStatus.setMessage(StatusHandler.getFLRMessageDone(record.getFilename())); flrStatus.setState(StatusRecord.ALERT_SUCCESS); StatusHandler.alterMessage(flrStatus); FLRPacket packet = new FLRPacket(esbPacket.getObject(ESBPacket.OBJECT)); record.setFlrDocId(packet.getResponseDocID()); RusselApi.updateResourceMetadata(((RUSSELFileRecord) record).getGuid(), ((RUSSELFileRecord) record).toObject(), new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket esbPacket) { RusselApi.getResourceMetadata(record.getGuid(), false, new ESBCallback<ESBPacket>() { @Override public void onSuccess(ESBPacket ap) { removeUnsavedEffects0(); record.parseESBPacket(ap); meta.addMetaDataFields(record); Label title = ((Label) PageAssembler .elementToWidget("r-detailTitle", PageAssembler.LABEL)); if (title.getText().equalsIgnoreCase("n/a")) title.setText(record.getFilename()); } @Override public void onFailure(Throwable caught) { removeUnsavedEffects0(); } }); } @Override public void onFailure(Throwable caught) { StatusHandler.createMessage( StatusHandler.getMetadataMessageError(record.getFilename()), StatusRecord.ALERT_ERROR); } }); } }); } } else { StatusHandler.createMessage(StatusHandler.getFLRDisabledError("object publish"), StatusRecord.ALERT_WARNING); } }
From source file:com.ephesoft.gxt.login.client.LoginEntryPoint.java
License:Open Source License
@Override public void onLoad() { Window.setTitle(LocaleDictionary.getConstantValue(LoginConstants.LOGIN_TITLE)); Label userName = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_username)); Label password = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_password)); RootPanel.get("loginHeader").getElement() .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.login_button_text)); RootPanel.get("j_username").getElement().setAttribute("placeholder", userName.getText()); RootPanel.get("j_username").getElement().focus(); RootPanel.get("j_password").getElement().setAttribute("placeholder", password.getText()); final Label versionNumber = new Label(); ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new AsyncCallback<String>() { @Override/*from w w w . j a v a 2 s . c o m*/ public void onSuccess(String version) { versionNumber.setText(version); RootPanel.get("versionLabel").getElement().setInnerText(versionNumber.getText()); } @Override public void onFailure(Throwable arg0) { DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE), LocaleDictionary.getConstantValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO), DialogIcon.ERROR); } }); final Label expiryMsg = new Label(); final Label failOverMsg = new Label(); ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new AsyncCallback<Void>() { @Override public void onFailure(Throwable arg0) { String alertMsg = arg0.getLocalizedMessage(); int indexOfDelimiter = alertMsg.indexOf('@'); String days = alertMsg.substring(0, indexOfDelimiter); int remainingDays = Integer.parseInt(days); String dateString = alertMsg.substring(indexOfDelimiter + 1); if (remainingDays != 0) { expiryMsg.setText( LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days, dateString)); } else { expiryMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY)); } expiryMsg.addStyleName(FONT_RED_CSS); expiryMsg.addStyleName(BOLD_TEXT_CSS); RootPanel.get(EXPIRY_MSG_LEBEL).getElement().setInnerText(expiryMsg.getText()); RootPanel.get(EXPIRY_MSG_LEBEL).addStyleName(expiryMsg.getStyleName()); } @Override public void onSuccess(Void arg0) { } }); ((LoginRemoteServiceAsync) createRpcService()).getFailOverMessage(new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean result) { if (true == result) { // failOverMsg.setText(""); } else { failOverMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.FAILOVER_MSG)); failOverMsg.addStyleName(FONT_RED_CSS); failOverMsg.addStyleName(BOLD_TEXT_CSS); RootPanel.get(FAIL_OVER_LABEL).getElement().setInnerText(failOverMsg.getText()); RootPanel.get(FAIL_OVER_LABEL).addStyleName(failOverMsg.getStyleName()); } } @Override public void onFailure(Throwable arg0) { } }); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.addStyleName("horizontalPanel"); RootPanel.get().add(horPanel); ScreenMaskUtility.maskScreen(LocaleDictionary.getMessageValue(LoginMessages.LOADING)); rpcService.getFooterProperties(new AsyncCallback<Map<String, String>>() { @Override public void onSuccess(Map<String, String> footerProperties) { footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY); footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY); final Anchor footerInfo = new Anchor(footerText, footerLink); horPanel.addStyleName("loginFooter"); horPanel.add(footerInfo); horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER); ScreenMaskUtility.unmaskScreen(); } @Override public void onFailure(Throwable arg0) { ScreenMaskUtility.unmaskScreen(); DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE), LocaleDictionary.getMessageValue(LoginMessages.APPLICATION_NOT_AUTHORIZED), DialogIcon.ERROR); } }); RootPanel.get("error").getElement() .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.INVALID_CREDENTIALS)); RootPanel.get("error").addStyleName(FONT_RED_CSS); SubmitButton submitButton = new SubmitButton(); // (SubmitButton) SubmitButton.wrap(RootPanel.get("button").getElement()); // submitButton.setFocus(true); submitButton.getElement().setTitle(LocaleDictionary.getConstantValue(LoginConstants.login_button_text)); submitButton.getElement().setInnerHTML("<i class=\"icon-arrow-right icon-large\"></i>"); submitButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { login(); } }); submitButton.setStyleName("gwt-Button"); RootPanel.get("button").getElement().addClassName("submit"); RootPanel.get("button").add(submitButton); }
From source file:com.google.appinventor.client.explorer.youngandroid.GalleryPage.java
License:Open Source License
/** * Helper method called by constructor to initialize the app's meta fields * @param container The container that date fields reside *///from ww w. j av a 2 s. c om private void initAppMeta(Panel container) { Date createdDate = new Date(); Date changedDate = new Date(); if (editStatus == NEWAPP) { } else { createdDate = new Date(app.getCreationDate()); changedDate = new Date(app.getUpdateDate()); } DateTimeFormat dateFormat = DateTimeFormat.getFormat("yyyy/MM/dd"); Label appCreatedLabel = new Label(MESSAGES.galleryCreatedDateLabel()); appCreatedLabel.addStyleName("app-meta-label"); container.add(appCreatedLabel); appCreated.setText(dateFormat.format(createdDate)); container.add(appCreated); Label appChangedLabel = new Label(MESSAGES.galleryChangedDateLabel()); appChangedLabel.addStyleName("app-meta-label"); container.add(appChangedLabel); appChanged.setText(dateFormat.format(changedDate)); container.add(appChanged); if (newOrUpdateApp()) { // GUI for editable title container // Set the placeholders of textarea moreInfoText.getElement().setPropertyString("placeholder", MESSAGES.galleryMoreInfoHint()); creditText.getElement().setPropertyString("placeholder", MESSAGES.galleryCreditHint()); if (editStatus == NEWAPP) { // If it's a new app, it will show the placeholder hint } else if (editStatus == UPDATEAPP) { // If it's not new, just set whatever's in the data field already moreInfoText.setText(app.getMoreInfo()); creditText.setText(app.getCredit()); } moreInfoText.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { app.setMoreInfo(moreInfoText.getText()); } }); creditText.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { app.setCredit(creditText.getText()); } }); moreInfoText.addStyleName("app-desc-textarea"); creditText.addStyleName("app-desc-textarea"); container.add(moreInfoText); container.add(creditText); } else { // Public app view String linktext = makeValidLink(app.getMoreInfo()); if (linktext != null) { Label moreInfoLabel = new Label(MESSAGES.galleryMoreInfoLabel()); moreInfoLabel.addStyleName("app-meta-label"); container.add(moreInfoLabel); Anchor userLinkDisplay = new Anchor(); userLinkDisplay.setText(linktext); userLinkDisplay.setHref(linktext); userLinkDisplay.setTarget("_blank"); container.add(userLinkDisplay); } //"remixed from" field container.add(initRemixFromButton()); //"credits" field if (app.getCredit() != null && app.getCredit().length() > 0) { Label creditLabel = new Label(MESSAGES.galleryCreditLabel()); creditLabel.addStyleName("app-meta-label"); container.add(creditLabel); Label creditText = new Label(app.getCredit()); container.add(creditText); } } container.addStyleName("app-meta"); }
From source file:com.google.gwt.maps.sample.hellomaps.client.InfoWindowDemo.java
License:Apache License
private InfoWindowContent displayInfoWindowMaxWidget() { final InfoWindowContent content = new InfoWindowContent("There's more to see (hit the maximize button)"); content.setMaxTitle(new HTML("<i>Maximized Italic Boots</i>")); VerticalPanel panel = new VerticalPanel(); panel.add(new Image("boot.jpg")); Button b = new Button("Click for Message"); final Label l = new Label(); HorizontalPanel hp = new HorizontalPanel(); hp.add(b);/*from w ww. ja v a 2 s . co m*/ hp.add(l); l.getElement().getStyle().setPropertyPx("margin", 7); b.addClickListener(new ClickListener() { public void onClick(Widget w) { GWT.log("Got click in maximized window.", null); if (l.getText().equals("")) { l.setText("Hello World!"); } else { l.setText(""); } } }); panel.add(hp); panel.setSpacing(10); content.setMaxContent(panel); return content; }
From source file:com.google.mobile.trippy.web.client.view.DayListView.java
License:Apache License
@Override public ArrayList<IdDayDateTuple> getReorderedItems() { final Date currTime = new Date(); int day = 0;// w ww. j a v a 2s. com ArrayList<IdDayDateTuple> itemTuples = new ArrayList<IdDayDateTuple>(); for (int index = 0; index < daysList.getWidgetCount(); index++) { FlowPanel panel = (FlowPanel) daysList.getWidget(index); Label itemPos = (Label) panel.getWidget(0); String itemPosText = itemPos.getText(); if (!itemPosText.equals(noPos)) { itemTuples.add(new IdDayDateTuple(itemPosText, day, currTime)); } else { Label dayLabel = (Label) panel.getWidget(1); day = Integer.parseInt(dayLabel.getText()); } } return itemTuples; }
From source file:com.GTDF.client.GWT_Transxchange2GoogleTransit.java
License:Apache License
public void onModuleLoad() { String wikiUserName = readUsername(); //Service Start final TextBox textBoxServiceStartGz = new TextBox(); TabPanel tabs = new TabPanel(); tabs.setStyleName(".gwt-TabBar"); tabs.setWidth("100%"); tabs.setHeight("100%"); //-------------------------EDJ ---------------- DockPanel dock = new DockPanel(); dock.setSize("663px", "220px"); dock.setStyleName("gwt-TabBar"); VerticalPanel TransformWindow = new VerticalPanel(); TransformWindow.setStyleName("weather-input-panel"); //Agency URL// w w w . j av a 2 s . co m HorizontalPanel AgencyURL = new HorizontalPanel(); Label url_lbl = new Label("Agency URL:"); url_lbl.setWidth("90"); final TextBox textBoxUrl = new TextBox(); textBoxUrl.setText("http://www.agency.org"); textBoxUrl.setVisibleLength(40); AgencyURL.add(url_lbl); AgencyURL.add(textBoxUrl); //----------- //Route Type HorizontalPanel RType = new HorizontalPanel(); Label rt_lbl = new Label("Route Type:"); rt_lbl.setWidth("90"); final ListBox listBoxDefaultRouteType = new ListBox(); listBoxDefaultRouteType.setVisibleItemCount(1); listBoxDefaultRouteType.addItem("Tram"); listBoxDefaultRouteType.addItem("Subway"); listBoxDefaultRouteType.addItem("Rail"); listBoxDefaultRouteType.addItem("Bus"); listBoxDefaultRouteType.addItem("Ferry"); listBoxDefaultRouteType.addItem("Cable car"); listBoxDefaultRouteType.addItem("Gondola"); listBoxDefaultRouteType.addItem("Funicular"); listBoxDefaultRouteType.setSelectedIndex(0); RType.add(rt_lbl); RType.add(listBoxDefaultRouteType); //----------- //Time Zone VerticalPanel TZ = new VerticalPanel(); Label tz_lbl = new Label("Time Zone:"); tz_lbl.setWidth("90"); HorizontalPanel Continent = new HorizontalPanel(); Label continent_lbl = new Label("Continent:"); continent_lbl.setWidth("90"); final ListBox listBoxTimezoneP = new ListBox(); listBoxTimezoneP.addItem("Africa"); listBoxTimezoneP.addItem("America"); listBoxTimezoneP.addItem("Antarctica"); listBoxTimezoneP.addItem("Artic"); listBoxTimezoneP.addItem("Asia"); listBoxTimezoneP.addItem("Atlantic"); listBoxTimezoneP.addItem("Australia"); listBoxTimezoneP.addItem("Europe"); listBoxTimezoneP.addItem("Indian"); listBoxTimezoneP.addItem("Pacific"); listBoxTimezoneP.setVisibleItemCount(1); listBoxTimezoneP.setSelectedIndex(0); Continent.add(continent_lbl); Continent.add(listBoxTimezoneP); HorizontalPanel Region = new HorizontalPanel(); Label region_lbl = new Label("Region:"); region_lbl.setWidth("90"); final ListBox listBoxTimezoneS = new ListBox(); switchTimezone(listBoxTimezoneS, 0); Region.add(region_lbl); Region.add(listBoxTimezoneS); TZ.add(tz_lbl); TZ.add(Continent); TZ.add(Region); //----------- Button dialogButton = new Button("Show Dialog", new ClickListener() { public void onClick(Widget sender) { //EDJ DialogBox dlg = new MyDialog(); int left = 120; int top = 300; dlg.setPopupPosition(left, top); dlg.show(); } }); final Label labelOutdir = new Label(); // Displays wikiuser final Label labelResultGz = new Label(); final Label labelResult = new Label(); final Label labelResultUser = new Label(); final FormPanel uploadFormGz = new FormPanel(); uploadFormGz.setAction(GWT.getModuleBaseURL() + "upload"); uploadFormGz.setEncoding(FormPanel.ENCODING_MULTIPART); uploadFormGz.setMethod(FormPanel.METHOD_POST); //Upload final HorizontalPanel uploadPanelGz = new HorizontalPanel(); Label upload_lbl = new Label("Upload File:"); upload_lbl.setWidth("90"); uploadPanelGz.add(upload_lbl); //uploadPanelGz.add(upload_tb); //uploadPanelGz.add(upload_btn); //-------------- // Add hidden widget to pass user name to FileUploadServlet for verification against wiki user table final Hidden hwGz = new Hidden("username", wikiUserName); uploadPanelGz.add(hwGz); // Add hidden widget to pass service start to FileUploadServlet final Hidden ssGz = new Hidden("prefix"); uploadPanelGz.add(ssGz); final FileUpload uploadGz = new FileUpload(); uploadGz.setName("uploadFormElement"); uploadPanelGz.add(uploadGz); //final VerticalPanel uploadPanelGz = new VerticalPanel(); uploadFormGz.setWidget(uploadPanelGz); /* * Add Transxchange2GoogleTransit file upload */ final FormPanel uploadForm = new FormPanel(); uploadForm.setAction(GWT.getModuleBaseURL() + "upload"); uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); uploadForm.setMethod(FormPanel.METHOD_POST); final VerticalPanel uploadPanel = new VerticalPanel(); uploadForm.setWidget(uploadPanel); // Add hidden widget to pass user name to FileUploadServlet for verification against wiki user table final Hidden hw = new Hidden("username", wikiUserName); uploadPanel.add(hw); final FileUpload upload = new FileUpload(); upload.setName("uploadFormElement"); uploadPanel.add(upload); /* * Verify user and enable action buttons if user exists */ WikiUserServiceAsync wikiUserService = (WikiUserServiceAsync) GWT.create(WikiUserService.class); ServiceDefTarget endpoint = (ServiceDefTarget) wikiUserService; String moduleRelativeURL = GWT.getModuleBaseURL() + "WikiUser"; endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback() { public void onSuccess(Object result) { Button buttonGz = new Button("Upload", new ClickListener() { public void onClick(Widget sender) { // Extract service start and pass as prefix String serviceStart = textBoxServiceStartGz.getText(); ssGz.setValue(serviceStart); // Upload selected infile to server uploadFormGz.submit(); //EDJ DialogBox dlg = new MyDialog(); int left = 120; int top = 300; dlg.setPopupPosition(left, top); dlg.show(); } }); Button button = new Button("Transform", new ClickListener() { public void onClick(Widget sender) { // Upload selected infile to server uploadForm.submit(); } }); if (result != "LOGGED") { button.setEnabled(false); buttonGz.setEnabled(false); labelResultUser.setText((String) result); } uploadPanel.add(button); uploadPanelGz.add(buttonGz); } public void onFailure(Throwable caught) { try { throw caught; } catch (InvocationException e) { labelResult.setText("InvocationException: " + e.getMessage()); } catch (Throwable e) { labelResult.setText("callback failed: " + e.getMessage()); } } }; wikiUserService.wikiUserVerify(wikiUserName, callback); /* * Upload google_transit.zip file */ uploadFormGz.addFormHandler(new FormHandler() { public void onSubmitComplete(FormSubmitCompleteEvent event) { labelResultGz.setText((String) event.getResults()); } public void onSubmit(FormSubmitEvent event) { // Upload infile to server String inFilename = uploadGz.getFilename(); if (inFilename.length() == 0) { Window.alert("Infile required"); return; } } }); /* * Upload TransXChange file and call Transxchange2GoogleTransit servlet when "transform" button is pushed */ uploadForm.addFormHandler(new FormHandler() { public void onSubmitComplete(FormSubmitCompleteEvent event) { labelResult.setText((String) event.getResults()); // Start transformation String parseArgs = upload.getFilename(); parseArgs = parseArgs + " " + textBoxUrl.getText(); parseArgs = parseArgs + " " + listBoxTimezoneP.getItemText(listBoxTimezoneP.getSelectedIndex()); String helpString = listBoxTimezoneS.getItemText(listBoxTimezoneS.getSelectedIndex()); parseArgs = parseArgs + "/" + helpString.substring(0, helpString.indexOf(' ')); parseArgs = parseArgs + " " + listBoxDefaultRouteType.getSelectedIndex(); parseArgs = parseArgs + " " + labelOutdir.getText(); // call server through GWT asynchronous RPC Transxchange2GoogleTransitServiceAsync transxchange2GoogleTransitService = (Transxchange2GoogleTransitServiceAsync) GWT .create(Transxchange2GoogleTransitService.class); ServiceDefTarget endpoint = (ServiceDefTarget) transxchange2GoogleTransitService; String moduleRelativeURL = GWT.getModuleBaseURL() + "GTDF"; endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback() { public void onSuccess(Object result) { labelResult.setText((String) result); } public void onFailure(Throwable caught) { try { throw caught; } catch (InvocationException e) { labelResult.setText("InvocationException: " + e.getMessage()); } catch (Throwable e) { labelResult.setText("callback failed: " + e.getMessage()); } } }; transxchange2GoogleTransitService.transxchange2GoogleTransit_transform(parseArgs, callback); } public void onSubmit(FormSubmitEvent event) { // Upload infile to server String inFilename = upload.getFilename(); if (inFilename.length() == 0) { Window.alert("Infile required"); return; } } }); /* * Add UI elements * Better practice (for future reference): use CSS */ TransformWindow.add(AgencyURL); TransformWindow.add(RType); TransformWindow.add(TZ); TransformWindow.add(uploadPanelGz); TransformWindow.add(uploadPanel); TransformWindow.add(dialogButton); tabs.add(TransformWindow, "TransXChange"); //tabs.add(TZ, "Transformation2"); tabs.selectTab(0); dock.add(tabs, DockPanel.CENTER); RootPanel.get("tab_area").add(dock); /* RootPanel.get("gz_servicestart").add(textBoxServiceStartGz); RootPanel.get("gz_infile").add(uploadFormGz); RootPanel.get("url").add(textBoxUrl); RootPanel.get("timezoneP").add(listBoxTimezoneP); RootPanel.get("timezoneS").add(listBoxTimezoneS); RootPanel.get("defaultroutetype").add(listBoxDefaultRouteType); RootPanel.get("outdir").add(labelOutdir); labelOutdir.setText(wikiUserName); RootPanel.get("user_result").add(labelResultUser); RootPanel.get("gz_result").add(labelResultGz); RootPanel.get("result").add(labelResult); RootPanel.get("infile").add(uploadForm); */ // Primary time zone (Africa, Europe, ...) selected listBoxTimezoneP.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { switchTimezone(listBoxTimezoneS, listBoxTimezoneP.getSelectedIndex()); } }); //---------------------------------------------------------------------------------------------- //----------------------------------------EDJ--------------------------------------------------- }