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

The following are top voted examples for showing how to use com.google.gwt.dom.client.DivElement. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: appformer   File: PerspectivesExplorerView.java   Source Code and License 7 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 2
Project: incubator-wave   File: DomLogger.java   Source Code and License 7 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
Project: swarm   File: TaskList.java   Source Code and License 7 votes vote down vote up
protected TaskList(PageTransitionPanel parent, Controls controls,
    Controller controller, TaskList.Resources resources) {
  super(parent, controls, resources);
  this.controller = controller;
  this.resources = resources;

  urgentNotImportantTasks = Document.get().createDivElement();
  urgentImportantTasks = Document.get().createDivElement();
  notUrgentNotImportantTasks = Document.get().createDivElement();
  notUrgentImportantTasks = Document.get().createDivElement();
  Element container = getContentContainer();
  container.appendChild(urgentImportantTasks);
  container.appendChild(notUrgentImportantTasks);
  container.appendChild(urgentNotImportantTasks);
  container.appendChild(notUrgentNotImportantTasks);

  userEmail = Document.get().createDivElement();
  userEmail.getStyle().setProperty("display", "inline-block");
  userEmail.setInnerText("Loading...");
  logoutLink = Document.get().createAnchorElement();
  DivElement userInfoContainer = Document.get().createDivElement();
  userInfoContainer.appendChild(userEmail);
  userInfoContainer.appendChild(logoutLink);
  userInfoContainer.setClassName(resources.taskListCss().user());
  container.appendChild(userInfoContainer);
}
 
Example 4
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License 6 votes vote down vote up
private void createViewerContainer(Document document, DivElement mainContainer) {
	viewerContainer = createChildDiv(document, mainContainer, "viewerContainer");
	viewerContainer.setTabIndex(0); // keyboard scrolling does not work without this tabindex 

	viewer = createChildDiv(document, viewerContainer, "viewer");
	viewer.addClassName("pdfViewer");

	overlayContainer = createChildDiv(document, outerContainer, "overlayContainer");
	overlayContainer.addClassName("hidden");

	passwordOverlay = createChildDiv(document, overlayContainer, "passwordOverlay");
	passwordOverlay.addClassName("container");
	passwordOverlay.addClassName("hidden");

	createDocumentPropertiesOverlay(document, overlayContainer);
	createPrintServiceOverlay(document, overlayContainer);
}
 
Example 5
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License 6 votes vote down vote up
private void createPrintServiceOverlay(Document document, DivElement parent) {
	printServiceOverlay = createChildDiv(document, parent, "printServiceOverlay");
	printServiceOverlay.addClassName("container");
	printServiceOverlay.addClassName("hidden");

	DivElement dialog = createChildDiv(document, printServiceOverlay, "dialog");
	DivElement row1 = createChildDiv(document, dialog, "row");
	SpanElement message = createChildSpan(document, row1, "");
	message.setInnerText("Preparing document for printing!");

	DivElement row2 = createChildDiv(document, dialog, "row");
	createChildProgress(document, row2, 0, 100);
	SpanElement relativeProgressSpan = createChildSpan(document, row2, "relative-progress");
	relativeProgressSpan.setInnerText("0%");

	DivElement row3 = createChildDiv(document, dialog, "row");
	printCancel = createChildButton(document, row3, "printCancel");
	printCancel.addClassName("overlayButton");
	SpanElement printCancelMessage = createChildSpan(document, printCancel, "");
	printCancelMessage.setInnerText("Cancel");
}
 
Example 6
Project: gwt-promptly   File: PromptlyPanel.java   Source Code and License 6 votes vote down vote up
public final ItemHandle appendEmbeddedImage(
     HAlignment imageAlignment,
     String embeddedImageText,
     String embeddedImageStyle,
     String description
) {
   FlowPanel outer = new FlowPanel(DivElement.TAG);
   String imageAlignment1 = "text-align:center;";
   if (imageAlignment == HAlignment.LEFT) {
      imageAlignment1 = "text-align:left;";
   } else if (imageAlignment == HAlignment.RIGHT) {
      imageAlignment1 = "text-align:right;";
   }
   outer.getElement().setAttribute("style", "display:block;" + imageAlignment1);
   FlowPanel inner = new FlowPanel(ImageElement.TAG);
   inner.getElement().setAttribute("alt",   description);
   inner.getElement().setAttribute("src",   embeddedImageText);
   inner.getElement().setAttribute("style", embeddedImageStyle);
   outer.add(inner);
   appendAndScrollOrFocusAsAppropriate(outer);
   return new ItemHandle(this, outer);
}
 
