Java Code Examples for com.google.gwt.dom.client.DivElement

The following examples show how to use com.google.gwt.dom.client.DivElement. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: swellrt   Source File: CajolerFacade.java    License: Apache License 2.0 6 votes vote down vote up
private void appendToDocument(HTML target, PluginContext pluginContext, CajolerResponse response) {
  DivElement domitaVdocElement = Document.get().createDivElement();
  domitaVdocElement.setClassName("innerHull");

  target.getElement().setInnerHTML("");
  target.getElement().setClassName("outerHull");
  target.getElement().appendChild(domitaVdocElement);

  initializeDoodadEnvironment(
      cajaFrame, domitaVdocElement, pluginContext.getJSOInterface());

  // Render HTML
  domitaVdocElement.setInnerHTML(response.getHtml());

  // Inject JS
  Document cajaFrameDoc = cajaFrame.getContentDocument();
  cajaFrameDoc.getBody().appendChild(cajaFrameDoc.createScriptElement(response.getJs()));
}
 
Example 2
Source Project: swellrt   Source File: DomLogger.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Appends an entry to the log panel.
 * @param formatted
 * @param level
 */
public static void appendEntry(String formatted, Level level) {
  DivElement entry = Document.get().createDivElement();
  entry.setClassName(RESOURCES.css().entry());
  entry.setInnerHTML(formatted);

  // Add the style name associated with the log level.
  switch (level) {
    case ERROR:
      entry.addClassName(RESOURCES.css().error());
      break;
    case FATAL:
      entry.addClassName(RESOURCES.css().fatal());
      break;
    case TRACE:
      entry.addClassName(RESOURCES.css().trace());
      break;
  }

  // Make fatals detectable by WebDriver, so that tests can early out on
  // failure:
  if (level.equals(Level.FATAL)) {
    latestFatalError = formatted;
  }
  writeOrCacheOutput(entry);
}
 
Example 3
Source Project: dashbuilder   Source File: PerspectivesExplorerView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void addPerspective(String name, Command onClicked) {
    AnchorElement anchor = Document.get().createAnchorElement();
    anchor.getStyle().setCursor(Style.Cursor.POINTER);
    anchor.getStyle().setColor("black");
    anchor.getStyle().setProperty("fontSize", "larger");
    anchor.setInnerText(name);

    Event.sinkEvents(anchor, Event.ONCLICK);
    Event.setEventListener(anchor, event -> {
        if(Event.ONCLICK == event.getTypeInt()) {
            onClicked.execute();
        }
    });

    SpanElement icon = Document.get().createSpanElement();
    icon.getStyle().setMarginRight(10, Style.Unit.PX);
    icon.setClassName("pficon-virtual-machine");
    icon.getStyle().setProperty("fontSize", "larger");

    DivElement gi = createItemDiv(new Element[] {icon, anchor});
    perspectivesDiv.appendChild((Node) gi);
}
 
Example 4
private void redrawMonthPicker() {
	this.monthPicker.getStyle().setWidth(this.calendarTable.getClientWidth(), Unit.PX);
	this.calendarTable.getStyle().setDisplay(Display.NONE);
	this.monthPicker.getStyle().clearDisplay();

	int currentYear = this.cursor.getYear() + InputDatePicker.YEAR_OFFSET;
	if (this.monthPickerInner.getChildCount() == 0) {
		for (int year = currentYear - 100; year < currentYear + 100; year++) {
			DivElement yearDiv = Document.get().createDivElement();
			yearDiv.setInnerText(String.valueOf(year));
			StyleUtils.addStyle(yearDiv, InputDatePicker.STYLE_YEAR_BUTTON);
			Event.sinkEvents(yearDiv, Event.ONCLICK);
			this.monthPickerInner.appendChild(yearDiv);
			yearDiv.setAttribute(InputDatePicker.ATTRIBUTE_DATA_YEAR, String.valueOf(year));
		}
	}
	this.openMonthOfYear(this.cursor.getYear() + InputDatePicker.YEAR_OFFSET);
}
 
