Examples of PElement


Examples of com.ponysdk.ui.server.basic.PElement

        buyPipHead.addStyleName("buy_pip_head");
        final PLabel buyNum = new PLabel("1.22");
        buyNum.addStyleName("buy_num");
        final PFlowPanel buyPipNum = new PFlowPanel();
        buyPipNum.addStyleName("buy_pip_num");
        final PElement buyPipNumStrong = new PElement("strong");
        final PFlowPanel buyDirection = new PFlowPanel();
        buyDirection.addStyleName("buy_direction");
        final PHTML sell = new PHTML("<div></div>");
        sell.addStyleName("sell");
        sell.addClickHandler(new PClickHandler() {

            @Override
            public void onClick(final PClickEvent clickEvent) {
                PNotificationManager.showHumanizedNotification("Sell clicked!");
            }
        });
        final PLabel sellPipHead = new PLabel("offer");
        sellPipHead.addStyleName("sell_pip_head");
        final PLabel sellNum = new PLabel("1.45");
        sellNum.addStyleName("sell_num");
        final PElement sellPipNumStrong = new PElement("strong");
        final PFlowPanel sellPipNum = new PFlowPanel();
        sellPipNum.addStyleName("sell_pip_num");
        final PLabel amtLabel = new PLabel("EUR");
        amtLabel.addStyleName("amtlabel");
        final PFlowPanel sellDirection = new PFlowPanel();
        sellDirection.addStyleName("sell_direction");
        final PLabel spread = new PLabel();
        spread.addStyleName("spread");
        final PTextBox textBox = new PTextBox();
        textBox.setStyleName("input");
        final PAnchor selector = new PAnchor();
        selector.addStyleName("selector");

        box.add(background);
        box.add(headInline);
        headInline.add(icon);
        headInline.add(header);
        headInline.add(close);
        box.add(buy);
        box.add(buyPipHead);
        box.add(buyNum);
        box.add(buyPipNum);
        buyPipNum.add(buyPipNumStrong);
        box.add(buyDirection);
        box.add(sell);
        box.add(sellPipHead);
        box.add(sellNum);
        box.add(sellPipNum);
        sellPipNum.add(sellPipNumStrong);
        box.add(amtLabel);
        box.add(sellDirection);
        box.add(spread);

        box.addDomHandler(new PDragStartHandler() {

            @Override
            public void onDragStart(final PDragStartEvent event) {}
        }, PDragStartEvent.TYPE);

        box.addDomHandler(new PDropHandler() {

            @Override
            public void onDrop(final PDropEvent event) {
                box.removeStyleName("dragenter");
                final PWidget source = event.getDragSource();
                if (source != null && source != box) {
                    final int dropIndex = boxContainer.getWidgetIndex(box);
                    boxContainer.remove(source);
                    boxContainer.insert(source, dropIndex);
                }
            }
        }, PDropEvent.TYPE);

        box.addDomHandler(new PDragEnterHandler() {

            @Override
            public void onDragEnter(final PDragEnterEvent event) {
                if (currentDrag == null || !currentDrag.equals(box)) {
                    box.addStyleName("dragenter");
                    if (currentDrag != null) currentDrag.removeStyleName("dragenter");
                    currentDrag = box;
                }
            }
        }, PDragEnterEvent.TYPE);

        box.addDomHandler(new PDragLeaveHandler() {

            @Override
            public void onDragLeave(final PDragLeaveEvent event) {
                if (!currentDrag.equals(box)) {
                    box.removeStyleName("dragenter");
                }
            }
        }, PDragLeaveEvent.TYPE);

        PPusher.get().addDataListener(new DataListener() {

            private int lastBuy;
            private int lastSell;

            @Override
            public void onData(final Object data) {
                if (data instanceof MarketData) {
                    final MarketData msg = (MarketData) data;
                    final int spreadValue = Math.abs(msg.sell - msg.buy);

                    if (lastBuy < msg.buy) {
                        buyDirection.removeStyleName("down");
                        buyDirection.addStyleName("up");
                    } else {
                        buyDirection.removeStyleName("up");
                        buyDirection.addStyleName("down");
                    }
                    if (lastSell < msg.sell) {
                        sellDirection.removeStyleName("down");
                        sellDirection.addStyleName("up");
                    } else {
                        sellDirection.removeStyleName("up");
                        sellDirection.addStyleName("down");
                    }

                    lastBuy = msg.buy;
                    lastSell = msg.sell;
                    buyPipNumStrong.setInnerText(lastBuy + "");
                    sellPipNumStrong.setInnerText(lastSell + "");
                    spread.setText(spreadValue + "");
                }
            }
        });
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

        super.insert(tbody, 1);
    }

    @Override
    public void insert(final PWidget child, final int beforeIndex) {
        final PElement parentElement = (beforeIndex == 0) ? thead : tbody;
        parentElement.insert(child, beforeIndex);
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

    public void addBodyWidget(final IsPWidget widget, final int column, final int row, final int colspan) {

        if (row < 0) throw new IndexOutOfBoundsException("row (" + row + ") < 0)");
        if (column < 0) throw new IndexOutOfBoundsException("column (" + column + ") < 0)");

        PElement newRow;
        final int maxRowIndex = tbody.getWidgetCount();
        if (row >= maxRowIndex) {
            newRow = new PElement("tr");
            tbody.add(newRow);
        } else {
            newRow = (PElement) tbody.getWidget(row);
        }

        PElement newCell;
        final int maxCellIndex = newRow.getWidgetCount() - 1;
        if (column > maxCellIndex) {
            newCell = new PElement("td");
            newRow.add(newCell);
        } else {
            newCell = (PElement) newRow.getWidget(column);
            newCell.clear();
        }

        newCell.add(widget);
        newCell.addStyleName("pony-PFlextable-Cell");

        if (colspan > 1) newCell.setAttribute("colspan", colspan + "");
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

    public void addHeadWidget(final IsPWidget widget, final int column, final int row, final int colspan) {

        if (row < 0) throw new IndexOutOfBoundsException("row (" + row + ") < 0)");
        if (column < 0) throw new IndexOutOfBoundsException("column (" + column + ") < 0)");

        PElement newRow;
        final int maxRowIndex = thead.getWidgetCount() - 1;
        if (row > maxRowIndex) {
            newRow = new PElement("tr");
            thead.add(newRow);
        } else {
            newRow = (PElement) thead.getWidget(row);
        }

        PElement newCell;
        final int maxCellIndex = newRow.getWidgetCount() - 1;
        if (column > maxCellIndex) {
            newCell = new PElement("th");
            newRow.add(newCell);
        } else {
            newCell = (PElement) newRow.getWidget(column);
            newCell.clear();
        }

        newCell.add(widget);
        newCell.addStyleName("pony-PFlextable-Cell");

        if (colspan > 1) newCell.setAttribute("colspan", colspan + "");
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

        remove(row);
    }

    @Override
    public boolean remove(final int row) {
        final PElement parentElement = (row == 0) ? thead : tbody;
        return parentElement.remove(parentElement.getWidget(row - (row == 0 ? 0 : 1)));
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

    }

    public PElement getRow(final int row) {
        checkRowBound(row);

        final PElement parentElement = (row == 0) ? thead : tbody;

        return (PElement) parentElement.getWidget(row - (row == 0 ? 0 : 1));
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

        return (PElement) parentElement.getWidget(row - (row == 0 ? 0 : 1));
    }

    public PElement getCell(final int row, final int column) {
        final PElement parentElement = (row == 0) ? thead : tbody;

        checkRowBound(row);
        checkColumnBound(column);
        final PElement r = (PElement) parentElement.getWidget(row - (row == 0 ? 0 : 1));
        return (PElement) r.getWidget(column);
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

                return false;
            }

            @Override
            public PElement next() {
                final PElement row = (PElement) tbody.getWidget(index);
                final PElement next = (PElement) row.getWidget(column);
                index++;
                return next;
            }

            @Override
            public void remove() {
                final PElement row = (PElement) tbody.getWidget(index);
                row.remove(index);
                index++;
            }

        };
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

    public void moveRow(final int index, final int beforeIndex) {
        checkRowBound(index);
        checkRowBound(beforeIndex);

        final PElement parentElement = (index == 0) ? thead : tbody;

        final PWidget source = parentElement.getWidget(index - (index == 0 ? 0 : 1));
        parentElement.insert(source, beforeIndex - (beforeIndex == 0 ? 0 : 1));
    }
View Full Code Here

Examples of com.ponysdk.ui.server.basic.PElement

    public void moveColumn(final int index, final int beforeIndex) {
        checkColumnBound(index);
        checkColumnBound(beforeIndex);

        final PElement parentElement = (index == 0) ? thead : tbody;

        for (int r = 0; r < parentElement.getWidgetCount(); r++) {
            final PElement row = (PElement) parentElement.getWidget(r);
            row.insert(row.getWidget(index), beforeIndex);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.