Example 7
Project: Wiab.pro   File: CajolerFacade.java   Source Code and License 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 8
Project: Wiab.pro   File: DomLogger.java   Source Code and License 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 9
Project: listmaker   File: ItemsTable.java   Source Code and License 6 votes vote down vote up
protected void expando(final FlowPanel div2, final DivElement[] notes)
{
	Timer t = new Timer()
	{
		int i = 0;
		final int last = notes.length;

		@Override
		public void run()
		{
			if (i >= last)
				this.cancel();
			else
				div2.getElement().appendChild(notes[i++]);
		}
	};
	// Eye candy
	t.scheduleRepeating(10);
}
 
Example 10
Project: che   File: PerspectiveViewImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Tunes bottom splitter. Makes it tiny but with a transparent area for easy resizing.
 *
 * @param el element to tune
 */
private void tuneBottomSplitter(Element el) {
  /** Add Z-Index to move the splitter on the top and make content visible */
  el.getParentElement().getStyle().setProperty("zIndex", "1000");
  el.getParentElement().getStyle().setProperty("overflow", "visible");

  el.getStyle().setProperty("height", "4px");
  el.getStyle().setProperty("marginTop", "-2px");
  el.getStyle().setProperty("backgroundColor", "transparent");

  /** Add small border */
  DivElement delimiter = Document.get().createDivElement();
  delimiter.getStyle().setProperty("position", "absolute");
  delimiter.getStyle().setProperty("width", "100%");
  delimiter.getStyle().setProperty("height", "1px");
  delimiter.getStyle().setProperty("left", "0px");
  delimiter.getStyle().setProperty("top", "2px");
  delimiter.getStyle().setProperty("backgroundColor", Style.theme.tabBorderColor());
  el.appendChild(delimiter);
}
 
Example 11
Project: che   File: SplitEditorPartViewImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Tunes splitter. Makes it wider and adds double border to seem rich.
 *
 * @param el element to tune
 */
private void tuneVerticalSplitter(Element el) {
  /** Add Z-Index to move the splitter on the top and make content visible */
  el.getParentElement().getStyle().setProperty("zIndex", "1000");
  el.getParentElement().getStyle().setProperty("overflow", "visible");

  /** Tune splitter catch panel */
  el.getStyle().setProperty("boxSizing", "border-box");
  el.getStyle().setProperty("width", "5px");
  el.getStyle().setProperty("overflow", "hidden");
  el.getStyle().setProperty("marginLeft", "-3px");
  el.getStyle().setProperty("backgroundColor", "transparent");

  /** Add small border */
  DivElement smallBorder = Document.get().createDivElement();
  smallBorder.getStyle().setProperty("position", "absolute");
  smallBorder.getStyle().setProperty("width", "1px");
  smallBorder.getStyle().setProperty("height", "100%");
  smallBorder.getStyle().setProperty("left", "3px");
  smallBorder.getStyle().setProperty("top", "0px");
  smallBorder.getStyle().setProperty("backgroundColor", Style.getSplitterSmallBorderColor());
  el.appendChild(smallBorder);
}
 
Example 12
Project: che   File: SplitEditorPartViewImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Tunes bottom splitter. Makes it tiny but with a transparent area for easy resizing.
 *
 * @param el element to tune
 */
private void tuneHorizontalSplitter(Element el) {
  /** Add Z-Index to move the splitter on the top and make content visible */
  el.getParentElement().getStyle().setProperty("zIndex", "1000");
  el.getParentElement().getStyle().setProperty("overflow", "visible");

  el.getStyle().setProperty("height", "3px");
  el.getStyle().setProperty("marginTop", "-2px");
  el.getStyle().setProperty("backgroundColor", "transparent");

  /** Add small border */
  DivElement delimiter = Document.get().createDivElement();
  delimiter.getStyle().setProperty("position", "absolute");
  delimiter.getStyle().setProperty("width", "100%");
  delimiter.getStyle().setProperty("height", "1px");
  delimiter.getStyle().setProperty("left", "0px");
  delimiter.getStyle().setProperty("backgroundColor", Style.getSplitterSmallBorderColor());
  delimiter.getStyle().setProperty("top", "2px");
  el.appendChild(delimiter);
}
 