Example 5
public Carousel() {
	super(DivElement.TAG);
	this.append(this.carouselIndicators);
	this.append(this.carouselInner);
	this.append(this.leftButton);
	this.append(this.rightButton);
	StyleUtils.addStyle(this, Carousel.STYLE_CAROUSEL);
	StyleUtils.addStyle(this.carouselInner, Carousel.STYLE_CAROUSEL_INNER);
	StyleUtils.addStyle(this.carouselIndicators, Carousel.STYLE_CAROUSEL_INDICATORS);
	StyleUtils.addStyle(this.leftButton, Carousel.STYLE_CAROUSEL_CONTROL);
	StyleUtils.addStyle(this.leftButton, LeftRightType.LEFT);
	StyleUtils.addStyle(this.rightButton, Carousel.STYLE_CAROUSEL_CONTROL);
	StyleUtils.addStyle(this.rightButton, LeftRightType.RIGHT);
	this.leftButton.addClickHandler(this);
	this.rightButton.addClickHandler(this);
	this.leftButton.getElement().setInnerHTML("<i class=\"icon-prev\"/>");
	this.rightButton.getElement().setInnerHTML("<i class=\"icon-next\"/>");
}
 
Example 6
Source Project: gantt   Source File: GanttWidget.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Add new StepWidget into content area.
 *
 * @param stepIndex
 *            Index of step (0 based) (not element index in container)
 * @param widget
 * @param updateAffectedSteps
 *            Updates position of affected steps. Usually it means steps
 *            below the target.
 */
public void addStep(int stepIndex, StepWidget stepWidget, boolean updateAffectedSteps) {
    DivElement bar = DivElement.as(stepWidget.getElement());

    boolean newStep = !bar.hasParentElement();
    boolean moving = !newStep && getStepIndex(stepWidget) != stepIndex;
    boolean insertDOM = newStep || moving;

    if (insertDOM) {
        insert(stepIndex + getAdditonalContentElementCount(), stepWidget);
    }

    deferredUpdateStepTop(stepIndex, updateAffectedSteps, bar, insertDOM);

    if (newStep) {
        registerBarEventListener(bar);
    }
}
 
Example 7
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 6 votes vote down vote up
private Element getLastResolutionElement() {
    DivElement div = getResolutionDiv();
    if (div == null) {
        return null;
    }
    NodeList<Node> nodeList = div.getChildNodes();
    if (nodeList == null) {
        return null;
    }
    int blockCount = nodeList.getLength();
    if (blockCount < 1) {
        return null;
    }
    if (containsResBlockSpacer()) {
        int index = blockCount - 2;
        if (blockCount > 1 && index >= 0) {
            return Element.as(getResolutionDiv().getChild(index));
        }
        return null;
    }
    return Element.as(getResolutionDiv().getLastChild());
}
 
Example 8
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 6 votes vote down vote up
private void updateSpacerBlocks(double dayWidthPx) {
    double spaceLeft = getResolutionDivWidth() - (blocksInRange * dayWidthPx);
    if (spaceLeft > 0) {
        for (DivElement e : spacerBlocks) {
            e.getStyle().clearDisplay();
            e.getStyle().setWidth(spaceLeft, Unit.PX);
        }

        resSpacerDiv = createResolutionBlock();
        resSpacerDiv.addClassName(STYLE_SPACER);
        resSpacerDiv.getStyle().setWidth(spaceLeft, Unit.PX);
        resSpacerDiv.setInnerText(" ");
        resolutionDiv.appendChild(resSpacerDiv);
    } else {
        hideSpacerBlocks();
    }
}
 
Example 9
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 6 votes vote down vote up
private void fillDayResolutionBlock(DivElement resBlock, Date date, int index, boolean weekend, int left) {
    resBlock.setInnerText(getLocaleDataProvider().formatDate(date, getDayDateTimeFormat()));

    if (showCurrentTime && getLocaleDataProvider().formatDate(date, DAY_CHECK_FORMAT).equals(currentDate)) {
        resBlock.addClassName(STYLE_NOW);
    } else {
        resBlock.removeClassName(STYLE_NOW);
    }
    if (weekend) {
        resBlock.addClassName(STYLE_WEEKEND);
    } else {
        resBlock.removeClassName(STYLE_WEEKEND);
    }

    if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) {
        resBlock.getStyle().setPosition(Position.RELATIVE);
        resBlock.getStyle().setLeft(left, Unit.PX);
    }
}
 
