com.google.gwt.dom.client.TableRowElement Java Examples

The following examples show how to use com.google.gwt.dom.client.TableRowElement. 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: CubaTableDragSourceExtensionConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
private List<String> getDraggedRows(NativeEvent dragStartEvent) {
    List<String> draggedRows = new ArrayList<>();

    if (TableRowElement.is(dragStartEvent.getEventTarget())) {
        TableRowElement row = dragStartEvent.getEventTarget().cast();

        TableWidget tableWidget = getTableWidget();
        if (tableWidget == null) {
            draggedRows.add(String.valueOf(row.getSectionRowIndex()));
            return draggedRows;
        }

        if (isRowSelected(row)) {
            return getAllVisibleSelectedRows();
        }

        draggedRows.add(getDraggedRowKey(row));
    }

    return draggedRows;
}
 
Example #2
Source File: CubaTableDragSourceExtensionConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected boolean isRowSelected(TableRowElement row) {
    TableWidget tableWidget = getTableWidget();
    if (tableWidget == null) {
        return false;
    }

    List<Widget> rows = tableWidget.getRenderedRows();

    for (Widget w : rows) {
        TableRowElement rowElement = w.getElement().cast();
        if (rowElement.equals(row)
                && ((VScrollTableRow) w).isSelected()) {

            return true;
        }
    }
    return false;
}
 
Example #3
Source File: CubaTableDragSourceExtensionConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected String getDraggedRowKey(TableRowElement row) {
    TableWidget tableWidget = getTableWidget();
    if (tableWidget != null) {
        for (Widget w : tableWidget.getRenderedRows()) {
            TableRowElement rowElement = w.getElement().cast();
            if (rowElement.equals(row)) {
                return ((VScrollTableRow) w).getKey();
            }
        }
    }
    return null;
}
 
Example #4
Source File: TableHead.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Container ensureAspectRow(String aspectClass) {
	Container row = this.aspectRows.get(aspectClass);
	if (row == null) {
		row = new Container(TableRowElement.TAG);
		this.aspectRows.put(aspectClass, row);
		row.setVisible(false);
		for (int i = 0; i < this.headerRow.getWidgetCount() - 1; i++) {
			row.append(new TableTH<>());
		}
		this.append(row);
	}
	return row;
}
 
Example #5
Source File: FinderColumn.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void toggleRowLevelTools(Disclose fn) {

        int row = cellTable.getKeyboardSelectedRow();
        if (row < cellTable.getRowCount()) {
            TableRowElement rowElement = cellTable.getRowElement(row);
            if (rowElement != null) {
                if(!fn.isDisclosed()) {
                    rowElement.addClassName("nav-hover");
                } else {
                    rowElement.removeClassName("nav-hover");
                }
            }
        }
    }
 
Example #6
Source File: InputDatePicker.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
public InputDatePicker() {
	super(Document.get().createDivElement());

	StyleUtils.addStyle(this, InputDatePicker.STYLE_DATEPICKER);

	this.getElement().appendChild(this.datepickerHeader);
	StyleUtils.addStyle(this.datepickerHeader, InputDatePicker.STYLE_HEADER);

	/* month selecter */
	this.datepickerHeader.appendChild(this.monthPickerButton);
	StyleUtils.addStyle(this.monthPickerButton, InputDatePicker.STYLE_MONTH_PICKER_BUTTON);

	/* pagination */
	this.datepickerHeader.appendChild(this.monthPagerUl);
	StyleUtils.addStyle(this.monthPagerUl, InputDatePicker.STYLE_MONTH_PAGER);
	this.createLi(this.pagePreviusMonthLi, InputDatePicker.STYLE_MONTH_PREVIOUS, "&#9668;");
	this.createLi(this.pageTodayLi, InputDatePicker.STYLE_TODAY, "&#9673;");
	this.createLi(this.pageNextMonthLi, InputDatePicker.STYLE_MONTH_NEXT, "&#9658;");

	this.monthPagerUl.appendChild(this.pagePreviusMonthLi);
	this.monthPagerUl.appendChild(this.pageTodayLi);
	this.monthPagerUl.appendChild(this.pageNextMonthLi);

	/* Calendar Picker */
	this.getElement().appendChild(this.monthPicker);
	this.monthPicker.appendChild(this.monthPickerInner);
	StyleUtils.addStyle(this.monthPicker, InputDatePicker.STYLE_MONTH_PICKER);

	/* Calendar Picker */
	this.getElement().appendChild(this.calendarTable);
	StyleUtils.addStyle(this.calendarTable, InputDatePicker.STYLE_CALENDAR_PICKER);

	/* DayPicker Header */
	TableSectionElement head = Document.get().createTHeadElement();
	TableRowElement headRow = Document.get().createTRElement();
	this.calendarTable.appendChild(head);
	head.appendChild(headRow);
	for (int i = 0; i < 7; i++) {
		TableCellElement th = Document.get().createTHElement();
		headRow.appendChild(th);
		int dayToDisplay = (i + InputDatePicker.DATE_TIME_FORMAT_INFO.firstDayOfTheWeek()) % InputDatePicker.DAYS.length;
		th.setInnerText(InputDatePicker.DAYS[dayToDisplay]);
	}
	/* DayPicker Body */
	this.calendarTable.appendChild(this.calendatBody);

	this.today = InputDatePicker.ATTRIBUTE_DATE_FORMAT.parse(InputDatePicker.ATTRIBUTE_DATE_FORMAT.format(new Date()));
	this.setValue(this.today);

	Event.sinkEvents(this.getElement(), Event.ONKEYDOWN);
	Event.sinkEvents(this.monthPickerButton, Event.ONCLICK);
	Event.sinkEvents(this.pagePreviusMonthLi, Event.ONCLICK);
	Event.sinkEvents(this.pageTodayLi, Event.ONCLICK);
	Event.sinkEvents(this.pageNextMonthLi, Event.ONCLICK);

	this.redraw();
}
 