Example 13
Project: che   File: HotKeysDialogPresenter.java   Source Code and License 6 votes vote down vote up
private static Element wrapHotKey(String hotKey, String description, boolean global) {
  final DivElement containerDiv = Document.get().createDivElement();
  final DivElement hotKeyDiv = Document.get().createDivElement();
  final DivElement descriptionDiv = Document.get().createDivElement();

  hotKeyDiv.setInnerText(hotKey);
  descriptionDiv.setInnerText(description);

  containerDiv.setClassName("divRow");
  hotKeyDiv.setClassName("divCell");
  hotKeyDiv.addClassName("hotKey");
  descriptionDiv.setClassName("divCell");
  descriptionDiv.addClassName("description");

  containerDiv.appendChild(hotKeyDiv);
  containerDiv.appendChild(descriptionDiv);

  return containerDiv;
}
 
Example 14
Project: che   File: ItemsList.java   Source Code and License 6 votes vote down vote up
ItemWidget(MenuItem item) {
  this.item = item;

  addStyleName(resources.css().popupItem());

  final Element itemLabel = Document.get().createDivElement();
  itemLabel.setInnerText(item.getName());
  itemLabel.getStyle().setFloat(Style.Float.LEFT);

  getElement().appendChild(itemLabel);

  if (dataProvider.isGroup(item)) {
    DivElement arrow = Document.get().createDivElement();
    arrow.setInnerHTML(FontAwesome.PLAY);
    arrow.addClassName(resources.css().arrow());
    getElement().appendChild(arrow);
  }

  attachEventHandlers();
}
 
Example 15
Project: che   File: DefaultPresentationRenderer.java   Source Code and License 6 votes vote down vote up
private Element createInfoTextElement(NodePresentation presentation) {
  DivElement textElement = Document.get().createDivElement();

  StringBuilder sb = new StringBuilder();

  if (presentation.getInfoTextWrapper() != null) {
    sb.append(presentation.getInfoTextWrapper().first);
  }

  if (!Strings.isNullOrEmpty(presentation.getInfoText())) {
    sb.append(presentation.getInfoText());
  }

  if (presentation.getInfoTextWrapper() != null) {
    sb.append(presentation.getInfoTextWrapper().second);
  }

  textElement.setInnerText(sb.toString());
  textElement.setAttribute("style", presentation.getInfoTextCss());

  // TODO support text colorization

  return textElement;
}
 
Example 16
Project: appformer   File: RestrictedMousePanMediatorTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testSetCursor() {

    final Viewport viewport = mock(Viewport.class);
    final DivElement divElement = mock(DivElement.class);
    final Style.Cursor cursor = mock(Style.Cursor.class);
    final Style style = mock(Style.class);

    doReturn(style).when(divElement).getStyle();
    doReturn(divElement).when(viewport).getElement();
    doReturn(viewport).when(mediator).getLayerViewport();

    mediator.setCursor(cursor);

    verify(style).setCursor(cursor);
}
 
Example 17
Project: appformer   File: RestrictedMousePanMediatorTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testHandleEventMouseDownDisabledFilter() throws Exception {
    final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);
    final IEventFilter iEventFilter = mock(IEventFilter.class);

    doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(false).when(iEventFilter).isEnabled();

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(viewport).when(mediator).getViewport();
    doReturn(iEventFilter).when(mediator).getEventFilter();

    mediator.handleEvent(downEvent);

    verify(mediator).onMouseDown(eq(downEvent));
}
 
Example 18
Project: appformer   File: RestrictedMousePanMediatorTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testHandleEventMouseDownEnabledFilterTestPassed() throws Exception {
    final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);
    final IEventFilter iEventFilter = mock(IEventFilter.class);

    doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(true).when(iEventFilter).isEnabled();
    doReturn(true).when(iEventFilter).test(any());

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(viewport).when(mediator).getViewport();
    doReturn(iEventFilter).when(mediator).getEventFilter();

    mediator.handleEvent(downEvent);

    verify(mediator).onMouseDown(eq(downEvent));
}
 