Example 10
Source Project: incubator-retired-wave   Source File: CajolerFacade.java    License: Apache License 2.0 6 votes vote down vote up
private void appendToDocument(HTML target, PluginContext pluginContext, CajolerResponse response) {
  DivElement domitaVdocElement = Document.get().createDivElement();
  domitaVdocElement.setClassName("innerHull");

  target.getElement().setInnerHTML("");
  target.getElement().setClassName("outerHull");
  target.getElement().appendChild(domitaVdocElement);

  initializeDoodadEnvironment(
      cajaFrame, domitaVdocElement, pluginContext.getJSOInterface());

  // Render HTML
  domitaVdocElement.setInnerHTML(response.getHtml());

  // Inject JS
  Document cajaFrameDoc = cajaFrame.getContentDocument();
  cajaFrameDoc.getBody().appendChild(cajaFrameDoc.createScriptElement(response.getJs()));
}
 
Example 11
Source Project: incubator-retired-wave   Source File: DomLogger.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Appends an entry to the log panel.
 * @param formatted
 * @param level
 */
public static void appendEntry(String formatted, Level level) {
  DivElement entry = Document.get().createDivElement();
  entry.setClassName(RESOURCES.css().entry());
  entry.setInnerHTML(formatted);

  // Add the style name associated with the log level.
  switch (level) {
    case ERROR:
      entry.addClassName(RESOURCES.css().error());
      break;
    case FATAL:
      entry.addClassName(RESOURCES.css().fatal());
      break;
    case TRACE:
      entry.addClassName(RESOURCES.css().trace());
      break;
  }

  // Make fatals detectable by WebDriver, so that tests can early out on
  // failure:
  if (level.equals(Level.FATAL)) {
    latestFatalError = formatted;
  }
  writeOrCacheOutput(entry);
}
 
Example 12
Source Project: swellrt   Source File: DomLogger.java    License: Apache License 2.0 5 votes vote down vote up
/** Clear the output cache if the output element is set. */
private static void maybeClearOutputCache() {
  if (outputElm != null) {
    for (DivElement e : outputCache) {
      outputElm.appendChild(e);
    }
    outputCache.clear();
    outputElm.setScrollTop(1000000);
  }
}
 
Example 13
Source Project: swellrt   Source File: DebugDialog.java    License: Apache License 2.0 5 votes vote down vote up
private void appendLogLine(String line) {
  DivElement element = Document.get().createDivElement();
  element.setInnerHTML(line);
  element.getStyle().setProperty("borderBottomStyle", "dotted");
  element.getStyle().setBorderWidth(1, Unit.PX);
  element.getStyle().setBorderColor("#c0c0c0");
  logContainer.appendChild(element);
  lastElement = element;
}
 
Example 14
Source Project: dashbuilder   Source File: NavTreeWidgetView.java    License: Apache License 2.0 5 votes vote down vote up
protected void addItem(String iconClass, String id, String name, String description, Command onClicked) {
    Element nameEl = onClicked != null ? Document.get().createAnchorElement() : Document.get().createSpanElement();
    nameEl.setInnerText(name);
    nameEl.setClassName(onClicked != null ? "uf-navtree-widget-non-clicked" : "uf-navtree-widget-non-clickable");
    if (description != null && !description.equals(name)) {
        nameEl.setTitle(description);
    }

    SpanElement iconSpan = Document.get().createSpanElement();
    iconSpan.setClassName("uf-navtree-widget-icon " + iconClass);

    DivElement div = Document.get().createDivElement();
    div.appendChild(iconSpan);
    div.appendChild(nameEl);

    navWidget.appendChild((Node) div);
    itemMap.put(id, nameEl);

    if (onClicked != null) {
        Event.sinkEvents(nameEl, Event.ONCLICK);
        Event.setEventListener(nameEl, event -> {
            if (Event.ONCLICK == event.getTypeInt()) {
                onClicked.execute();
            }
        });
    }
}
 