Example #7
Source File: InputDatePicker.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void redrawCalendarPicker() {
	this.monthPicker.getStyle().setDisplay(Display.NONE);
	this.calendarTable.getStyle().clearDisplay();

	this.calendatBody.removeAllChildren();

	int firstDayOfWeek = InputDatePicker.DATE_TIME_FORMAT_INFO.firstDayOfTheWeek();
	int lastDayOfWeek = (firstDayOfWeek + InputDatePicker.DAYS_IN_WEEK) % InputDatePicker.DAYS_IN_WEEK;

	/* Display month */
	this.monthPickerButton.setInnerHTML(InputDatePicker.MONTH_YEAR_FORMAT.format(this.cursor)
		+ "<span class=\"caret\"></span>");

	Date lastMonth = new Date(this.cursor.getTime());
	CalendarUtil.addMonthsToDate(lastMonth, -1);
	this.pagePreviusMonthLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
		.format(lastMonth));
	this.pageTodayLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
		.format(this.today));
	Date nextMonth = new Date(this.cursor.getTime());
	CalendarUtil.addMonthsToDate(nextMonth, 1);
	this.pageNextMonthLi.setAttribute(InputDatePicker.ATTRIBUTE_DATA_CURSOR, InputDatePicker.ATTRIBUTE_DATE_FORMAT
		.format(nextMonth));

	/* Draw daypicker */
	Date dateToDrow = new Date(this.cursor.getTime());
	int selectedMonth = dateToDrow.getMonth();
	int firstMonthToDisplay = (selectedMonth + 11) % 12;
	int lastMonthToDisplay = (selectedMonth + 13) % 12;
	do {
		CalendarUtil.addDaysToDate(dateToDrow, -1);
	} while (firstMonthToDisplay != dateToDrow.getMonth() || dateToDrow.getDay() != firstDayOfWeek);

	// drow calendarTable
	TableRowElement headRow = null;
	while (dateToDrow.getMonth() != lastMonthToDisplay || dateToDrow.getDay() != lastDayOfWeek
		|| dateToDrow.getDate() == 1 && dateToDrow.getDay() == firstDayOfWeek) {
		if (headRow == null || dateToDrow.getDay() == firstDayOfWeek) {
			headRow = Document.get().createTRElement();
			this.calendatBody.appendChild(headRow);
		}
		TableCellElement td = Document.get().createTDElement();
		headRow.appendChild(td);
		DivElement div = Document.get().createDivElement();
		td.appendChild(div);
		div.setInnerText(String.valueOf(dateToDrow.getDate()));
		div.setAttribute(InputDatePicker.ATTRIBUTE_DATA_DATE, InputDatePicker.ATTRIBUTE_DATE_FORMAT.format(dateToDrow));
		if (dateToDrow.getMonth() != selectedMonth) {
			StyleUtils.addStyle(td, InputDatePicker.STYLE_MUTED);
		}
		if (dateToDrow.equals(this.cursor)) {
			StyleUtils.addStyle(td, InputDatePicker.STYLE_SELECTED);
		}
		if (this.today.equals(dateToDrow)) {
			StyleUtils.addStyle(td, InputDatePicker.STYLE_TODAY);
		}
		Event.sinkEvents(div, Event.ONCLICK);

		CalendarUtil.addDaysToDate(dateToDrow, 1);
	}
}
 
Example #8
Source File: TableRow.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TableRow() {
	super(TableRowElement.TAG);
}