Example usage for com.google.gwt.user.client.ui DockPanel DockPanel

List of usage examples for com.google.gwt.user.client.ui DockPanel DockPanel

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui DockPanel DockPanel.

Prototype

public DockPanel() 

Source Link

Document

Creates an empty dock panel.

Usage

From source file:net.skyesoft.nhs.dka.client.DKA.java

License:Apache License

public void onModuleLoad() {
    // Load all the sinks.
    loadSinks();/*from   w  w w .  jav  a2 s.  c o  m*/

    // Put the sink list on the left, and add the outer dock panel to the
    // root.
    sinkContainer = new DockPanel();
    sinkContainer.setStyleName("ks-Sink");

    ListBox lbStudyNos = new ListBox();

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.add(description);
    vp.add(sinkContainer);
    //vp.add(lbStudyNos);

    description.setStyleName("ks-Info");

    panel.add(list, DockPanel.WEST);
    panel.add(vp, DockPanel.CENTER);
    //panel.add(lbStudyNos, DockPanel.SOUTH);

    panel.setCellVerticalAlignment(list, HasAlignment.ALIGN_TOP);
    panel.setCellWidth(vp, "100%");

    History.addHistoryListener(this);
    RootPanel.get().add(panel);

    // Show the initial screen.
    String initToken = History.getToken();
    if (initToken.length() > 0)
        onHistoryChanged(initToken);
    else
        showInfo();
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationIE6.java

License:Apache License

/**
 * Reflects an image//from   w w w.  j a v  a 2s .  c o m
 */
@Override
public void reflectImage(final NEffectPanel thePanel, final int height, final double opacity, final int gap,
        boolean setUp) {
    final DockPanel container = new DockPanel();
    final Image v = new Image();
    SimplePanel gapPanel;

    Widget w = thePanel.getPanelWidget();
    if (!(w instanceof Image)) {
        w = ((VerticalPanel) w).getWidget(0);
    }

    // For some reason when reloading a page in IE a complete refresh is not
    // made
    // and so this effect is not fired; by adding this load listener overcomes
    // this problem
    // go figure......
    if (!loaded) {
        ((Image) w).addLoadHandler(theIEFix);
        loaded = true;
    } else {
        // ((Image) w).removeLoadHandler(theIEFix);
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML(" "));
    gapPanel.setHeight(gap + "px");

    int imgWidth = w.getOffsetWidth();
    int imgHeight = w.getOffsetHeight();
    int canvasHeight = new Double(imgHeight * height / 100).intValue();

    v.setUrl(((Image) w).getUrl());

    v.getElement().getStyle().setProperty("filter",
            "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (opacity * 100)
                    + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (height * 100)
                    + ")");

    v.setHeight(canvasHeight + "px");
    v.setWidth(imgWidth + "px");

    thePanel.remove(w);

    container.add(w, DockPanel.NORTH);
    container.add(v, DockPanel.SOUTH);
    container.add(gapPanel, DockPanel.CENTER);

    thePanel.add(container);
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationOpera.java

License:Apache License

/**
 * Reflects an image//from w  ww  . j av  a2 s  .c o m
 */
@Override
public void reflectImage(NEffectPanel thePanel, int height, double opacity, int gap, boolean setUp) {

    DockPanel container;
    Widget w;
    Canvas v;
    SimplePanel gapPanel;

    if (setUp) {
        w = (Image) ((DockPanel) thePanel.getPanelWidget()).getWidget(0);
        v = (Canvas) ((DockPanel) thePanel.getPanelWidget()).getWidget(WHERE_IS_REFLECTION);
        v.setSize(1, 1);
        // v = new Canvas();
        container = (DockPanel) thePanel.getPanelWidget();
        // Remove from panel now as this may make any animations look much
        // smoother
        // If not, there is a danger on slow(er) systems that the reflection hangs
        // out from image until re-drawn.
        container.remove(WHERE_IS_REFLECTION);
    } else {
        container = new DockPanel();
        w = getReflectedImage(thePanel, setUp);
        v = new Canvas();
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML(" "));
    gapPanel.setHeight(gap + "px");

    int imgHeight = w.getOffsetHeight();
    int canvasHeight = (int) ((imgHeight * height) / 100);

    reflect(v.getElement(), w.getElement(), canvasHeight, opacity);

    if (setUp) {
        container.add(v, DockPanel.SOUTH);
    } else {
        container.add(w, DockPanel.NORTH);
        container.add(v, DockPanel.SOUTH);
        thePanel.add(container);
    }
    container.add(gapPanel, DockPanel.CENTER);
    container.getElement().getStyle().setProperty("overflow", "hidden");
    //DOM.setElementAttribute(container.getElement(), "overflow", "hidden");
    container.setHeight(imgHeight + canvasHeight + "px");
}

From source file:org.adamtacy.client.ui.effects.impl.browsers.EffectImplementationStandard.java

License:Apache License

/**
 * Reflects an image by creating a DockPanel where the original image is place
 * in the top and a canvas object containing a refection of the original image
 * is placed below. At the moment I can't seem to reuse the original canvas so
 * if any action is performed requiring the reflection to be re-drawn a new
 * canvas object is required (compare that to the Opera version where reuse is
 * possible)/*ww w. j av  a 2  s .c  o m*/
 * 
 * @param gap
 */
public void reflectImage(NEffectPanel thePanel, int height, double opacity, int gap, boolean setUp) {

    DockPanel container;
    Widget w;
    SimplePanel gapPanel;
    Canvas v;

    w = getReflectedImage(thePanel, setUp);
    if (setUp) {
        v = new Canvas();
        container = (DockPanel) thePanel.getPanelWidget();
        // Remove from panel now as this may make any animations look much
        // smoother
        // If not, there is a danger on slow(er) systems that the reflection hangs
        // out from image until re-drawn.
        container.remove(WHERE_IS_REFLECTION);
    } else {
        container = new DockPanel();
        v = new Canvas();
    }

    gapPanel = new SimplePanel();
    gapPanel.setWidth("100%");
    gapPanel.add(new HTML(" "));
    gapPanel.setHeight(gap + "px");

    int imgWidth = w.getOffsetWidth();
    int imgHeight = w.getOffsetHeight();
    int canvasHeight = (int) ((imgHeight * height) / 100);
    v.setSize(imgWidth, canvasHeight);

    reflect(v.getElement(), w.getElement(), canvasHeight, opacity);
    if (setUp) {
        container.add(v, DockPanel.SOUTH);
    } else {
        container.add(w, DockPanel.NORTH);
        container.add(v, DockPanel.SOUTH);
        thePanel.add(container);
    }
    container.add(gapPanel, DockPanel.CENTER);
}

From source file:org.apache.hupa.client.mvp.MainView.java

License:Apache License

@Inject
public MainView(EventBus bus, PagingScrollTableRowDragController controllerProvider, HupaConstants constants,
        HupaMessages messages) {//from   w  w w .j a va  2s .  c om
    this.constants = constants;
    this.messages = messages;
    this.controller = controllerProvider;
    this.bus = bus;
    loader = new Loading(constants.loading());
    newFolderButton = new EnableHyperlink(constants.newFolder(), "");
    renameFolderButton = new EnableHyperlink(constants.renameFolder(), "");
    deleteFolderButton = new EnableHyperlink(constants.deleteFolder(), "");

    dockPanel = new DockPanel();

    dockPanel.setSpacing(10);
    dockPanel.setWidth("100%");

    // Not used so far
    // createNorth();
    // dockPanel.add(north, DockPanel.NORTH);
    // dockPanel.setCellHorizontalAlignment(north, DockPanel.ALIGN_RIGHT);

    createWest();
    dockPanel.add(west, DockPanel.WEST);
    dockPanel.setCellWidth(west, "160px");

    createCenter();
    dockPanel.add(center, DockPanel.CENTER);
    dockPanel.setCellHorizontalAlignment(center, DockPanel.ALIGN_LEFT);

    initWidget(dockPanel);
}

From source file:org.apache.openjpa.trader.client.MatchWindow.java

License:Apache License

public MatchWindow(final OpenTrader session, final Tradable tradable, final List<Match> matches) {
    super(false, true);
    this.session = session;
    setAnimationEnabled(true);/*from   w w  w. j  a  v  a  2 s .  c o m*/

    DockPanel panel = new DockPanel();
    panel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);

    final HTML header = new HTML();
    final boolean ask = (tradable instanceof Ask);
    String txt = (matches.isEmpty() ? "No" : "" + matches.size()) + " matching " + (ask ? "Bid" : "Ask")
            + " for " + toString(tradable) + "<br>";
    header.setHTML(txt);
    header.addStyleName("table-caption");

    Button close = new Button(matches.isEmpty() ? "OK" : "Cancel");
    close.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    FlexTable body = new FlexTable();
    final RadioButton[] buttons = new RadioButton[matches.size()];
    if (!matches.isEmpty()) {
        for (int i = 0; i < matches.size(); i++) {
            Match match = matches.get(i);
            Tradable t2 = ask ? match.getBid() : match.getAsk();
            Trader cpty = ask ? match.getBid().getBuyer() : match.getAsk().getSeller();
            buttons[i] = new RadioButton("matches");
            buttons[i].setValue(i == 0);
            body.setWidget(i, 0, buttons[i]);
            body.setWidget(i, 1, FormatUtil.formatPrice(t2.getPrice()));
            body.setWidget(i, 2, FormatUtil.formatVolume(t2.getVolume()));
            body.setText(i, 3, " by " + cpty.getName());
        }

        Button act = new Button(ask ? "Sell" : "Buy");
        act.setFocus(true);
        body.setWidget(matches.size() + 1, 1, act);
        act.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                for (int i = 0; i < buttons.length; i++) {
                    if (buttons[i].getValue()) {
                        Match match = matches.get(i);
                        Tradable t = ask ? match.getAsk() : match.getBid();
                        session.getService().trade(match, new TradeCallback(t));
                        hide(true);
                    }
                }
            }
        });
        body.setWidget(matches.size() + 1, 2, close);
    } else {
        body.setWidget(0, 0, new HTML("<p>Open a new browser page and login with a different Trader name<br>"
                + "to create a matching " + (ask ? "Bid" : "Ask") + "<p>"));

        close.setFocus(true);
        body.setWidget(1, 0, close);
        body.getFlexCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER,
                HasVerticalAlignment.ALIGN_MIDDLE);
    }

    panel.add(header, DockPanel.NORTH);
    panel.add(body, DockPanel.CENTER);
    setWidget(panel);
}