Example 15
Source Project: dashbuilder   Source File: PerspectivesExplorerView.java    License: Apache License 2.0 5 votes vote down vote up
private DivElement createItemDiv(Element[] items) {
    DivElement mi = Document.get().createDivElement();
    mi.setClassName("list-view-pf-main-info");
    mi.getStyle().setPaddingTop(5, Style.Unit.PX);
    mi.getStyle().setPaddingBottom(5, Style.Unit.PX);
    for (Element item : items) {
        mi.appendChild(item);
    }

    DivElement gi = Document.get().createDivElement();
    gi.setClassName("list-group-item");
    gi.appendChild(mi);
    return gi;
}
 
Example 16
Source Project: dashbuilder   Source File: PerspectivesExplorerView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void showEmpty(String message) {
    SpanElement span = Document.get().createSpanElement();
    span.setInnerText(message);
    DivElement gi = createItemDiv(new Element[] {span});
    perspectivesDiv.appendChild((Node) gi);
}
 
Example 17
public TooltipWidget() {
	this.container = Document.get().createDivElement();
	StyleUtils.addStyle(this.container, Tooltip.STYLE_TOOLTIP);
	StyleUtils.addStyle(this.container, Tooltip.STYLE_FADE);

	DivElement arrow = Document.get().createDivElement();
	StyleUtils.addStyle(arrow, Tooltip.STYLE_ARROW);
	this.container.appendChild(arrow);

	this.inner = Document.get().createDivElement();
	StyleUtils.addStyle(this.inner, Tooltip.STYLE_INNER);
	this.container.appendChild(this.inner);

	this.setElement(this.container);
}
 
Example 18
public Table() {
	super(DivElement.TAG);

	this.endConstruct();

	this.setStriped(this.striped);
	this.setHover(this.hover);
	this.setCondensed(this.condensed);
}
 
Example 19
public Modal() {
	super(DivElement.TAG);

	StyleUtils.addStyle(this, Modal.STYLE_MODAL);
	StyleUtils.addStyle(this, Modal.STYLE_FADE);

	this.append(this.dialogContainer);
	this.dialogContainer.append(this.contentContainer);

	StyleUtils.addStyle(this.dialogContainer, Modal.STYLE_DIALOG);
	StyleUtils.addStyle(this.contentContainer, Modal.STYLE_CONTENT);
	StyleUtils.addStyle(this.bodyContainer, Modal.STYLE_BODY);
}
 
Example 20
public Alert(String html) {
	super(DivElement.TAG, html);
	StyleUtils.addStyle(this, Alert.STYLE_ALERT);
	StyleUtils.addStyle(this, Alert.STYLE_FADE);
	StyleUtils.addStyle(this, Alert.STYLE_VISIBLE);
	this.setType(Type.INFO);
}
 
Example 21
Source Project: gantt   Source File: GanttWidget.java    License: Apache License 2.0 5 votes vote down vote up
public GanttWidget() {

        setElement(DivElement.as(DOM.createDiv()));
        setStyleName(STYLE_GANTT);

        nowElement.setClassName(STYLE_NOW_ELEMENT);

        moveElement.setClassName(STYLE_MOVE_ELEMENT);
        // not visible by default
        moveElement.getStyle().setDisplay(Display.NONE);

        timeline = GWT.create(TimelineWidget.class);

        container = DivElement.as(DOM.createDiv());
        container.setClassName(STYLE_GANTT_CONTAINER);

        content = DivElement.as(DOM.createDiv());
        content.setClassName(STYLE_GANTT_CONTENT);
        container.appendChild(content);

        content.appendChild(moveElement);
        content.appendChild(nowElement);

        scrollbarSpacer = DivElement.as(DOM.createDiv());
        scrollbarSpacer.getStyle().setHeight(AbstractNativeScrollbar.getNativeScrollbarHeight(), Unit.PX);
        scrollbarSpacer.getStyle().setDisplay(Display.NONE);

        getElement().appendChild(timeline.getElement());
        getElement().appendChild(container);
        getElement().appendChild(scrollbarSpacer);
    }
 
