List of usage examples for com.google.gwt.http.client URL encodeQueryString
public static String encodeQueryString(String decodedURLComponent)
From source file:com.lushprojects.circuitjs1.client.ExportAsUrlDialog.java
License:Open Source License
public ExportAsUrlDialog(String dump) { super();//from w ww .j av a 2s .c om String start[] = Location.getHref().split("\\?"); dump = dump.replace(' ', '+'); String query = "?cct=" + URL.encode(dump); dump = start[0] + query; requrl = URL.encodeQueryString(query); Button okButton; Label la1, la2; vp = new VerticalPanel(); setWidget(vp); setText(CirSim.LS("Export as URL")); vp.add(new Label(CirSim.LS("URL for this circuit is..."))); if (dump.length() > 2000) { vp.add(la1 = new Label( CirSim.LS( "Warning: this URL is longer than 2000 characters and may not work in some browsers."), true)); la1.setWidth("300px"); } vp.add(tb = new RichTextArea()); tb.setText(dump); // tb.setMaxLength(s.length()); // tb.setVisibleLength(s.length()); vp.add(la2 = new Label(CirSim.LS( "To save this URL select it all (eg click in text and type control-A) and copy to your clipboard (eg control-C) before pasting to a suitable place."), true)); la2.setWidth("300px"); HorizontalPanel hp = new HorizontalPanel(); hp.setWidth("100%"); hp.setStyleName("topSpace"); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); hp.add(okButton = new Button(CirSim.LS("OK"))); vp.add(hp); if (shortIsSupported()) { hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); hp.add(shortButton = new Button(CirSim.LS("Create short URL"))); shortButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { shortButton.setVisible(false); createShort(requrl); } }); } okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { closeDialog(); } }); this.center(); }
From source file:com.mashery.examples.api.client.EtsyExample.java
License:Open Source License
private Widget createOAuthPanel() { FlowPanel panel = new FlowPanel(); panel.add(new HTML("You are not connected to your Etsy account.")); final Anchor requestTokenLink = new Anchor("Connect to Your Etsy Account", "#"); panel.add(requestTokenLink);//w ww . j a v a 2 s.co m requestTokenLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String callbackURL = Window.Location.createUrlBuilder().buildString(); String requestTokenURL = "/examples/etsy/oauth/request_token?callbackURL=" + URL.encodeQueryString(callbackURL); requestTokenLink.setHref(requestTokenURL); } }); return new ScrollPanel(panel); }
From source file:com.mashery.examples.api.client.Examples.java
License:Open Source License
@Override public void onModuleLoad() { DockLayoutPanel mainPanel = new DockLayoutPanel(Unit.PX); RootLayoutPanel.get().add(mainPanel); DockLayoutPanel headerPanel = new DockLayoutPanel(Unit.PX); mainPanel.addNorth(headerPanel, 80d); FlexTable rightPanel = new FlexTable(); headerPanel.addEast(rightPanel, 250d); rightPanel.setCellPadding(4);//from ww w . j a va2 s . c o m rightPanel.setSize("100%", "100%"); rightPanel.getCellFormatter().setHeight(0, 0, "100%"); rightPanel.getCellFormatter().setWidth(1, 0, "100%"); rightPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_TOP); ((FlexTable.FlexCellFormatter) rightPanel.getCellFormatter()).setColSpan(0, 0, 2); final FlowPanel userPanel = new FlowPanel(); rightPanel.setWidget(0, 0, userPanel); LoginServiceAsync loginSvc = GWT.create(LoginService.class); loginSvc.getUserEmail(new AsyncCallback<String>() { @Override public void onSuccess(final String email) { final Anchor loginLink = new Anchor(); loginLink.setHref(email == null ? "/examples/login" : "/examples/login?logout=true"); loginLink.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String callbackURL = Window.Location.createUrlBuilder().buildString(); StringBuilder buf = new StringBuilder("/examples/login?callbackURL="); buf.append(URL.encodeQueryString(callbackURL)); if (email != null) buf.append("&logout=true"); loginLink.setHref(buf.toString()); } }); if (email == null) { loginLink.setHTML("Sign in"); } else { loginLink.setHTML("Sign out"); userPanel.add(new InlineLabel(email)); userPanel.add(new InlineHTML(" | ")); } userPanel.add(loginLink); } @Override public void onFailure(Throwable caught) { userPanel.add(new Label(caught.getLocalizedMessage())); } }); mapWidget = new PopupMapWidget(); rightPanel.setWidget(1, 1, mapWidget); Grid logoPanel = new Grid(1, 2); logoPanel.setCellSpacing(8); logoPanel.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP); headerPanel.add(logoPanel); Image masheryLogoImg = new Image("resources/img/mashery.gif"); Anchor masheryLink = new Anchor(); masheryLink.setTitle("Mashery, Inc."); masheryLink.setHref("http://developer.mashery.com"); masheryLink.getElement().appendChild(masheryLogoImg.getElement()); logoPanel.setWidget(0, 0, masheryLink); InlineLabel logoLabel = new InlineLabel("Mashery Examples"); logoLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD); logoLabel.getElement().getStyle().setFontSize(28d, Unit.PT); logoLabel.getElement().getStyle().setColor("#c1080a"); logoPanel.setWidget(0, 1, logoLabel); SplitLayoutPanel centerPanel = new SplitLayoutPanel(); mainPanel.add(centerPanel); final StackLayoutPanel examplesPanel = new StackLayoutPanel(Unit.PX); centerPanel.addWest(examplesPanel, 200d); contentPanel = new DeckPanel(); centerPanel.add(contentPanel); contentPanel.getElement().getStyle().setPaddingLeft(8d, Unit.PX); contentPanel.setAnimationEnabled(true); addExample(new Example("quova", "Quova") { @Override public Widget createContent() { return new QuovaExample(mapWidget); } }, examplesPanel); addExample(new Example("etsy", "Etsy") { @Override public Widget createContent() { return new EtsyExample(mapWidget); } }, examplesPanel); addExample(new Example("weatherbug", "WeatherBug") { @Override public Widget createContent() { return new WeatherBugExample(mapWidget); } }, examplesPanel); addExample(new Example("hotwire", "Hotwire") { @Override public Widget createContent() { return new HotwireExample(mapWidget); } }, examplesPanel); addExample(new Example("active", "Active") { @Override public Widget createContent() { return new ActiveExample(mapWidget); } }, examplesPanel); String historyToken = History.getToken(); Integer index = exampleIndex.get(historyToken); if (index == null) index = 0; examplesPanel.showWidget(index); showExample(index); examplesPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int index = event.getSelectedItem(); Example example = examples.get(index); if (example != null) History.newItem(example.getId()); } }); History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String historyToken = event.getValue(); Integer index = exampleIndex.get(historyToken); if (index != null) { examplesPanel.showWidget(index); showExample(index); } } }); }
From source file:com.mecatran.otp.gwt.client.proxies.otp.OtpPlannerProxy.java
License:Open Source License
private String buildGetUrl(PlanRequestBean planRequest) { // TODO We can't easily use the GWT UrlBuilder class, // as we would need to parse the provided base URL... StringBuffer sb = new StringBuffer(baseUrl); sb.append("/routers/").append(routerId).append("/plan"); Wgs84LatLonBean departure = planRequest.getDeparture().getLocation(); Wgs84LatLonBean arrival = planRequest.getArrival().getLocation(); sb.append("?fromPlace="); sb.append(URL.encodeQueryString(departure.getLat() + "," + departure.getLon())); sb.append("&toPlace="); sb.append(URL.encodeQueryString(arrival.getLat() + "," + arrival.getLon())); DateTimeFormat df = DateTimeFormat.getFormat("yyyy/MM/dd"); DateTimeFormat tf = DateTimeFormat.getFormat("HH:mm:ss"); Date date = planRequest.getDate(); sb.append("&date=").append(df.format(date)); sb.append("&time=").append(tf.format(date)); sb.append("&arriveBy=").append(!planRequest.isDateDeparture()); Set<TransportMode> modes = planRequest.getModes(); sb.append("&mode="); boolean removeComma = false; for (TransportMode mode : modes) { sb.append(convertTransportMode(mode)).append(","); removeComma = true;/*from w ww .ja v a 2s. c om*/ } if (removeComma) sb.setLength(sb.length() - 1); sb.append("&wheelchair=").append(planRequest.isWheelchairAccessible()); sb.append("&walkSpeed=").append(planRequest.getWalkSpeedKph()); sb.append("&bikeSpeed=").append(planRequest.getBikeSpeedKph()); sb.append("&transferPenalty=").append(planRequest.getTransferPenaltySeconds()); sb.append("&triangleTimeFactor=").append(planRequest.getBikeSpeedFactor()); sb.append("&triangleSafetyFactor=").append(planRequest.getBikeSafetyFactor()); sb.append("&triangleSlopeFactor=").append(planRequest.getBikeComfortFactor()); sb.append("&maxWalkDistance=").append(planRequest.getMaxWalkDistanceMeters()); sb.append("&walkReluctance=").append(planRequest.getWalkReluctanceFactor()); sb.append("&numItineraries=").append(maxItineraries); String retval = sb.toString(); // GWT.log("OTP request URL: " + retval); return retval; }
From source file:com.openkm.frontend.client.util.JSONUtil.java
License:Open Source License
/** * toJson/* w ww. ja va 2 s . c om*/ * */ public static JSONObject toJson(Object obj) { JSONObject json = new JSONObject(); if (obj instanceof GWTQueryParams) { GWTQueryParams params = (GWTQueryParams) obj; json.put("author", new JSONString(params.getAuthor())); json.put("keywords", new JSONString(params.getKeywords())); json.put("content", new JSONString(params.getContent())); json.put("name", new JSONString(params.getName())); json.put("path", new JSONString(URL.encodeQueryString(params.getPath()))); json.put("mimeType", new JSONString(params.getMimeType())); json.put("domain", new JSONNumber(params.getDomain())); json.put("mailFrom", new JSONString(params.getMailFrom())); json.put("mailTo", new JSONString(params.getMailTo())); json.put("mailSubject", new JSONString(params.getMailSubject())); json.put("categoryUuid", new JSONString(params.getCategoryUuid())); json.put("categoryPath", new JSONString(URL.encodeQueryString(params.getCategoryPath()))); json.put("operator", new JSONString(params.getOperator())); if (params.getLastModifiedFrom() != null) { json.put("lastModifiedFrom", new JSONString(ISO8601.formatBasic(params.getLastModifiedFrom()))); } if (params.getLastModifiedTo() != null) { json.put("lastModifiedTo", new JSONString(ISO8601.formatBasic(params.getLastModifiedTo()))); } if (!params.getProperties().isEmpty()) { JSONObject properties = new JSONObject(); for (String key : params.getProperties().keySet()) { GWTPropertyParams propertyParam = params.getProperties().get(key); JSONObject property = new JSONObject(); // Only is necessary groupName and value property.put("grpName", new JSONString(propertyParam.getGrpName())); property.put("value", new JSONString(propertyParam.getValue())); properties.put(key, property); } json.put("properties", properties); } } return json; }
From source file:com.openkm.frontend.client.util.Util.java
License:Open Source License
/** * print file/*from w w w .j a v a 2 s.c om*/ */ public static void print(String uuid) { final Element printIframe = RootPanel.get("__print").getElement(); String url = RPCService.ConverterServlet + "?inline=true&print=true&toPdf=true&uuid=" + URL.encodeQueryString(uuid); DOM.setElementAttribute(printIframe, "src", url); }
From source file:com.openkm.frontend.client.widget.properties.Document.java
License:Open Source License
/** * Sets the document values/* w ww . jav a2s . co m*/ * * @param doc The document object */ public void set(GWTDocument doc) { this.document = doc; // URL clipboard button String url = Main.get().workspaceUserProperties.getApplicationURL(); url += "?uuid=" + URL.encodeQueryString(URL.encodeQueryString(document.getUuid())); tableProperties.setWidget(11, 1, new HTML("<div id=\"urlClipboard\"></div>\n")); Util.createClipboardButton("urlClipboard", url); // Webdav button String webdavUrl = Main.get().workspaceUserProperties.getApplicationURL(); String webdavPath = document.getPath(); // Replace only in case webdav fix is enabled if (Main.get().workspaceUserProperties.getWorkspace() != null && Main.get().workspaceUserProperties.getWorkspace().isWebdavFix()) { webdavPath = webdavPath.replace("okm:", "okm_"); } // Login case write empty folder if (!webdavUrl.isEmpty()) { webdavPath = Util.encodePathElements(webdavPath); webdavUrl = webdavUrl.substring(0, webdavUrl.lastIndexOf('/')) + "/webdav" + webdavPath; } tableProperties.setWidget(12, 1, new HTML("<div id=\"webdavClipboard\"></div>\n")); Util.createClipboardButton("webdavClipboard", webdavUrl); tableProperties.setHTML(0, 1, doc.getUuid()); tableProperties.setHTML(1, 1, doc.getName()); tableProperties.setHTML(2, 1, doc.getParentPath()); tableProperties.setHTML(3, 1, Util.formatSize(doc.getActualVersion().getSize())); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); tableProperties.setHTML(4, 1, dtf.format(doc.getCreated()) + " " + Main.i18n("document.by") + " " + doc.getUser().getUsername()); tableProperties.setHTML(5, 1, dtf.format(doc.getLastModified()) + " " + Main.i18n("document.by") + " " + doc.getActualVersion().getUser().getUsername()); tableProperties.setHTML(6, 1, doc.getMimeType()); tableProperties.setWidget(7, 1, keywordManager.getKeywordPanel()); // Enable select tableProperties.getFlexCellFormatter().setStyleName(0, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(1, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(2, 1, "okm-EnableSelect"); remove = ((doc.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE && !doc.isCheckedOut() && !(doc.isLocked() && !doc.getLockInfo().getOwner().equals(Main.get().workspaceUserProperties.getUser()))); if (doc.isCheckedOut()) { tableProperties.setHTML(8, 1, Main.i18n("document.status.checkout") + " " + doc.getLockInfo().getUser().getUsername()); } else if (doc.isLocked()) { tableProperties.setHTML(8, 1, Main.i18n("document.status.locked") + " " + doc.getLockInfo().getUser().getUsername()); } else { tableProperties.setHTML(8, 1, Main.i18n("document.status.normal")); } if (doc.isSubscribed()) { tableProperties.setHTML(9, 1, Main.i18n("document.subscribed.yes")); } else { tableProperties.setHTML(9, 1, Main.i18n("document.subscribed.no")); } // Enables or disables change keywords with user permissions and document is not check-out or locked if (remove) { keywordManager.setVisible(true); categoryManager.setVisible(true); } else { keywordManager.setVisible(false); categoryManager.setVisible(false); } getVersionHistorySize(); // Sets wordWrap for al rows for (int i = 0; i < 11; i++) { setRowWordWarp(i, 1, true, tableProperties); } // Remove all table rows tableSubscribedUsers.removeAllRows(); // Sets the document subscribers for (GWTUser subscriptor : doc.getSubscriptors()) { tableSubscribedUsers.setHTML(tableSubscribedUsers.getRowCount(), 0, subscriptor.getUsername()); setRowWordWarp(tableSubscribedUsers.getRowCount() - 1, 0, true, tableSubscribedUsers); } int actualView = Main.get().mainPanel.desktop.navigator.getStackIndex(); // Some data must not be visible on personal view if (actualView == UIDesktopConstants.NAVIGATOR_PERSONAL) { subcribedUsersText.setVisible(false); tableSubscribedUsers.setVisible(false); } else { subcribedUsersText.setVisible(true); tableSubscribedUsers.setVisible(true); } // keywords keywordManager.reset(); keywordManager.setObject(doc, remove); keywordManager.drawAll(); // Categories categoryManager.removeAllRows(); categoryManager.setObject(doc, remove); categoryManager.drawAll(); }
From source file:com.openkm.frontend.client.widget.properties.Folder.java
License:Open Source License
/** * Sets the folder values//from ww w.jav a 2s. c o m * * @param folder The folder object */ public void set(GWTFolder fld) { this.folder = fld; // URL clipboard button String url = Main.get().workspaceUserProperties.getApplicationURL(); url += "?uuid=" + URL.encodeQueryString(URL.encodeQueryString(folder.getUuid())); tableProperties.setWidget(9, 1, new HTML("<div id=\"urlClipboard\"></div>\n")); Util.createClipboardButton("urlClipboard", url); // Webdav String webdavUrl = Main.get().workspaceUserProperties.getApplicationURL(); String webdavPath = folder.getPath(); // Replace only in case webdav fix is enabled if (Main.get().workspaceUserProperties.getWorkspace() != null && Main.get().workspaceUserProperties.getWorkspace().isWebdavFix()) { webdavPath = webdavPath.replace("okm:", "okm_"); } // Login case write empty folder if (!webdavUrl.isEmpty()) { webdavPath = Util.encodePathElements(webdavPath); webdavUrl = webdavUrl.substring(0, webdavUrl.lastIndexOf('/')) + "/webdav" + webdavPath; } tableProperties.setWidget(10, 1, new HTML("<div id=\"webdavClipboard\"></div>\n")); Util.createClipboardButton("webdavClipboard", webdavUrl); tableProperties.setHTML(0, 1, folder.getUuid()); tableProperties.setHTML(1, 1, folder.getName()); tableProperties.setHTML(2, 1, folder.getParentPath()); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); tableProperties.setHTML(3, 1, dtf.format(folder.getCreated()) + " " + Main.i18n("folder.by") + " " + folder.getUser().getUsername()); // Added 17/02/2017 tableProperties.setHTML(11, 1, folder.getCode()); if (folder.isSubscribed()) { tableProperties.setHTML(4, 1, Main.i18n("folder.subscribed.yes")); } else { tableProperties.setHTML(4, 1, Main.i18n("folder.subscribed.no")); } tableProperties.setWidget(8, 1, keywordManager.getKeywordPanel()); // Enable select tableProperties.getFlexCellFormatter().setStyleName(0, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(1, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(2, 1, "okm-EnableSelect"); remove = ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE); // Enables or disables change keywords with user permissions and document is not check-out or locked if (remove) { keywordManager.setVisible(true); categoryManager.setVisible(true); } else { keywordManager.setVisible(false); categoryManager.setVisible(false); } // Case categories, metadata or thesausus view is enabled file browser panel must be selected to have keywords and // categories tab panel enabled. Never should be asigned to categories, metadata or thesaurus folders. if ((Main.get().mainPanel.desktop.navigator.getStackIndex() == UIDesktopConstants.NAVIGATOR_CATEGORIES || Main.get().mainPanel.desktop.navigator.getStackIndex() == UIDesktopConstants.NAVIGATOR_METADATA || Main.get().mainPanel.desktop.navigator.getStackIndex() == UIDesktopConstants.NAVIGATOR_THESAURUS) && !Main.get().mainPanel.desktop.browser.fileBrowser.isPanelSelected()) { keywordManager.setVisible(false); categoryManager.setVisible(false); } // Sets wordWrap for all rows for (int i = 0; i < 9; i++) { setRowWordWarp(i, 1, true, tableProperties); } // Remove all table rows >= 0 tableSubscribedUsers.removeAllRows(); // Sets the folder subscribers for (GWTUser subscriptor : folder.getSubscriptors()) { tableSubscribedUsers.setHTML(tableSubscribedUsers.getRowCount(), 0, subscriptor.getUsername()); setRowWordWarp(tableSubscribedUsers.getRowCount() - 1, 0, true, tableSubscribedUsers); } // Some preoperties only must be visible on taxonomy or trash view int actualView = Main.get().mainPanel.desktop.navigator.getStackIndex(); switch (actualView) { case UIDesktopConstants.NAVIGATOR_TAXONOMY: // Some preperties only must be visible on taxonomy or trash view case UIDesktopConstants.NAVIGATOR_TRASH: tableSubscribedUsers.setVisible(true); tableProperties.getRowFormatter().setVisible(4, true); // Is user subscribed tableProperties.getRowFormatter().setVisible(5, true); // Number of folders tableProperties.getRowFormatter().setVisible(6, true); // Number of documents tableProperties.getRowFormatter().setVisible(7, true); // Number of e-mails break; case UIDesktopConstants.NAVIGATOR_THESAURUS: case UIDesktopConstants.NAVIGATOR_CATEGORIES: tableSubscribedUsers.setVisible(true); tableProperties.getRowFormatter().setVisible(4, false); tableProperties.getRowFormatter().setVisible(5, true); tableProperties.getRowFormatter().setVisible(6, true); tableProperties.getRowFormatter().setVisible(7, false); break; case UIDesktopConstants.NAVIGATOR_MAIL: tableSubscribedUsers.setVisible(false); tableProperties.getRowFormatter().setVisible(4, false); tableProperties.getRowFormatter().setVisible(5, true); tableProperties.getRowFormatter().setVisible(6, false); tableProperties.getRowFormatter().setVisible(7, false); break; case UIDesktopConstants.NAVIGATOR_PERSONAL: tableSubscribedUsers.setVisible(false); // Some data must not be visible on personal view tableProperties.getRowFormatter().setVisible(4, false); tableProperties.getRowFormatter().setVisible(5, true); // Number of folders tableProperties.getRowFormatter().setVisible(6, true); // Number of documents tableProperties.getRowFormatter().setVisible(7, true); // Number of e-mails break; } // keywords keywordManager.reset(); keywordManager.setObject(folder, remove); keywordManager.drawAll(); // Categories categoryManager.removeAllRows(); categoryManager.setObject(folder, remove); categoryManager.drawAll(); }
From source file:com.openkm.frontend.client.widget.properties.Mail.java
License:Open Source License
/** * set//from ww w .ja va 2s. c o m * * @param mail */ public void set(GWTMail mail) { this.mail = mail; // URL clipboard button String url = Main.get().workspaceUserProperties.getApplicationURL(); url += "?uuid=" + URL.encodeQueryString(URL.encodeQueryString(mail.getUuid())); tableProperties.setWidget(8, 1, new HTML("<div id=\"urlClipboard\"></div>\n")); Util.createClipboardButton("urlClipboard", url); // Webdav button String webdavUrl = Main.get().workspaceUserProperties.getApplicationURL(); String webdavPath = mail.getPath(); // Replace only in case webdav fix is enabled if (Main.get().workspaceUserProperties.getWorkspace() != null && Main.get().workspaceUserProperties.getWorkspace().isWebdavFix()) { webdavPath = webdavPath.replace("okm:", "okm_"); } // Login case write empty folder if (!webdavUrl.isEmpty()) { webdavPath = Util.encodePathElements(webdavPath); webdavUrl = webdavUrl.substring(0, webdavUrl.lastIndexOf('/')) + "/webdav" + webdavPath; } tableProperties.setWidget(0, 1, new HTML(" <div id=\"uuidClipboard\"></div> " + mail.getUuid() + "\n")); Util.createClipboardButton("uuidClipboard", mail.getUuid()); tableProperties.setWidget(9, 1, new HTML("<div id=\"webdavClipboard\"></div>\n")); Util.createClipboardButton("webdavClipboard", webdavUrl); tableProperties.setHTML(0, 1, mail.getUuid()); tableProperties.setHTML(1, 1, mail.getSubject()); tableProperties.setHTML(2, 1, mail.getParentPath()); tableProperties.setHTML(3, 1, Util.formatSize(mail.getSize())); DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern")); tableProperties.setHTML(4, 1, dtf.format(mail.getCreated()) + " " + Main.i18n("mail.by") + " " + mail.getAuthor()); tableProperties.setHTML(6, 1, mail.getMimeType()); tableProperties.setWidget(7, 1, keywordManager.getKeywordPanel()); // Enable select tableProperties.getFlexCellFormatter().setStyleName(0, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(1, 1, "okm-EnableSelect"); tableProperties.getFlexCellFormatter().setStyleName(2, 1, "okm-EnableSelect"); remove = ((mail.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE); // Enables or disables change keywords with user permissions and document is not check-out or locked if (remove) { keywordManager.setVisible(true); categoryManager.setVisible(true); } else { keywordManager.setVisible(false); categoryManager.setVisible(false); } // Sets wordWrap for al rows for (int i = 0; i < 8; i++) { setRowWordWarp(i, 1, true, tableProperties); } // keywords keywordManager.reset(); keywordManager.setObject(mail, remove); keywordManager.drawAll(); // Categories categoryManager.removeAllRows(); categoryManager.setObject(mail, remove); categoryManager.drawAll(); }
From source file:com.openkm.frontend.client.widget.properties.Preview.java
License:Open Source License
/** * showEmbedSWF/*from ww w .j a v a 2 s .c o m*/ * * @param uuid Unique document ID to be previewed. */ public void showEmbedSWF(String uuid) { hideWidgetExtension(); vPanel.clear(); if (previewEvent != null) { vPanel.add(hReturnPanel); vPanel.setCellHeight(hReturnPanel, String.valueOf(TURN_BACK_HEIGHT)); } vPanel.add(swf); vPanel.setCellHorizontalAlignment(swf, HasAlignment.ALIGN_CENTER); vPanel.setCellVerticalAlignment(swf, HasAlignment.ALIGN_MIDDLE); if (previewAvailable) { if (previewConversion) { String url = RPCService.ConverterServlet + "?inline=true&toSwf=true&uuid=" + URL.encodeQueryString(uuid); swf.setHTML("<div id=\"pdfviewercontainer\"></div>\n"); // needed for rewriting purpose if (Main.get().workspaceUserProperties.getWorkspace().getPreviewer().equals("flexpaper")) { Util.createPDFViewerFlexPaper(url, "" + width, "" + height); } else { Util.createPDFViewerZviewer(url, "" + width, "" + height); } Main.get().conversionStatus.getStatus(); } else { String url = RPCService.DownloadServlet + "?inline=true&uuid=" + URL.encodeQueryString(uuid); swf.setHTML("<div id=\"swfviewercontainer\"></div>\n"); // needed for rewriting purpose Util.createSwfViewer(url, "" + width, "" + height); } } else { swf.setHTML("<div id=\"pdfviewercontainer\" align=\"center\"><br><br>" + Main.i18n("preview.unavailable") + "</div>\n"); // needed for rewriting purpose } }