Example 19
Project: appformer   File: RestrictedMousePanMediatorTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testHandleEventMouseDownEnabledFilterTestNotPassed() throws Exception {
    final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);
    final IEventFilter iEventFilter = mock(IEventFilter.class);

    doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(true).when(iEventFilter).isEnabled();
    doReturn(false).when(iEventFilter).test(any());

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(viewport).when(mediator).getViewport();
    doReturn(iEventFilter).when(mediator).getEventFilter();

    mediator.handleEvent(downEvent);

    verify(mediator,
           never()).onMouseDown(any(NodeMouseDownEvent.class));
}
 
Example 20
Project: appformer   File: RestrictedMousePanMediatorTest.java   Source Code and License 6 votes vote down vote up
@Test
public void testHandleEventMouseUpDragging() throws Exception {
    final NodeMouseUpEvent upEvent = mock(NodeMouseUpEvent.class);
    final DivElement element = mock(DivElement.class);
    final Style style = mock(Style.class);
    final Viewport viewport = mock(Viewport.class);

    doReturn(NodeMouseUpEvent.getType()).when(upEvent).getAssociatedType();

    doReturn(style).when(element).getStyle();

    doReturn(element).when(viewport).getElement();

    doReturn(viewport).when(mediator).getLayerViewport();
    doReturn(true).when(mediator).isDragging();

    mediator.handleEvent(upEvent);

    verify(mediator).onMouseUp(eq(upEvent));
    verify(mediator).cancel();
}
 
Example 21
Project: appformer   File: PerspectivesExplorerView.java   Source Code and License 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 22
Project: dashbuilder   File: PerspectivesExplorerView.java   Source Code and License 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 23
Project: hexa.tools   File: HexaDemo.java   Source Code and License 6 votes vote down vote up
public Form()
{
	snip.addElement( "DATABINDING" );
	snip.addElement( "PERSISTENCE" );
	
	DivElement main = Document.get().createDivElement();
	
	main.setInnerHTML( snip.getSnip() );
	
	addDomHandler( new ClickHandler()
	{
		@Override
		public void onClick( ClickEvent event )
		{
			if( event.getNativeEvent().getEventTarget() == dataBinding.cast() )
				Window.alert( "Data Binding !" );
			if( event.getNativeEvent().getEventTarget() == persistence.cast() )
				Window.alert( "Persistence !" );
		}
	}, ClickEvent.getType() );
}
 
Example 24
Project: putnami-web-toolkit   File: InputDatePicker.java   Source Code and License 6 votes vote down vote up
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 25
Project: putnami-web-toolkit   File: Carousel.java   Source Code and License 6 votes vote down vote up
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 26
Project: rva   File: UiControlBinder.java   Source Code and License 6 votes vote down vote up
private void addImages() {
		if (!getValue(currentSettings, ManageSettingsInfo.LOGO_TARGET_URL).isEmpty())
			logoLink.setHref(getValue(currentSettings, ManageSettingsInfo.LOGO_TARGET_URL));

		if (!getValue(currentSettings, ManageSettingsInfo.LOGO_URL).isEmpty()) {
			DivElement div = createImageDiv(getValue(currentSettings, ManageSettingsInfo.LOGO_URL), ManageSettingsInfo.LOGO_WIDTH, ManageSettingsInfo.LOGO_HEIGHT);
			logoLink.getElement().appendChild(div);
		}
		logoContainer.appendChild(logoLink.getElement());
		
//		if (!getValue(currentSettings, ManageSettingsInfo.BANNER_URL).isEmpty()) {
//			DivElement div = createImageDiv(getValue(currentSettings, ManageSettingsInfo.BANNER_URL), ManageSettingsInfo.BANNER_WIDTH, ManageSettingsInfo.BANNER_HEIGHT);
//			bannerContainer.appendChild(div);
//		}
		
		if (!getValue(currentSettings, ManageSettingsInfo.BANNER_BACKGROUND_COLOR).isEmpty())
			topTable.getStyle().setProperty("background", getValue(currentSettings, ManageSettingsInfo.BANNER_BACKGROUND_COLOR));
	}
 
Example 27
Project: vaadin7-console-addon   File: TextConsole.java   Source Code and License 6 votes vote down vote up
private void updateFontDimensions() {

		// Test element for font size
		DivElement test = Document.get().createDivElement();
		test.setAttribute("style", "position: absolute;");
		test.setInnerHTML("X");
		term.appendChild(test);

		fontW = test.getClientWidth();
		fontH = test.getClientHeight();
		if (fontW <= 0 || fontW > 100) {
			fontW = test.getOffsetWidth();
		}
		if (fontH <= 0 || fontH > 100) {
			fontH = test.getOffsetHeight();
		}
		if (fontW <= 0 || fontW > 100) {
			fontW = 1;
		}
		if (fontH <= 0 || fontH > 100) {
			fontH = 1;
		}
		term.removeChild(test);
	}
 