Example 22
Source Project: gantt   Source File: GanttWidget.java    License: Apache License 2.0 5 votes vote down vote up
private void deferredUpdateStepTop(int stepIndex, boolean updateAffectedSteps, DivElement bar, boolean insertDOM) {
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            updateStepTop(stepIndex, updateAffectedSteps, bar, insertDOM);
        }
    });
}
 
Example 23
Source Project: gantt   Source File: GanttWidget.java    License: Apache License 2.0 5 votes vote down vote up
private void updateStepTop(int stepIndex, boolean updateAffectedSteps, DivElement bar, boolean insertDOM) {
    // Update top
    int stepsInContainer = getChildren().size() - getAdditionalWidgetContentElementCount();
    int indexInWidgetContainer = stepIndex + getAdditionalWidgetContentElementCount();
    // bar height should be defined in css
    int height = getElementHeightWithMargin(bar);

    if (stepIndex == 0) {
        bar.getStyle().setTop(0, Unit.PX);
        if (updateAffectedSteps) {
            updateTopForAllStepsBelow(indexInWidgetContainer + 1, height);
        }
    } else if (stepIndex < stepsInContainer) {
        // update top by the previous step top + step height.
        // Requires that previous steps top is already correct.
        int prevWidgetIndex = indexInWidgetContainer - 1;
        Widget w = getWidget(prevWidgetIndex);
        if (w instanceof StepWidget) {
            double top = parseSize(w.getElement().getStyle().getTop(), "px");
            top += getElementHeightWithMargin(w.getElement());
            bar.getStyle().setTop(top, Unit.PX);

            if (updateAffectedSteps) {
                updateTopForAllStepsBelow(indexInWidgetContainer + 1, height);
            }
        }
    }

    if (insertDOM) {
        contentHeight += height;
    }
}
 
Example 24
Source Project: gantt   Source File: AbstractStepWidget.java    License: Apache License 2.0 5 votes vote down vote up
public AbstractStepWidget() {
    DivElement bar = DivElement.as(DOM.createDiv());
    bar.setClassName(STYLE_BAR);
    setElement(bar);

    caption = DivElement.as(DOM.createDiv());
    caption.setClassName(STYLE_BAR_LABEL);
    bar.appendChild(caption);

    // hide by default
    bar.getStyle().setVisibility(Visibility.HIDDEN);
}
 
Example 25
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 5 votes vote down vote up
private DivElement createSpacerBlock(String className) {
    DivElement block = DivElement.as(DOM.createDiv());
    block.setClassName(STYLE_ROW + " " + STYLE_YEAR);
    block.addClassName(STYLE_SPACER);
    block.setInnerText(" ");
    block.getStyle().setDisplay(Display.NONE); // not visible by default
    spacerBlocks.add(block);
    return block;
}
 
Example 26
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 5 votes vote down vote up
private DivElement createTimelineBlock(String key, String text, String styleSuffix, BlockRowData rowData) {
    DivElement div = DivElement.as(DOM.createDiv());
    div.setClassName(STYLE_ROW + " " + styleSuffix);
    div.setInnerText(text);
    rowData.setBlockLength(key, 1);
    rowData.setBlock(key, div);
    return div;
}
 
Example 27
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 5 votes vote down vote up
private void fillWeekResolutionBlock(DivElement resBlock, boolean fillWeekBlock, Date date, int index,
        Weekday weekDay, boolean firstWeek,
        boolean lastBlock, int left, boolean even) {
    if (fillWeekBlock) {
        resBlock.setInnerText(formatWeekCaption(date));

        if (even) {
            resBlock.addClassName(STYLE_EVEN);
        } else {
            resBlock.removeClassName(STYLE_EVEN);
        }

        if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) {
            resBlock.getStyle().setPosition(Position.RELATIVE);
            resBlock.getStyle().setLeft(left, Unit.PX);
        }

        resBlock.removeClassName(STYLE_FIRST);
        resBlock.removeClassName(STYLE_LAST);
    }

    if (firstWeek && (weekDay == Weekday.Last || lastBlock)) {
        Element firstEl = resolutionDiv.getFirstChildElement();
        if (!firstEl.hasClassName(STYLE_FIRST)) {
            firstEl.addClassName(STYLE_FIRST);
        }
    } else if (lastBlock) {
        Element lastEl = Element.as(resolutionDiv.getLastChild());
        if (!lastEl.hasClassName(STYLE_LAST)) {
            lastEl.addClassName(STYLE_LAST);
        }
    }
}
 