From source file:org.apache.openjpa.trader.client.ui.MessageBox.java

License:Apache License

private MessageBox() {
    super(false, true);
    setAnimationEnabled(true);//from w  ww .  j a v a2s  .c  o m

    DockPanel panel = new DockPanel();
    panel.setStyleName("messageBox");
    panel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);

    header = new HTML();
    header.addStyleName("messageBox-caption");

    Button close = new Button("OK");
    close.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    close.setEnabled(true);
    close.setFocus(true);

    message = new Label();
    message.addStyleName("messageBox-content");

    panel.add(header, DockPanel.NORTH);
    panel.add(close, DockPanel.SOUTH);
    panel.add(message, DockPanel.CENTER);

    setWidget(panel);
}

From source file:org.cruxframework.crux.widgets.client.dialog.ConfirmDialog.java

License:Apache License

/**
 * Constructor // w  ww .  j a v a2  s . c o m
 */
public ConfirmDialog() {
    dialogBox = new DialogBox(false, true);

    confirmPanel = new DockPanel();
    messageLabel = createMessageLabel();
    confirmPanel.add(messageLabel, DockPanel.CENTER);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(10);
    okButton = createOkButton();
    horizontalPanel.add(okButton);
    cancelButton = createCancelButton();
    horizontalPanel.add(cancelButton);

    if (defaultCloseHandlers != null) {
        for (CloseHandler<ConfirmDialog> closeHandler : defaultCloseHandlers) {
            this.addCloseHandler(closeHandler);
        }
    }

    if (defaultOpenHandlers != null) {
        for (OpenHandler<ConfirmDialog> openHandler : defaultOpenHandlers) {
            this.addOpenHandler(openHandler);
        }
    }

    confirmPanel.add(horizontalPanel, DockPanel.SOUTH);
    confirmPanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);

    dialogBox.add(confirmPanel);
    confirmPanel.getElement().getParentElement().setAttribute("align", "center");

    setStyleName(DEFAULT_STYLE_NAME);
}