Example 28
Project: gantt   File: GanttWidget.java   Source Code and License 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 29
Project: gantt   File: TimelineWidget.java   Source Code and License 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 30
Project: gantt   File: TimelineWidget.java   Source Code and License 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 31
Project: incubator-wave   File: CajolerFacade.java   Source Code and License 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 32
Project: swarm   File: TaskList.java   Source Code and License 6 votes vote down vote up
public TaskRow(Element parentElem, Task data) {
  super(parentElem);
  this.data = data;
  Element myElem = getElement();
  TaskList.Css css = resources.taskListCss();
  myElem.setClassName(css.taskRow());
  titleElem = Document.get().createDivElement();
  titleElem.setClassName(css.title());
  DivElement rightMask = Document.get().createDivElement();
  rightMask.setClassName(css.checkBoxContainer());
  checkMark = Document.get().createDivElement();
  rightMask.appendChild(checkMark);

  myElem.appendChild(titleElem);
  myElem.appendChild(rightMask);

  renderTask();

  hookEventListeners();
}
 
Example 33
Project: touchkit   File: VSwitch.java   Source Code and License 6 votes vote down vote up
/**
 * The constructor should first call super() to initialize the component and
 * then handle any initialization relevant to Vaadin.
 */
public VSwitch() {
    // Change to proper element or remove if extending another widget
    setElement(Document.get().createDivElement());

    DivElement el = Document.get().createDivElement();
    el.addClassName(CLASSNAME + "-wrapper");

    mainElement = Document.get().createDivElement();
    // This method call of the Paintable interface sets the component
    // style name in DOM tree
    mainElement.setClassName(CLASSNAME);
    el.appendChild(mainElement);
    getElement().appendChild(el);

    // build the DOM
    slider = Document.get().createDivElement();
    slider.setClassName(CLASSNAME + "-slider");
    mainElement.appendChild(slider);
    updateVisibleState(true); // Set the initial position without animation.

    addHandlers();
}
 
Example 34
Project: touchkit   File: VerticalComponentGroupWidget.java   Source Code and License 6 votes vote down vote up
public final boolean setCaption(String caption, Icon icon,
        String captionStyleName) {
    DivElement captionElement = getFirstChildElement().cast();

    boolean hasIcon = icon != null;
    boolean needsCaption = hasIcon
            || (caption != null && !caption.isEmpty());

    if (needsCaption) {
        String captionHtml = hasIcon ? icon.getElement().getString()
                : "";
        captionHtml += caption == null ? "" : caption;
        captionElement.setInnerHTML(captionHtml);
        captionElement.getStyle().setProperty("display", null);
        // copy v-caption prefixed styles from widget to caption
        captionElement.setClassName(captionStyleName);
        setClassName(ROW_CLASSNAME + " " + ROW_WITH_CAPTION_STYLENAME);
    } else {
        setClassName(ROW_CLASSNAME + " "
                + ROW_WITHOUT_CAPTION_STYLENAME);
    }
    return needsCaption;
}
 
Example 35
Project: touchkit   File: VerticalComponentGroupWidget.java   Source Code and License 6 votes vote down vote up
@Override
public boolean remove(Widget widget) {
    if (!widgets.contains(widget)) {
        return false;
    }
    DivElement element = getWidgetWrapper(widget);

    boolean ret = super.remove(widget);

    if (ret) {
        element.removeFromParent();
        widgets.remove(widget);
    }

    return ret;
}
 
Example 36
Project: empiria.player   File: InlineBodyGenerator.java   Source Code and License 5 votes vote down vote up
private Widget generateBody(Node mainNode, boolean nodeChildrens) {
    DivElement div = Document.get().createDivElement();
    Document.get().getBody().appendChild(div);
    Widget inlineHtml = InlineHTML.wrap(div);
    // after wrapping, div is removed from main body
    Document.get().getBody().removeChild(div);
    inlineHtml.setStyleName(styleNames.QP_TEXT_INLINE());
    if (nodeChildrens) {
        parseXML(mainNode.getChildNodes(), inlineHtml.getElement());
    } else {
        parseNode(mainNode, inlineHtml.getElement());
    }
    return inlineHtml;
}
 
