List of usage examples for com.google.gwt.dom.client MetaElement getName
public String getName()
From source file:cc.kune.common.client.utils.MetaUtils.java
License:GNU Affero Public License
/** * Get the value of meta information writen in the html page. The meta * information is a html tag with name of meta usually placed inside the the * head section with two attributes: id and content. For example: * //from ww w . jav a 2s . co m * <code><meta name="name" value="userName" /></code> * * @param name the name * @return the value of the attribute 'content' or null if not found */ public static String get(final String name) { final NodeList<Element> tags = Document.get().getElementsByTagName("meta"); for (int i = 0; i < tags.getLength(); i++) { final MetaElement metaTag = ((MetaElement) tags.getItem(i)); if (metaTag.getName().equals(name)) { return metaTag.getContent(); } } return null; }
From source file:com.arcbees.facebook.client.JavaScriptFacebook.java
License:Apache License
@Override public void injectFacebookApi(final FacebookCallback facebookCallback) { String locale = "en_US"; // get the correct locale from meta tag gwt:property facebooklocale final NodeList<Element> metas = Document.get().getElementsByTagName("meta"); for (int i = 0; i < metas.getLength(); i++) { final MetaElement m = MetaElement.as(metas.getItem(i)); if ("gwt:property".equals(m.getName())) { String content = m.getContent(); if (content.contains("facebooklocale")) { locale = content.replaceFirst(".*\\=", "").trim(); }/*from w ww . java2 s .co m*/ } } Element firstElement = Document.get().getBody().getFirstChildElement(); Element fbRoot = Document.get().createDivElement(); fbRoot.setId(FB_ROOT); firstElement.getParentNode().insertBefore(fbRoot, firstElement); ScriptElement fbScript = Document.get().createScriptElement(); fbScript.setSrc(FB_SCRIPT_SRC1 + locale + FB_SCRIPT_SRC2); fbScript.setType(FB_SCRIPT_TYPE); fbRoot.getParentNode().insertAfter(fbScript, fbRoot); Timer ensureFbIsLoaded = new Timer() { @Override public void run() { if (isLoaded()) { facebookCallback.onSuccess(); cancel(); } } }; ensureFbIsLoaded.scheduleRepeating(100); }
From source file:com.arcbees.seo.TagsInjector.java
License:Apache License
private String getPropertyOrName(MetaElement metaElement) { String name = metaElement.getName(); if (isNullOrEmpty(name)) { name = metaElement.getAttribute("property"); }// w ww . j a v a2s . c o m return name; }
From source file:com.dom_distiller.client.IEReadingViewParser.java
License:Open Source License
private void findTitle() { mTitle = "";/*from w w w. j a v a2s . com*/ if (mAllMeta.getLength() == 0) return; // Make sure there's a <title> element. NodeList<Element> titles = mRoot.getElementsByTagName("TITLE"); if (titles.getLength() == 0) return; // Extract title text from meta tag with "title" as name. for (int i = 0; i < mAllMeta.getLength(); i++) { MetaElement meta = MetaElement.as(mAllMeta.getItem(i)); if (meta.getName().equalsIgnoreCase("title")) { mTitle = meta.getContent(); break; } } }
From source file:com.dom_distiller.client.IEReadingViewParser.java
License:Open Source License
private void findDate() { mDate = "";/* w ww. j av a 2 s .c o m*/ // Get date from any element that includes the "dateline" class. Element elem = DomUtil.getFirstElementWithClassName(mRoot, "dateline"); if (elem != null) { // Use javascript textContent (instead of javascript innerText) to include invisible // text. mDate = DomUtil.javascriptTextContent(elem); } else { // Otherwise, get date from meta tag with "displaydate" as name. for (int i = 0; i < mAllMeta.getLength(); i++) { MetaElement meta = MetaElement.as(mAllMeta.getItem(i)); if (meta.getName().equalsIgnoreCase("displaydate")) { mDate = meta.getContent(); break; } } } }
From source file:com.dom_distiller.client.IEReadingViewParser.java
License:Open Source License
private void findCopyright() { mCopyright = ""; // Get copyright from meta tag with "copyright" as name. for (int i = 0; i < mAllMeta.getLength(); i++) { MetaElement meta = MetaElement.as(mAllMeta.getItem(i)); if (meta.getName().equalsIgnoreCase("copyright")) { mCopyright = meta.getContent(); break; }//from w w w . jav a 2 s.co m } }
From source file:com.dom_distiller.client.IEReadingViewParser.java
License:Open Source License
private void findOptOut() { mDoneOptOut = true;//from w w w .ja v a2 s. c o m // Get optout from meta tag with "IE_RM_OFF" as name. for (int i = 0; i < mAllMeta.getLength(); i++) { MetaElement meta = MetaElement.as(mAllMeta.getItem(i)); if (meta.getName().equalsIgnoreCase("IE_RM_OFF")) { mOptOut = meta.getContent().equalsIgnoreCase("true"); break; } } }
From source file:com.dom_distiller.client.TableClassifier.java
License:Open Source License
public static Type table(TableElement t) { sReason = Reason.UNKNOWN;//from w w w. jav a 2 s . c om // The following heuristics are dropped from said url: // - table created by CSS display style is layout table, because we only handle actual // <table> elements. // 1) Table inside editable area is layout table, different from said url because we ignore // editable areas during distillation. Element parent = t.getParentElement(); while (parent != null) { if (parent.hasTagName("INPUT") || parent.getAttribute("contenteditable").equalsIgnoreCase("true")) { return logAndReturn(Reason.INSIDE_EDITABLE_AREA, "", Type.LAYOUT); } parent = parent.getParentElement(); } // 2) Table having role="presentation" is layout table. String tableRole = t.getAttribute("role").toLowerCase(); if (tableRole.equals("presentation")) { return logAndReturn(Reason.ROLE_TABLE, "_" + tableRole, Type.LAYOUT); } // 3) Table having ARIA table-related roles is data table. if (sARIATableRoles.contains(tableRole) || sARIARoles.contains(tableRole)) { return logAndReturn(Reason.ROLE_TABLE, "_" + tableRole, Type.DATA); } // 4) Table having ARIA table-related roles in its descendants is data table. // This may have deviated from said url if it only checks for <table> element but not its // descendants. List<Element> directDescendants = getDirectDescendants(t); for (Element e : directDescendants) { String role = e.getAttribute("role").toLowerCase(); if (sARIATableDescendantRoles.contains(role) || sARIARoles.contains(role)) { return logAndReturn(Reason.ROLE_DESCENDANT, "_" + role, Type.DATA); } } // 5) Table having datatable="0" attribute is layout table. if (t.getAttribute("datatable").equals("0")) { return logAndReturn(Reason.DATATABLE_0, "", Type.LAYOUT); } // 6) Table having nested table(s) is layout table. // The order here and #7 (table having <=1 row/col is layout table) is different from said // url: the latter has these heuristics after #10 (table having "summary" attribute is // data table), but our eval sets indicate the need to bump these way up to here, because // many (old) pages have layout tables that are nested or with <TH>/<CAPTION>s but only 1 // row or col. if (hasNestedTables(t)) return logAndReturn(Reason.NESTED_TABLE, "", Type.LAYOUT); // 7) Table having only one row or column is layout table. // See comments for #6 about deviation from said url. NodeList<TableRowElement> rows = t.getRows(); if (rows.getLength() <= 1) return logAndReturn(Reason.LESS_EQ_1_ROW, "", Type.LAYOUT); NodeList<TableCellElement> cols = getMaxColsAmongRows(rows); if (cols == null || cols.getLength() <= 1) { return logAndReturn(Reason.LESS_EQ_1_COL, "", Type.LAYOUT); } // 8) Table having legitimate data table structures is data table: // a) table has <caption>, <thead>, <tfoot>, <colgroup>, <col>, or <th> elements Element caption = t.getCaption(); if ((caption != null && hasValidText(caption)) || t.getTHead() != null || t.getTFoot() != null || hasOneOfElements(directDescendants, sHeaderTags)) { return logAndReturn(Reason.CAPTION_THEAD_TFOOT_COLGROUP_COL_TH, "", Type.DATA); } // Extract all <td> elements from direct descendants, for easier/faster multiple access. List<Element> directTDs = new ArrayList<Element>(); for (Element e : directDescendants) { if (e.hasTagName("TD")) directTDs.add(e); } for (Element e : directTDs) { // b) table cell has abbr, headers, or scope attributes if (e.hasAttribute("abbr") || e.hasAttribute("headers") || e.hasAttribute("scope")) { return logAndReturn(Reason.ABBR_HEADERS_SCOPE, "", Type.DATA); } // c) table cell has <abbr> element as a single child element. NodeList<Element> children = e.getElementsByTagName("*"); if (children.getLength() == 1 && children.getItem(0).hasTagName("ABBR")) { return logAndReturn(Reason.ONLY_HAS_ABBR, "", Type.DATA); } } // 9) Table occupying > 95% of document width without viewport meta is layout table; // viewport condition is not in said url, added here for typical mobile-optimized sites. // The order here is different from said url: the latter has it after #14 (>=20 rows is // data table), but our eval sets indicate the need to bump this way up to here, because // many (old) pages have layout tables with the "summary" attribute (#10). Element docElement = t.getOwnerDocument().getDocumentElement(); int docWidth = docElement.getOffsetWidth(); if (docWidth > 0 && (double) t.getOffsetWidth() > 0.95 * (double) docWidth) { boolean viewportFound = false; NodeList<Element> allMeta = docElement.getElementsByTagName("META"); for (int i = 0; i < allMeta.getLength() && !viewportFound; i++) { MetaElement meta = MetaElement.as(allMeta.getItem(i)); viewportFound = meta.getName().equalsIgnoreCase("viewport"); } if (!viewportFound) { return logAndReturn(Reason.MORE_95_PERCENT_DOC_WIDTH, "", Type.LAYOUT); } } // 10) Table having summary attribute is data table. // This is different from said url: the latter lumps "summary" attribute with #8, but we // split it so as to insert #9 in between. Many (old) pages have tables that are clearly // layout: their "summary" attributes say they're for layout. They also occupy > 95% of // document width, so #9 coming before #10 will correctly classify them as layout. if (t.hasAttribute("summary")) return logAndReturn(Reason.SUMMARY, "", Type.DATA); // 11) Table having >=5 columns is data table. if (cols.getLength() >= 5) return logAndReturn(Reason.MORE_EQ_5_COLS, "", Type.DATA); // 12) Table having borders around cells is data table. for (Element e : directTDs) { String border = DomUtil.getComputedStyle(e).getBorderStyle(); if (!border.isEmpty() && !border.equals("none") && !border.equals("hidden")) { return logAndReturn(Reason.CELLS_HAVE_BORDER, "_" + border, Type.DATA); } } // 13) Table having differently-colored rows is data table. String prevBackgroundColor = null; for (int i = 0; i < rows.getLength(); i++) { String color = DomUtil.getComputedStyle(rows.getItem(i)).getBackgroundColor(); if (prevBackgroundColor == null) { prevBackgroundColor = color; continue; } if (!prevBackgroundColor.equalsIgnoreCase(color)) { return logAndReturn(Reason.DIFFERENTLY_COLORED_ROWS, "", Type.DATA); } } // 14) Table having >=20 rows is data table. if (rows.getLength() >= 20) return logAndReturn(Reason.MORE_EQ_20_ROWS, "", Type.DATA); // 15) Table having <=10 cells is layout table. if (directTDs.size() <= 10) return logAndReturn(Reason.LESS_EQ_10_CELLS, "", Type.LAYOUT); // 16) Table containing <embed>, <object>, <applet> or <iframe> elements (typical // advertisement elements) is layout table. if (hasOneOfElements(directDescendants, sObjectTags)) { return logAndReturn(Reason.EMBED_OBJECT_APPLET_IFRAME, "", Type.LAYOUT); } // 17) Table occupying > 90% of document height is layout table. // This is not in said url, added here because many (old) pages have tables that don't fall // into any of the above heuristics but are for layout, and hence shouldn't default to data // by #18. int docHeight = docElement.getOffsetHeight(); if (docHeight > 0 && (double) t.getOffsetHeight() > 0.9 * (double) docHeight) { return logAndReturn(Reason.MORE_90_PERCENT_DOC_HEIGHT, "", Type.LAYOUT); } // 18) Otherwise, it's data table. return logAndReturn(Reason.DEFAULT, "", Type.DATA); }
From source file:com.smartgwt.mobile.client.SmartGwtMobileEntryPoint.java
License:Open Source License
public void onModuleLoad() { // Added boolean init check flag because GWT for some reason invokes this entry point class twice in hosted mode // even though it appears only once in the load hierarchy. Check with GWT team. if (initialized) return;/*from w w w .j a va 2 s . co m*/ initialized = true; assert (assertionsEnabled = true) == true; // Intentional side effect. if (!assertionsEnabled) { SC.logWarn("WARNING: Assertions are not enabled. It is recommended to develop with assertions " + "enabled because both GWT and SmartGWT.mobile use them to help find bugs in application code. " + "To enable assertions, if using GWT 2.6.0 or later, recompile the application with the " + "-checkAssertions option passed to the GWT compiler. If using GWT 2.5.1 or earlier, recompile with the " + "-ea option passed to the GWT compiler."); } _init(); // Delete all current viewport <meta> tags. We will create a new one to work around two // issues: // - In an iOS 7 UIWebView, we need to set the viewport height to fix the issue that the // TabSet tabBar stays above the virtual keyboard when a text <input> has keyboard focus // (http://forums.smartclient.com/showthread.php?t=29005). // - On iPhone and iPad (iOS v7.0.4), we need to set the height to device-width to work // around a bug. If height is set to device-height, then in landscape orientation, // the <body>'s dimensions are 1024x1024, causing pickers to fail to appear. // - iOS 6.1 also has this problem, but if we use height = device-width, then there // are severe display issues when the orientation is changed, so we don't specify the // height. // - Don't want to do this unless in a UIWebView, however, because if we set the // viewport height then pickers get cut off when Showcase is viewed in Mobile Safari. // - In an iOS 7 UIWebView, we also need a viewport height to fix a different issue, namely // that if an input is tapped, but the virtual keyboard appears on top of the input, then // that input element is not focused, and the ScrollablePanel fails to scroll the tapped // input into view: // http://stackoverflow.com/questions/19110144/ios7-issues-with-webview-focus-when-using-keyboard-html // - This is not an issue on iOS 6.1. // - Firefox for Android does not support updating the content of an existing viewport // <meta> tag. However, if a new viewport <meta> tag is added, then the viewport settings // are updated: https://bugzilla.mozilla.org/show_bug.cgi?id=714737 final NodeList<Element> metaElems = Document.get().getElementsByTagName("meta"); for (int ri = metaElems.getLength(); ri > 0; --ri) { final MetaElement metaElem = metaElems.getItem(ri - 1).cast(); if ("viewport".equals(metaElem.getName())) { metaElem.removeFromParent(); } } String width = "device-width"; String height = null; if (CANVAS_STATIC_IMPL.isIOSMin7_0() && CANVAS_STATIC_IMPL.isUIWebView()) { height = Page.getOrientation() == PageOrientation.LANDSCAPE ? "device-width" : "device-height"; Page.addOrientationChangeHandler(new OrientationChangeHandler() { @Override public void onOrientationChange(OrientationChangeEvent event) { final String newHeight = Page.getOrientation() == PageOrientation.LANDSCAPE ? "device-width" : "device-height"; Page._updateViewport(Float.valueOf(1.0f), "device-width", newHeight, Boolean.FALSE, "minimal-ui"); } }); } Page._updateViewport(Float.valueOf(1.0f), width, height, Boolean.FALSE, "minimal-ui"); // Inject default styles. // // Because `CssResource' does not have support for at rules, CSS3 animations @keyframes // and @media rules must be added separately. // http://code.google.com/p/google-web-toolkit/issues/detail?id=4911 final StringBuilder cssText = new StringBuilder(); final String translateXStart = Canvas.isAndroid() ? "translateX(" : "translate3d(", translateXEnd = Canvas.isAndroid() ? ")" : ",0,0)", translateYStart = Canvas.isAndroid() ? "translateY(" : "translate3d(0,", translateYEnd = Canvas.isAndroid() ? ")" : ",0)"; // base cssText.append(Canvas._CSS.getText()); cssText.append(ThemeResources.INSTANCE.otherBaseCSS().getText()); cssText.append("@media all and (orientation:landscape){" + ThemeResources.INSTANCE.baseCSSLandscape().getText() + "}"); // activityindicator cssText.append(ActivityIndicator._CSS.getText()); if (ActivityIndicator._CSS instanceof ActivityIndicatorCssResourceIOS) { final ActivityIndicatorCssResourceIOS CSS = (ActivityIndicatorCssResourceIOS) ActivityIndicator._CSS; // Android 2.3.3 Browser has a bug where attempting to animate from transform:rotate(0deg) // to transform:rotate(360deg) results in no animation because its angle calculations // are mod 360, so 0 = 360 mod 360 and it thinks that there is no change in the transform // from start to end. A work-around is to add a 50% keyframe of transform:rotate(180deg). cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.spinAnimationName() + "{" + "0%{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":rotate(0deg)}" + "50%{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":rotate(180deg)}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":rotate(360deg)}" + "}" + "@keyframes " + CSS.spinAnimationName() + "{" + "0%{transform:rotate(0deg)}" + "50%{transform:rotate(180deg)}" + "to{transform:rotate(360deg)}" + "}"); } // layout cssText.append(ThemeResources.INSTANCE.layoutCSS().getText()); // panel cssText.append(ThemeResources.INSTANCE.panelCSS().getText()); // headings cssText.append(Header1._CSS.getText()); // buttons cssText.append(BaseButton._CSS.getText()); // form cssText.append(DynamicForm._CSS.getText()); // Note: GWT's CssResource does not currently support CSS3 @media queries. // https://code.google.com/p/google-web-toolkit/issues/detail?id=8162 // One work-around is to add the CSS text within the media query: // https://code.google.com/p/google-web-toolkit/issues/detail?id=4911#c6 cssText.append("@media all and (orientation:landscape){" + // The space after the 'and' keyword is important. Without this space, the styles are not applied on iPad in landscape orientation. ThemeResources.INSTANCE.formCSSLandscape().getText() + "}"); // menu cssText.append(Menu._CSS.getText()); if (Menu._CSS instanceof MenuCssResourceIPhone) { final MenuCssResourceIPhone CSS = (MenuCssResourceIPhone) Menu._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.menuFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + "@keyframes " + CSS.menuFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.menuFadeOutAnimationName() + "{" + "0%{opacity:1}" + "50%{opacity:1}" + "to{opacity:0}" + "}" + "@keyframes " + CSS.menuFadeOutAnimationName() + "{" + "0%{opacity:1}" + "50%{opacity:1}" + "to{opacity:0}" + "}"); } // navigationbar cssText.append(NavigationBar._CSS.getText()); if (NavigationBar._CSS instanceof NavigationBarCssResourceIOS) { final NavigationBarCssResourceIOS CSS = (NavigationBarCssResourceIOS) NavigationBar._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + "@keyframes " + CSS.navbarFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}" + "@keyframes " + CSS.navbarFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarSlideInFromRightAnimationName() + "{" + "0%{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "90px" + translateXEnd + "}" + "to{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarSlideInFromRightAnimationName() + "{" + "0%{opacity:0;transform:translateX(90px)}" + "to{opacity:1;transform:translateX(0)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarHeadingSlideInFromRightAnimationName() + "{" + "0%{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "60%" + translateXEnd + "}" + "to{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarHeadingSlideInFromRightAnimationName() + "{" + "0%{opacity:0;transform:translateX(60%)}" + "to{opacity:1;transform:translateX(0)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarSlideInFromLeftAnimationName() + "{" + "0%{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "-90px" + translateXEnd + "}" + "to{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarSlideInFromLeftAnimationName() + "{" + "0%{opacity:0;transform:translateX(-90px)}" + "to{opacity:1;transform:translateX(0)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarHeadingSlideInFromLeftAnimationName() + "{" + "0%{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "-60%" + translateXEnd + "}" + "to{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarHeadingSlideInFromLeftAnimationName() + "{" + "0%{opacity:0;transform:translateX(-60%)}" + "to{opacity:1;transform:translateX(0)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarSlideOutRightAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "to{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "90px" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarSlideOutRightAnimationName() + "{" + "0%{opacity:1;transform:translateX(0)}" + "to{opacity:0;transform:translateX(90px)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarHeadingSlideOutRightAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "to{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "60%" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarHeadingSlideOutRightAnimationName() + "{" + "0%{opacity:1;transform:translateX(0)}" + "to{opacity:0;transform:translateX(60%)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarSlideOutLeftAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "to{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "-90px" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarSlideOutLeftAnimationName() + "{" + "0%{opacity:1;transform:translateX(0)}" + "to{opacity:0;transform:translateX(-90px)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.navbarHeadingSlideOutLeftAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "0" + translateXEnd + "}" + "to{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateXStart + "-60%" + translateXEnd + "}" + "}" + "@keyframes " + CSS.navbarHeadingSlideOutLeftAnimationName() + "{" + "0%{opacity:1;transform:translateX(0)}" + "to{opacity:0;transform:translateX(-60%)}" + "}"); } // popup cssText.append(Popup._CSS.getText()); // picker2 cssText.append(Picker2.CSS.getText()); if (Picker2.CSS instanceof PickerCssResourceIOS) { final PickerCssResourceIOS CSS = (PickerCssResourceIOS) Picker2.CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.pickerFadeInAnimationName() + "{" + "0%{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "100%" + translateYEnd + "}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "0" + translateYEnd + "}" + "}" + "@keyframes " + CSS.pickerFadeInAnimationName() + "{" + "0%{transform:translateY(100%)}" + "to{transform:translateY(0)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.pickerFadeOutAnimationName() + "{" + "0%{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "0" + translateYEnd + "}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "100%" + translateYEnd + "}" + "}" + "@keyframes " + CSS.pickerFadeOutAnimationName() + "{" + "0%{transform:translateY(0)}" + "to{transform:translateY(100%)}" + "}"); } // progressbar cssText.append(Progressbar._CSS.getText()); // scrollable cssText.append(ScrollablePanel._CSS.getText()); // slider cssText.append(SliderItem._CSS.getText()); // switchitem cssText.append(SwitchItem._CSS.getText()); // tableview // Don't use `TableView._CSS.ensureInjected()' because the way that CssResource.ensureInjected() // is implemented, the CSS rules are scheduled to be added in a timeout, which may mean // that the DOM elements for the first `TableView' are added to the document before // the `TableView' CSS styles are added. If this first `TableView' has a parent `NavStack', // then the browser considers the background color of the LIs to have changed when // the `TableView' CSS is added, meaning that the background-color transition effect // kicks in. // http://jsfiddle.net/A4QDd/ // // GWT 2.5 introduces the StyleInjector.flush() function which would solve this problem, // but for GWT 2.4, we can simulate the same effect by always using StyleInjector.injectAtEnd() // (immediate = true) at the small price of more <style> elements being added to the document. cssText.append(TableView._CSS.getText()); cssText.append("@media all and (orientation:landscape){" + ThemeResources.INSTANCE.tableViewCSSLandscape().getText() + "}"); // tabs cssText.append(TabSet._CSS.getText()); if (TabSet._CSS instanceof TabSetCssResourceIOS) { final TabSetCssResourceIOS CSS = (TabSetCssResourceIOS) TabSet._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.tabBarSlideOutAnimationName() + "{" + "0%{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "0" + translateYEnd + "}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "100%" + translateYEnd + "}" + "}" + "@keyframes " + CSS.tabBarSlideOutAnimationName() + "{" + "0%{transform:translateY(0)}" + "to{transform:translateY(100%)}" + "}"); } cssText.append("@media all and (orientation:landscape){" + ThemeResources.INSTANCE.tabsCSSLandscape().getText() + "}"); // toolbar cssText.append(ToolStrip._CSS.getText()); // window if (Window._CSS instanceof WindowCssResourceIOS) { final WindowCssResourceIOS CSS = (WindowCssResourceIOS) Window._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.modalMaskFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + "@keyframes " + CSS.modalMaskFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.modalMaskFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}" + "@keyframes " + CSS.modalMaskFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}"); } // On iPad, windows look like alertviews. if (Window._CSS instanceof WindowCssResourceIPad) { final WindowCssResourceIPad CSS = (WindowCssResourceIPad) Window._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.windowBackgroundFadeInAnimationName() + "{" + "0%{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(1)}" + "50%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(.95)}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(1)}" + "}" + "@keyframes " + CSS.windowBackgroundFadeInAnimationName() + "{" + "0%{opacity:0;transform:scale(1)}" + "50%{opacity:1;transform:scale(.95)}" + "to{transform:scale(1)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.windowBackgroundFadeOutAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(1)}" + "to{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(.95)}" + "}" + "@keyframes " + CSS.windowBackgroundFadeOutAnimationName() + "{" + "0%{opacity:1;transform:scale(1)}" + "to{opacity:0;transform:scale(.95)}" + "}"); // Otherwise, windows look like action sheets. } else { assert Window._CSS instanceof WindowCssResourceIPhone; final WindowCssResourceIPhone CSS = (WindowCssResourceIPhone) Window._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.windowBackgroundSlideInAnimationName() + "{" + "0%{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "100%" + translateYEnd + "}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "0" + translateYEnd + "}" + "}" + "@keyframes " + CSS.windowBackgroundSlideInAnimationName() + "{" + "0%{transform:translateY(100%)}" + "to{transform:translateY(0)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.windowBackgroundSlideOutAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "0" + translateYEnd + "}" + "to{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":" + translateYStart + "100%" + translateYEnd + "}" + "}" + "@keyframes " + CSS.windowBackgroundSlideOutAnimationName() + "{" + "0%{opacity:1;transform:translateY(0)}" + "to{opacity:1;transform:translateY(100%)}" + "}"); } cssText.append(Window._CSS.getText()); cssText.append("@media all and (orientation:landscape){" + ThemeResources.INSTANCE.windowCSSLandscape().getText() + "}"); // dialog cssText.append(Dialog._CSS.getText()); // alertview if (AlertView._CSS instanceof AlertViewCssResourceIOS) { final AlertViewCssResourceIOS CSS = (AlertViewCssResourceIOS) AlertView._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.alertViewScreenCoverFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + "@keyframes " + CSS.alertViewScreenCoverFadeInAnimationName() + "{" + "0%{opacity:0}" + "to{opacity:1}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.alertViewScreenCoverFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}" + "@keyframes " + CSS.alertViewScreenCoverFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.alertViewFadeInAnimationName() + "{" + "0%{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(1)}" + "50%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(.95)}" + "to{" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(1)}" + "}" + "@keyframes " + CSS.alertViewFadeInAnimationName() + "{" + "0%{opacity:0;transform:scale(1)}" + "50%{opacity:1;transform:scale(.95)}" + "to{transform:scale(1)}" + "}" + DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.alertViewFadeOutAnimationName() + "{" + "0%{opacity:1;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(1)}" + "to{opacity:0;" + DOMConstants.INSTANCE.getTransformPropertyNameForCSSText() + ":scale(.95)}" + "}" + "@keyframes " + CSS.alertViewFadeOutAnimationName() + "{" + "0%{opacity:1;transform:scale(1)}" + "to{opacity:0;transform:scale(.95)}" + "}"); } cssText.append(AlertView._CSS.getText()); // popover cssText.append(Popover._CSS.getText()); if (Popover._CSS instanceof PopoverCssResourceIPhone) { final PopoverCssResourceIPhone CSS = (PopoverCssResourceIPhone) Popover._CSS; cssText.append(DOMConstants.INSTANCE.getAtKeyframesText() + " " + CSS.popoverFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}" + "@keyframes " + CSS.popoverFadeOutAnimationName() + "{" + "0%{opacity:1}" + "to{opacity:0}" + "}"); } StyleInjector.injectAtEnd(CSSUtil.fixNotSelectors(cssText.toString()), true); }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
public static String getGwtProperty(String name) { final NodeList<com.google.gwt.dom.client.Element> meta = Document.get().getElementsByTagName("meta"); for (int i = 0; i < meta.getLength(); i++) { final MetaElement m = MetaElement.as(meta.getItem(i)); if (m != null && "gwt:property".equals(m.getName())) { String[] kv = m.getContent().split("=", 2); if (kv[0] != null && kv[0].equals(name)) { return kv.length > 1 ? kv[1] : ""; }//from w w w . j a v a 2s. c om } } return null; }