/** Calculates the number of events that can be displayed in a cell. */ public void calibrateCalendar() { final FlexTable grid = (FlexTable) getWidget(); final Element row = grid.getRowFormatter().getElement(displayHeaders); row.setId("calendar-row-calibration"); final Element cell = grid.getCellFormatter().getElement(displayHeaders, displayWeekNumber ? 1 : 0); cell.setId("calendar-cell-calibration"); eventLimit = (getCellHeight(CELL_DEFAULT_HEIGHT) / EVENT_HEIGHT) - 2; if (eventLimit < 0) eventLimit = 0; }
public static HTML makeProcessInfoDiv() { Element processDiv = DOM.createDiv(); processDiv.setId("process_info"); processDiv.appendChild(DOM.createElement("svg")); HTML processHtml = new HTML(processDiv.getString()); processHtml.getElement().setId(_DRUPAL_GWTVIZ_PROCESS_ID); return processHtml; }
/** * remove gwt positioning and overflow from extra divs, and hope for the best about xbrowser * compatibility.. */ private Element __fixPositioningAndOverflow(final Element element) { if ("body".equalsIgnoreCase(element.getTagName())) { return element; } else { element.setAttribute("style", ""); element.removeAttribute("style"); // does not work on chrome element.setId("extradiv_" + index++); return __fixPositioningAndOverflow(element.getParentElement()); } }
public static HTML makeChartDiv() { Element chartDiv = DOM.createDiv(); chartDiv.setId("chart"); chartDiv.appendChild(DOM.createElement("svg")); HTML chartHtml = new HTML(chartDiv.getString()); chartHtml.getElement().setId(_DRUPAL_GWTVIZ_CHART_ID); return chartHtml; }
/** Utility method to show a loading element if there is no one in hosting page. */ public static void startLoading() { Element l = DOM.getElementById("loading"); if (l == null) { l = DOM.createDiv(); l.setAttribute( "style", "position:fixed;top:0px;left:0px;width:100%;text-align:center;font-family:arial;font-size:24px;color:#4285f4;"); l.setId("loading"); l.setInnerText("loading" + "..."); Document.get().getBody().appendChild(l); } }
@Override public void visitTag(Tag tag) { Element e = Document.get().createElement(tag.getTagName()); map.put(tag, e); for (Object o : tag.getAttributesEx()) { Attribute a = (Attribute) o; if ("id".equalsIgnoreCase(a.getName())) { e.setId(a.getValue()); } else if ("style".equalsIgnoreCase(a.getName())) { processStyle(e, a.getValue()); } else if ("class".equalsIgnoreCase(a.getName())) { e.setClassName(a.getValue()); } else if (!a.isEmpty() && !a.isWhitespace() && a.isValued()) { e.setAttribute(a.getName(), a.getValue()); } } Element parent = getParent(tag.getParent()); parent.appendChild(e); }
/** Creates a div with the integer id as its id. */ public static Element createDiv(int id) { Element e = Document.get().createDivElement(); e.setId(Integer.toString(id)); return e; }