Example 37
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License 5 votes vote down vote up
/**
 * Left sidebar with thumbnail, outline and attachments.

  <div id="sidebarContainer">
    <div id="toolbarSidebar">
      <div class="splitToolbarButton toggled">
        <button id="viewThumbnail" class="toolbarButton toggled" title="Show Thumbnails" tabindex="2" data-l10n-id="thumbs">
           <span data-l10n-id="thumbs_label">Thumbnails</span>
        </button>
        <button id="viewOutline" class="toolbarButton" title="Show Document Outline (double-click to expand/collapse all items)" tabindex="3" data-l10n-id="document_outline">
           <span data-l10n-id="document_outline_label">Document Outline</span>
        </button>
        <button id="viewAttachments" class="toolbarButton" title="Show Attachments" tabindex="4" data-l10n-id="attachments">
           <span data-l10n-id="attachments_label">Attachments</span>
        </button>
      </div>
    </div>
    <div id="sidebarContent">
      <div id="thumbnailView">
      </div>
      <div id="outlineView" class="hidden">
      </div>
      <div id="attachmentsView" class="hidden">
      </div>
    </div>
  </div>  <!-- sidebarContainer -->
 *
 */
private void createSidebar(Document document, DivElement parent) {
	sidebarContainer = createChildDiv(document, parent, "sidebarContainer");
	// create sidebar toolbar
	toolbarSidebar = createChildDiv(document, sidebarContainer, "toolbarSidebar");
	DivElement splitToolbarButton = createChildDiv(document, toolbarSidebar, "splitToolbarButton");
	viewThumbnail = createChildButton(document, splitToolbarButton, "viewThumbnail");
	viewThumbnail.setTabIndex(2);
	viewThumbnail.addClassName("toolbarButton");
	viewThumbnail.setTitle("Show Thumbnails");

	viewOutline = createChildButton(document, splitToolbarButton, "viewOutline");
	viewOutline.setTabIndex(3);
	viewOutline.addClassName("toolbarButton");
	viewOutline.setTitle("Show Document Outline (double-click to expand/collapse all items)");

	viewAttachments = createChildButton(document, splitToolbarButton, "viewAttachments");
	viewAttachments.setTabIndex(4);
	viewAttachments.addClassName("toolbarButton");
	viewAttachments.setTitle("Show Attachments");

	// create sidebar content
	sidebarContent = createChildDiv(document, sidebarContainer, "sidebarContent");
	thumbnailView = createChildDiv(document, sidebarContent, "thumbnailView");
	outlineView = createChildDiv(document, sidebarContent, "outlineView");
	outlineView.addClassName("hidden");
	attachmentsView = createChildDiv(document, sidebarContent, "attachmentsView");
	attachmentsView.addClassName("hidden");
}
 
Example 38
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License 5 votes vote down vote up
private void createMainToolbar(Document document, DivElement mainContainer) {
	toolbar = createChildDiv(document, mainContainer, "toolbar");
	toolbarContainer = createChildDiv(document, toolbar, "toolbarContainer");
	toolbarViewer = createChildDiv(document, toolbarContainer, "toolbarViewer");
	toolbarViewerLeft = createChildDiv(document, toolbarViewer, "toolbarViewerLeft");

	sidebarToggleBtn = createChildButton(document, toolbarViewerLeft, "sidebarToggle");
	sidebarToggleBtn.addClassName("toolbarButton");
	sidebarToggleBtn.setTabIndex(11);

	toolbarButtonSpacer = createChildDiv(document, toolbarViewerLeft, "toolbarButtonSpacer");

	viewFind = createChildDiv(document, toolbarViewerLeft, "viewFind");
	viewFind.addClassName("toolbarButton");
	viewFind.setTabIndex(12);
	viewFind.setTitle("Find in Document");

	//paging - previous, next, current page number, jump and all pages
	createPagingSection(document, toolbarViewerLeft);

	toolbarViewerMiddle = createChildDiv(document, toolbarViewer, "toolbarViewerMiddle");
	createZoomingSection(document, toolbarViewerLeft);

	toolbarViewerRight = createChildDiv(document, toolbarViewer, "toolbarViewerRight");
	DivElement verticalToolbarSeparator = createChildDiv(document, toolbarViewerRight, "verticalToolbarSeparator");
	verticalToolbarSeparator.addClassName("hiddenSmallView");

	secondaryToolbarToggle = createChildButton(document, toolbarViewerRight, "secondaryToolbarToggle");
	secondaryToolbarToggle.addClassName("toolbarButton");
	secondaryToolbarToggle.setTitle("Tools");
	secondaryToolbarToggle.setTabIndex(36);
}
 