Example 28
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 5 votes vote down vote up
private void fillHourResolutionBlock(DivElement resBlock, Date date, int index, int hourCounter, boolean lastBlock,
        int left, boolean even) {
    resBlock.setInnerText(formatHourCaption(date));

    if (showCurrentTime
            && getLocaleDataProvider().formatDate(date, HOUR_CHECK_FORMAT).equals(currentDate + currentHour)) {
        resBlock.addClassName(STYLE_NOW);
    } else {
        resBlock.removeClassName(STYLE_NOW);
    }
    if (even) {
        resBlock.addClassName(STYLE_EVEN);
    } else {
        resBlock.removeClassName(STYLE_EVEN);

    }

    if (firstDay && (hourCounter == 24 || lastBlock)) {
        firstDay = false;
        firstResBlockCount = index + 1;
    } else if (lastBlock) {
        lastResBlockCount = (index + 1 - firstResBlockCount) % 24;
    }

    if (styleElementForLeft == null && isTimelineOverflowingHorizontally()) {
        resBlock.getStyle().setPosition(Position.RELATIVE);
        resBlock.getStyle().setLeft(left, Unit.PX);
    }
}
 
Example 29
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 5 votes vote down vote up
private int calculateResolutionMinWidth() {

        boolean removeResolutionDiv = false;
        if (!resolutionDiv.hasParentElement()) {
            removeResolutionDiv = true;
            getElement().appendChild(resolutionDiv);
        }
        DivElement resBlockMeasure = DivElement.as(DOM.createDiv());
        if (resolution == Resolution.Week) {
            // configurable with '.col.w.measure' selector
            resBlockMeasure.setClassName(STYLE_COL + " " + STYLE_WEEK + " " + STYLE_MEASURE);
        } else {
            // measure for text 'MM'
            resBlockMeasure.setInnerText("MM");
            // configurable with '.col.measure' selector
            resBlockMeasure.setClassName(STYLE_COL + " " + STYLE_MEASURE);
        }
        resolutionDiv.appendChild(resBlockMeasure);
        int width = resBlockMeasure.getClientWidth();
        if (resolution == Resolution.Week) {
            // divide given width by number of days in week
            width = width / DAYS_IN_WEEK;
        }
        width = (width < resolutionWeekDayblockWidth) ? resolutionWeekDayblockWidth : width;
        resBlockMeasure.removeFromParent();
        if (removeResolutionDiv) {
            resolutionDiv.removeFromParent();
        }
        return width;
    }
 
Example 30
Source Project: gantt   Source File: TimelineWidget.java    License: Apache License 2.0 5 votes vote down vote up
private void createTimelineElementsOnVisibleArea() {
    // create place holder elements that represents weeks/days/hours
    // depending on the resolution in the timeline.
    // Only visible blocks are created, and only once, content will change
    // on scroll.

    // first: detect how many blocks we can fit in the screen
    int blocks = resolutionBlockCount;
    if (isTimelineOverflowingHorizontally()) {
        blocks = (int) (GanttUtil.getBoundingClientRectWidth(getElement().getParentElement())
                / calculateMinimumResolutionBlockWidth());
        if (resolutionBlockCount < blocks) {
            // blocks need to be scaled up to fit the screen
            blocks = resolutionBlockCount;
        } else {
            blocks += 2;
        }
    }

    DivElement element = null;
    for (int i = 0; i < blocks; i++) {
        switch (resolution) {
        case Hour:
            element = createHourResolutionBlock();
            break;
        case Day:
            element = createDayResolutionBlock();
            break;
        case Week:
            element = createWeekResolutionBlock();
            break;
        }
        resolutionDiv.appendChild(element);
    }

    GWT.log(getClass().getSimpleName() + " Added " + blocks + " visible timeline elements for resolution ."
            + String.valueOf(resolution));
}