Java Code Examples for com.google.gwt.user.client.DOM#createDiv()

The following examples show how to use com.google.gwt.user.client.DOM#createDiv() . 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 check out the related API usage on the sidebar.
Example 1
Source File: CellContainerToDomMapper.java    From jetpad-projectional-open-source with Apache License 2.0 6 votes vote down vote up
public CellContainerToDomMapper(CellContainer source, Element target, boolean eventsDisabled) {
  super(source, target);

  CSS.ensureInjected();
  ensureIndentInjected();

  myLineHighlight1 = DOM.createDiv();
  myLineHighlight1.addClassName(CSS.lineHighlight());
  myLineHighlight1.getStyle().setWidth(100, Style.Unit.PCT);

  myLineHighlight2 = DOM.createDiv();
  myLineHighlight2.addClassName(CSS.lineHighlight());

  myContent = DOM.createDiv();
  myContent.addClassName(CSS.content());

  myCellToDomContext = new CellToDomContext(target, eventsDisabled);
}
 
Example 2
Source File: CubaVerticalSplitPanelWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Element createDockButtonContainer() {
    Element dockBtnContainer = DOM.createDiv();
    dockBtnContainer.getStyle().setZIndex(101);
    dockBtnContainer.getStyle().setPosition(Style.Position.ABSOLUTE);

    if (dockMode == SplitPanelDockMode.TOP) {
        dockBtnContainer.addClassName(SP_DOCK_UP);
    } else if (dockMode == SplitPanelDockMode.BOTTOM) {
        dockBtnContainer.addClassName(SP_DOCK_DOWN);
    }
    return dockBtnContainer;
}
 
Example 3
Source File: MiniProgressBar.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Create a progress bar within the given range starting at the specified
 * progress amount.
 *
 * @param minProgress the minimum progress
 * @param maxProgress the maximum progress
 * @param curProgress the current progress
 * @param textFormatter the text formatter
 */
public MiniProgressBar(double minProgress, double maxProgress,
  double curProgress, TextFormatter textFormatter) {
  this.minProgress = minProgress;
  this.maxProgress = maxProgress;
  this.curProgress = curProgress;
  setTextFormatter(textFormatter);

  // Create the outer shell
  setElement(DOM.createDiv());
  DOM.setStyleAttribute(getElement(), "position", "relative");
  setStyleName("gwt-ProgressBar-shell");

  // Create the bar element
  barElement = DOM.createDiv();
  DOM.appendChild(getElement(), barElement);
  DOM.setStyleAttribute(barElement, "height", "100%");
  setBarStyleName("gwt-ProgressBar-bar");

  // Create the text element
  textElement = DOM.createDiv();
  DOM.appendChild(getElement(), textElement);
  DOM.setStyleAttribute(textElement, "position", "absolute");
  DOM.setStyleAttribute(textElement, "top", "0px");

  //Set the current progress
  setProgress(curProgress);
}
 
Example 4
Source File: CubaHorizontalSplitPanelWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Element createDockButtonContainer() {
    Element dockBtnContainer = DOM.createDiv();
    dockBtnContainer.getStyle().setZIndex(101);
    dockBtnContainer.getStyle().setPosition(Style.Position.ABSOLUTE);

    if (dockMode == SplitPanelDockMode.LEFT) {
        dockBtnContainer.addClassName(SP_DOCK_LEFT);
    } else if (dockMode == SplitPanelDockMode.RIGHT) {
        dockBtnContainer.addClassName(SP_DOCK_RIGHT);
    }
    return dockBtnContainer;
}
 
Example 5
Source File: MockHVLayoutBase.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private void ensureDividerInited() {
  if (dividerElement == null) {
    dividerElement = DOM.createDiv();
    DOM.setStyleAttribute(dividerElement, "backgroundColor", DIVIDER_COLOR);
    setDividerVisible(false);
    DOM.appendChild(container.getRootPanel().getElement(), dividerElement);
  }
}
 
Example 6
Source File: TreeTable.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ItemWidget(int level) {
  this.image = DOM.createSpan();
  this.label = DOM.createSpan();

  Element div = DOM.createDiv();
  div.appendChild(this.image);
  div.appendChild(this.label);

  div.getStyle().setPropertyPx("marginLeft", level * 16);
  image.getStyle().setProperty("verticalAlign", "bottom");

  setElement(div);
}
 