Example 39
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License 5 votes vote down vote up
/**
 * 
   <div class="splitToolbarButton hiddenSmallView">
     <button class="toolbarButton pageUp" title="Previous Page" id="previous" tabindex="13" data-l10n-id="previous">
       <span data-l10n-id="previous_label">Previous</span>
     </button>
     <div class="splitToolbarButtonSeparator"></div>
     <button class="toolbarButton pageDown" title="Next Page" id="next" tabindex="14" data-l10n-id="next">
       <span data-l10n-id="next_label">Next</span>
     </button>
   </div>
   <input type="number" id="pageNumber" class="toolbarField pageNumber" title="Page" value="1" size="4" min="1" tabindex="15" data-l10n-id="page">
   <span id="numPages" class="toolbarLabel"></span>
 * 
 */
private void createPagingSection(Document document, DivElement parent) {
	DivElement splitToolbarButton = createChildDiv(document, parent, "splitToolbarButton");
	splitToolbarButton.addClassName("hiddenSmallView");

	previousPage = createChildButton(document, splitToolbarButton, "pageUp");
	previousPage.addClassName("toolbarButton");
	previousPage.setTabIndex(13);
	previousPage.setTitle("Previous Page");

	createChildDiv(document, splitToolbarButton, "splitToolbarButtonSeparator");

	nextPage = createChildButton(document, splitToolbarButton, "pageDown");
	nextPage.addClassName("toolbarButton");
	nextPage.setTabIndex(14);
	nextPage.setTitle("Next Page");

	pageNumber = createChildNumber(document, splitToolbarButton, "pageNumber");
	pageNumber.addClassName("toolbarField");
	pageNumber.setTitle("Page");
	pageNumber.setValue("1");
	pageNumber.setSize(4);
	pageNumber.setAttribute("min", "1");
	pageNumber.setTabIndex(15);

	numPages = createChildSpan(document, splitToolbarButton, "numPages");
	numPages.addClassName("toolbarLabel");
}
 
Example 40
Project: wt-pdf-viewer   File: WTPdfViewerWidget.java   Source Code and License 5 votes vote down vote up
private void createDocumentPropertiesOverlay(Document document, DivElement parent) {
	documentPropertiesOverlay = createChildDiv(document, parent, "documentPropertiesOverlay");
	documentPropertiesOverlay.addClassName("container");
	documentPropertiesOverlay.addClassName("hidden");

	DivElement dialog = createChildDiv(document, documentPropertiesOverlay, "dialog");
	fileNameField = addDocumentPropertiesRow(document, dialog, "File name:");
	fileSizeField = addDocumentPropertiesRow(document, dialog, "File size:");

	createChildDiv(document, dialog, "separator");

	titleField = addDocumentPropertiesRow(document, dialog, "Title:");
	authorField = addDocumentPropertiesRow(document, dialog, "Author:");
	subjectField = addDocumentPropertiesRow(document, dialog, "Subject:");
	keywordsField = addDocumentPropertiesRow(document, dialog, "Keywords:");
	creationDateField = addDocumentPropertiesRow(document, dialog, "Creation Date:");
	modificationDateField = addDocumentPropertiesRow(document, dialog, "Modification Date:");
	creatorField = addDocumentPropertiesRow(document, dialog, "Creator:");

	createChildDiv(document, dialog, "separator");

	producerField = addDocumentPropertiesRow(document, dialog, "PDF Producer:");
	versionField = addDocumentPropertiesRow(document, dialog, "PDF Version:");
	pageCountField = addDocumentPropertiesRow(document, dialog, "Page Count:");

	DivElement buttonRow = createChildDiv(document, dialog, "buttonRow");
	documentPropertiesClose = createChildButton(document, buttonRow, "documentPropertiesClose");
	documentPropertiesClose.addClassName("overlayButton");
	documentPropertiesClose.setInnerText("Close");

}