From source file:org.cruxframework.crux.widgets.client.dialog.MessageDialog.java

License:Apache License

/**
 * Constructor /*  www  . j a v a 2  s.  co m*/
 */
public MessageDialog() {
    dialogBox = new DialogBox(false, true);

    messagePanel = new DockPanel();
    messageLabel = createMessageLabel();
    messagePanel.add(messageLabel, DockPanel.CENTER);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(10);
    okButton = createOkButton();
    horizontalPanel.add(okButton);

    if (defaultCloseHandlers != null) {
        for (CloseHandler<MessageDialog> closeHandler : defaultCloseHandlers) {
            this.addCloseHandler(closeHandler);
        }
    }

    if (defaultOpenHandlers != null) {
        for (OpenHandler<MessageDialog> openHandler : defaultOpenHandlers) {
            this.addOpenHandler(openHandler);
        }
    }

    messagePanel.add(horizontalPanel, DockPanel.SOUTH);
    messagePanel.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);

    dialogBox.add(messagePanel);
    messagePanel.getElement().getParentElement().setAttribute("align", "center");

    setStyleName(DEFAULT_STYLE_NAME);
    handleOrientationChangeHandlers();
}

From source file:org.cruxframework.crux.widgets.client.rollingpanel.CustomRollingPanel.java

License:Apache License

/**
 * @param vertical/*w w  w.  jav  a  2  s.c o m*/
 */
public CustomRollingPanel() {
    this.layoutPanel = new DockPanel();
    this.itemsScrollPanel = new SimplePanel();

    DOM.setStyleAttribute(this.itemsScrollPanel.getElement(), "overflowX", "hidden");
    DOM.setStyleAttribute(this.itemsScrollPanel.getElement(), "overflowY", "hidden");

    this.layoutPanel.setWidth("100%");
    this.itemsScrollPanel.setWidth("100%");
    this.itemsScrollPanel.setStyleName(DEFAULT_BODY_HORIZONTAL_STYLE_NAME);
    this.itemsPanel = new HorizontalPanel();
    createNavigationButtons();
    this.itemsScrollPanel.add(this.itemsPanel);

    this.layoutPanel.add(this.itemsScrollPanel, DockPanel.CENTER);
    this.layoutPanel.getElement().getStyle().setProperty("tableLayout", "fixed");

    initWidget(layoutPanel);
    setSpacing(0);
    setStyleName(DEFAULT_STYLE_NAME);

    handleWindowResize();

    maybeShowNavigationButtons();
}