Example 7
Source File: DateCellDayItem.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
public DateCellDayItem(DateCell dateCell, WeekGrid parent, CalendarItem calendarItem) {
    super();
    this.dateCell = dateCell;

    handlers = new LinkedList<>();

    setStylePrimaryName("v-calendar-event");

    setCalendarItem(calendarItem);

    weekGrid = parent;

    Style s = getElement().getStyle();
    if (calendarItem.getStyleName().length() > 0) {
        addStyleDependentName(calendarItem.getStyleName());
    }
    s.setPosition(Position.ABSOLUTE);

    caption = DOM.createDiv();
    caption.addClassName("v-calendar-event-caption");
    getElement().appendChild(caption);

    eventContent = DOM.createDiv();
    eventContent.addClassName("v-calendar-event-content");
    getElement().appendChild(eventContent);

    if (weekGrid.getCalendar().isItemResizeAllowed() && getCalendarItem().isResizeable()) {
        topResizeBar = DOM.createDiv();
        bottomResizeBar = DOM.createDiv();

        topResizeBar.addClassName("v-calendar-event-resizetop");
        bottomResizeBar.addClassName("v-calendar-event-resizebottom");

        getElement().appendChild(topResizeBar);
        getElement().appendChild(bottomResizeBar);
    }

    eventIndex = calendarItem.getIndex();

}
 
Example 8
Source File: MaterialRating.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
/**
 * Default constructor.
 */
public MaterialRating() {
    super(DOM.createDiv(), AddinsCssName.MATERIAL_RATING);
}
 
Example 9
Source File: ViewCellMapper.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
ViewCellMapper(ViewCell source, CellToDomContext ctx) {
  super(source, ctx, DOM.createDiv());
  myViewContainer = new ViewContainer();
}
 
Example 10
Source File: AceEditorWidget.java    From cuba with Apache License 2.0 4 votes vote down vote up
public AceEditorWidget() {
	super(DOM.createDiv());
	this.editorId = nextId();
	this.setStylePrimaryName("AceEditorWidget");
	
}
 
Example 11
Source File: RootCellMapper.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
RootCellMapper(RootCell source, CellToDomContext ctx) {
  super(source, ctx, DOM.createDiv());
}
 
Example 12
Source File: MaterialCheckBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public MaterialCheckBox() {
    super(DOM.createDiv());
    setStyleName(CHECKBOX);
    setAsyncDisplayLoader(new DefaultCheckBoxLoader(this));
    setType(CheckBoxType.FILLED);
}
 
Example 13
Source File: SvgViewMapper.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
public SvgViewMapper(ViewToDomContext ctx, SvgView source) {
  super(ctx, source, DOM.createDiv());
}
 
Example 14
Source File: ScrollViewMapper.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
ScrollViewMapper(ViewToDomContext ctx, ScrollView source) {
  super(ctx, source, DOM.createDiv());
}
 
Example 15
Source File: ClickableDivPanel.java    From swellrt with Apache License 2.0 4 votes vote down vote up
public ClickableDivPanel() {
  this(DOM.createDiv());
}
 
Example 16
Source File: GwtMockitoTest.java    From gwtmockito with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldMockResultsOfStaticDomCreateMethods() {
  com.google.gwt.user.client.Element div = DOM.createDiv();
  when(div.getClassName()).thenReturn("stubClass");
  assertEquals("stubClass", div.getClassName());
}
 
Example 17
Source File: TextWidget.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public TextWidget() {
    super(DOM.createDiv());
}
 
Example 18
Source File: TextViewMapper.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
TextViewMapper(ViewToDomContext ctx, TextView source) {
  super(ctx, source, DOM.createDiv());
}
 
Example 19
Source File: DomCellMapper.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
DomCellMapper(DomCell source, CellToDomContext ctx) {
  super(source, ctx, DOM.createDiv());

  getTarget().addClassName(CellContainerToDomMapper.CSS.domCell());
}
 
Example 20
Source File: TableAggregationRow.java    From cuba with Apache License 2.0 3 votes vote down vote up
protected void addCell(String text, char align, String style, boolean sorted) {
    final TableCellElement td = DOM.createTD().cast();

    final Element container = DOM.createDiv();
    container.setClassName(tableWidget.getStylePrimaryName() + "-cell-wrapper");

    td.setClassName(tableWidget.getStylePrimaryName() + "-cell-content");

    td.addClassName(tableWidget.getStylePrimaryName() + "-aggregation-cell");

    if (style != null && !style.equals("")) {
        td.addClassName(tableWidget.getStylePrimaryName() + "-cell-content-" + style);
    }

    if (sorted) {
        td.addClassName(tableWidget.getStylePrimaryName() + "-cell-content-sorted");
    }

    container.setInnerText(text);

    setAlign(align, container);

    td.appendChild(container);
    tr.appendChild(td);

    Tools.textSelectionEnable(td, tableWidget.isTextSelectionEnabled());
}