Example usage for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

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

Introduction

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

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

From source file:com.jwh.gwt.fasttable.sample.client.FastTableSample.java

License:Open Source License

private void buildRowCountButtons(FlexTable flexTable) {
    flexTable.setWidget(0, 0, new Label());
    flexTable.getFlexCellFormatter().setColSpan(0, 0, 2);
    final String rows10 = "10 sample rows";
    final String rows100 = "100 sample rows";
    final String rows500 = "500 sample rows";
    final String rows1000 = "1000 sample rows";
    final String rowsToBuild = "rowsToBuild";
    final ValueChangeHandler<Boolean> handler = new ValueChangeHandler<Boolean>() {
        @Override//  w w  w. j a v  a  2s . c o  m
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            RadioButton selected = (RadioButton) event.getSource();
            if (rows10.equals(selected.getFormValue())) {
                sampleRowCount = 10;
            } else if (rows100.equals(selected.getFormValue())) {
                sampleRowCount = 100;
            } else if (rows500.equals(selected.getFormValue())) {
                sampleRowCount = 500;
            } else {
                sampleRowCount = 1000;
            }
        }
    };
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows10);
        radio.setValue(false, false);
        radio.setFormValue(rows10);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(1, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(1, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows100);
        radio.setValue(true, false);
        radio.setFormValue(rows100);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(2, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows500);
        radio.setValue(false, false);
        radio.setFormValue(rows500);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(3, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(3, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
    {
        final RadioButton radio = new RadioButton(rowsToBuild);
        radio.setHTML(rows1000);
        radio.setValue(false, false);
        radio.setFormValue(rows1000);
        radio.addValueChangeHandler(handler);
        flexTable.setWidget(4, 0, radio);
        flexTable.getFlexCellFormatter().setColSpan(4, 0, 2);
        radio.getElement().getParentElement().addClassName(BORDER_NONE);
    }
}

From source file:com.konakart.client.ChooseAddrBody.java

License:Open Source License

/**
 * Creates the table to choose an addr. It is populated with the addresses passed in, and the
 * title is changed depending on whether we are choosing the shipping or billing addresses.
 * //from  w  w w  .  ja  va 2  s  .  c o m
 * @param addrArray
 * @param shipping
 */
protected void render(GWT_Address[] addrArray, boolean shipping) {
    // Remove the current panel
    removeFromDom();

    radioList = new ArrayList<RadioButton>();

    this.addrArray = addrArray;

    // Get the container panel
    HTMLPanel containerPanel = getContainerPanel(1);

    // Get the header
    Widget header;
    if (shipping) {
        header = renderHeader(one_page_checkout_choose_shipping_address, "table_background_delivery.gif",
                one_page_checkout_choose_shipping_address);

    } else {
        header = renderHeader(one_page_checkout_choose_billing_address, "table_background_delivery.gif",
                one_page_checkout_choose_billing_address);
    }

    // Add the header to the container panel
    containerPanel.add(header, HEADER_ID);

    int row = 0;
    int colspan = 4;
    FlexTable ft111 = getTable(0, "100%", 0, 2, "body-content-tab");

    ft111.getFlexCellFormatter().setColSpan(row, 0, colspan);
    ft111.setWidget(row++, 0, getVSpacer());

    ft111.getFlexCellFormatter().setColSpan(row, 0, colspan);
    formatCell(ft111, row, 0, null, "left", null, null);
    ft111.setWidget(row++, 0, newAddrLink);

    ft111.getFlexCellFormatter().setColSpan(row, 0, colspan);
    ft111.setWidget(row++, 0, getVSpacer());

    formatCell(ft111, row, 0, null, null, "top", null);
    formatCell(ft111, row, 1, null, null, "top", "50%");
    formatCell(ft111, row, 2, null, "right", "top", "50%");
    formatCell(ft111, row, 3, null, null, "top", null);

    // Col 0
    ft111.setWidget(row, 0, getHSpacer());

    // Col 1
    if (shipping) {
        ft111.setHTML(row, 1, change_delivery_address_body_selectaddr);
    } else {
        ft111.setHTML(row, 1, change_payment_address_body_selectaddr);
    }

    // Col2
    FlexTable t = getTable(0, "100%", 0, 0, "body-content-tab");
    formatCell(t, 0, 0, null, "right", "top", "50%");
    formatCell(t, 1, 0, null, "right", "top", "50%");
    t.setHTML(0, 0, change_payment_address_body_pleaseselect);
    t.setWidget(1, 0, new Image(getImages_folder() + "arrow_east_south.gif"));
    ft111.setWidget(row, 2, t);

    // Col 3
    ft111.setWidget(row++, 3, getHSpacer());

    // Loop through the addresses
    for (int i = 0; i < addrArray.length; i++) {
        GWT_Address addr = addrArray[i];

        // col 0 of ft111
        ft111.setWidget(row, 0, getHSpacer());

        // col 1 - 2 of ft111
        ft111.getFlexCellFormatter().setColSpan(row, 1, 2);
        FlexTable ft1111 = getTable(0, "100%", 0, 2, "body-content-tab");
        ft111.setWidget(row, 1, ft1111);
        /*
         * Row 0 of ft1111
         */
        ft1111.getFlexCellFormatter().setColSpan(0, 1, 2);
        formatCell(ft1111, 0, 0, null, null, "top", "10");
        formatCell(ft1111, 0, 2, null, "right", null, null);
        formatCell(ft1111, 0, 3, null, null, "top", "10");
        // Col 0
        ft1111.setWidget(0, 0, getHSpacer());
        // Col 1-2
        ft1111.setHTML(0, 1, "<b>" + addr.getFirstName() + "&nbsp;" + addr.getLastName() + "</b>");
        RadioButton b = new RadioButton("selAddrGroup");
        if (i == 0) {
            b.setValue(true);
        }
        radioList.add(i, b); // Save the radio button in a list
        // Col 3
        ft1111.setWidget(0, 2, b);
        // Col 4
        ft1111.setWidget(0, 3, getHSpacer());
        /*
         * Row 1 of ft1111
         */
        ft1111.getFlexCellFormatter().setColSpan(0, 1, 3);
        formatCell(ft1111, 0, 0, null, null, "top", "10");
        formatCell(ft1111, 0, 2, null, null, "top", "10");

        // Col 0
        ft1111.setWidget(1, 0, getHSpacer());
        // Col 1-3
        FlexTable t1 = getTable(0, "100%", 0, 2, "body-content-tab");
        formatCell(t1, 0, 0, null, null, "top", "10");
        formatCell(t1, 0, 2, null, null, "top", "10");

        t1.setWidget(0, 0, getHSpacer());
        t1.setHTML(0, 1, removeCData(addr.getFormattedAddress()).replaceAll("<br>", ", "));
        t1.setWidget(0, 2, getHSpacer());

        ft1111.setWidget(1, 1, t1);
        // Col 4
        ft1111.setWidget(1, 2, getHSpacer());

        // Col 3 of ft111
        ft111.setWidget(row++, 2, getHSpacer());
    }

    ft111.getFlexCellFormatter().setColSpan(row, 0, colspan);
    ft111.setWidget(row++, 0, getVSpacer());

    // Add error table
    ft111.getFlexCellFormatter().setColSpan(row, 0, colspan);
    ft111.setWidget(row++, 0, errorFT);

    containerPanel.add(ft111, BODY_ID);
    containerPanel.add(getButtons(2), BUTTON_ID);

    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    addToDom(containerPanel);

}

From source file:com.konakart.client.KKBaseWin.java

License:Open Source License

/**
 * Utility method to format a cell/* w  w  w . j  a va2s .c  om*/
 * 
 * @param ft
 * @param r
 * @param c
 * @param style
 * @param hAlign
 * @param vAlign
 * @param width
 */
protected void formatCell(FlexTable ft, int r, int c, String style, String hAlign, String vAlign,
        String width) {

    if (style != null) {
        ft.getFlexCellFormatter().setStyleName(r, c, style);
    }

    if (hAlign != null) {
        if (hAlign.equalsIgnoreCase("right")) {
            ft.getFlexCellFormatter().setHorizontalAlignment(r, c, HasHorizontalAlignment.ALIGN_RIGHT);

        } else if (hAlign.equalsIgnoreCase("left")) {
            ft.getFlexCellFormatter().setHorizontalAlignment(r, c, HasHorizontalAlignment.ALIGN_LEFT);

        } else if (hAlign.equalsIgnoreCase("center")) {
            ft.getFlexCellFormatter().setHorizontalAlignment(r, c, HasHorizontalAlignment.ALIGN_CENTER);
        }
    }
    if (vAlign != null) {
        if (vAlign.equalsIgnoreCase("top")) {
            ft.getFlexCellFormatter().setVerticalAlignment(r, c, HasVerticalAlignment.ALIGN_TOP);

        } else if (vAlign.equalsIgnoreCase("bottom")) {
            ft.getFlexCellFormatter().setVerticalAlignment(r, c, HasVerticalAlignment.ALIGN_BOTTOM);

        } else if (vAlign.equalsIgnoreCase("middle")) {
            ft.getFlexCellFormatter().setVerticalAlignment(r, c, HasVerticalAlignment.ALIGN_MIDDLE);
        }
    }

    if (width != null) {
        ft.getFlexCellFormatter().setWidth(r, c, width);
    }
}

From source file:com.konakart.client.LoginBody.java

License:Open Source License

/**
 * Creates the panel to ask for the email
 *///from  w  w w.  ja v a  2  s  .  c o m
protected void renderGetEmail() {
    // Remove the current panel
    removeFromDom();

    // Get the container panel
    HTMLPanel containerPanel = getContainerPanel(1);

    // Get the header
    Widget header = renderHeader(login_body_welcome_email, "table_background_login.gif",
            login_body_welcome_email);

    // Add the header to the container panel
    containerPanel.add(header, HEADER_ID);

    // Create the body
    FlexTable ft0 = getTable(0, "100%", 0, 0, "body-content-tab");

    int row = 0;

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setHTML(row++, 0, "<b>" + one_page_checkout_enter_email + ":</b>");

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    ft0.setHTML(row, 0, "<b>" + login_body_email + ":</b>");
    ft0.setWidget(row++, 1, userTB);

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, errorFT);

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    containerPanel.add(ft0, BODY_ID);
    containerPanel.add(getButtons(2), BUTTON_ID);

    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    addToDom(containerPanel);

}

From source file:com.konakart.client.LoginBody.java

License:Open Source License

/**
 * Creates the panel to ask for the password
 */// www  . j a va 2s.  c o m
protected void renderGetPassword() {
    // Remove the current panel
    removeFromDom();

    // Clear the password entry field
    passwordTB.setText("");

    // Get the container panel
    HTMLPanel containerPanel = getContainerPanel(1);

    // Get the header
    Widget header = renderHeader(login_body_welcome, "table_background_login.gif", login_body_welcome);

    // Add the header to the container panel
    containerPanel.add(header, HEADER_ID);

    // Create the body
    FlexTable ft0 = getTable(0, "100%", 0, 0, "body-content-tab");

    int row = 0;

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, successFT);

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setHTML(row++, 0, "<b>" + email_welcome_subject + " \"" + userTB.getText() + "\", "
            + one_page_checkout_enter_password_login + ":</b>");

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    ft0.setHTML(row, 0, "<b>" + login_body_password + ":</b>");
    ft0.setWidget(row++, 1, passwordTB);

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, errorFT);

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    formatCell(ft0, row, 0, "smallText", null, "bottom", null);
    ft0.setWidget(row++, 0, forgotPasswordLink);

    containerPanel.add(ft0, BODY_ID);
    containerPanel.add(getButtons(2), BUTTON_ID);

    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    addToDom(containerPanel);
}

From source file:com.konakart.client.LoginBody.java

License:Open Source License

/**
 * Creates the panel to ask to send the forgotten password
 *///from   ww w  . j a  va 2s .c  o m
protected void renderForgotPassword() {
    // Remove the current panel
    removeFromDom();

    // Get the container panel
    HTMLPanel containerPanel = getContainerPanel(1);

    // Get the header
    Widget header = renderHeader(forgotten_password_body_forgotten, "table_background_password_forgotten.gif",
            forgotten_password_body_forgotten);

    // Add the header to the container panel
    containerPanel.add(header, HEADER_ID);

    // Create the body
    FlexTable ft0 = getTable(0, "100%", 0, 0, "body-content-tab");

    int row = 0;

    ft0.setWidget(row++, 0, getVSpacer());

    ft0.setHTML(row++, 0, forgotten_password_body_explanation1 + " <b>" + getUserName() + "</b>");

    ft0.getFlexCellFormatter().setColSpan(row, 0, 2);
    ft0.setWidget(row++, 0, getVSpacer());

    containerPanel.add(ft0, BODY_ID);
    containerPanel.add(getButtons(2), BUTTON_ID);

    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    addToDom(containerPanel);
}

From source file:com.konakart.client.OrderBody.java

License:Open Source License

/**
 * Creates the main checkout confirmation table
 *///from www. j a va2 s. c o m
private void render() {
    int row = 0;

    // Remove the current panel
    removeFromDom();

    // Get the container panel
    HTMLPanel containerPanel = getContainerPanel(2);

    // Get the header
    Widget header = renderHeader(checkout_confirmation_orderconfirmation, "table_background_confirmation.gif",
            checkout_confirmation_orderconfirmation);

    // Add the header to the container panel
    containerPanel.add(header, HEADER_ID);

    // Container table
    FlexTable ft1 = getTable(0, "100%", 0, 0, "body-content-tab");

    // Add spacer
    ft1.setWidget(row++, 0, getVSpacer());

    // Add error table
    ft1.setWidget(row++, 0, errorFT);

    // ft12
    FlexTable ft12 = getTable(0, "100%", 1, 2, null);
    formatCell(ft12, 0, 0, "msg-box-no-pad", null, "top", "30%");
    formatCell(ft12, 0, 1, "msg-box-no-pad", null, "top", "70%");

    // ft121
    FlexTable ft121 = getTable(0, "100%", 0, 2, "body-content-tab");

    ft121.setWidget(0, 0, getEdit(editDeliveryLink, show_order_details_body_deliveryaddress));
    ft121.setHTML(1, 0, removeCData(order.getDeliveryFormattedAddress()));
    ft121.setHTML(2, 0, "<b>" + show_order_details_body_shippingmethod + "</b>");
    ft121.setWidget(3, 0, shippingLB);

    // ft122
    FlexTable ft122 = getTable(0, "100%", 0, 0, "body-content-tab");

    // ft1221
    FlexTable ft1221 = getTable(0, "100%", 0, 2, "body-content-tab");
    formatCell(ft1221, 0, 0, null, null, null, "70%");
    ft1221.getFlexCellFormatter().setColSpan(0, 0, 2);
    formatCell(ft1221, 0, 1, "smallText", "right", null, "1%");
    formatCell(ft1221, 0, 2, "smallText", "right", null, "29%");

    ft1221.setWidget(0, 0, getEdit(editCartLink, show_order_details_body_products));
    ft1221.setHTML(0, 1, "<b>" + show_order_details_body_tax + "</b>");
    ft1221.setHTML(0, 2, "<b>" + show_order_details_body_total + "</b>");

    if (order != null && order.getOrderProducts() != null) {
        for (int i = 0; i < order.getOrderProducts().length; i++) {
            GWT_OrderProduct op = order.getOrderProducts()[i];
            formatCell(ft1221, i + 1, 0, null, "right", "top", null);
            formatCell(ft1221, i + 1, 1, null, "left", "top", null);
            formatCell(ft1221, i + 1, 2, null, "right", "top", null);
            formatCell(ft1221, i + 1, 3, null, "right", "top", null);

            ft1221.setHTML(i + 1, 0, op.getQuantity() + "&nbsp;x");
            StringBuffer sb = new StringBuffer(op.getName());
            if (op.getOpts() != null) {
                for (int j = 0; j < op.getOpts().length; j++) {
                    GWT_Option opt = op.getOpts()[j];
                    if (opt != null) {
                        sb.append("<br><nobr><small>&nbsp;<i> - " + opt.getName() + ": " + opt.getValue()
                                + "</i></small></nobr>");
                    }
                }
            }
            ft1221.setHTML(i + 1, 1, sb.toString());

            ft1221.setHTML(i + 1, 2, op.getFormattedTaxRate() + "%");

            if (getKK().isDispPriceWithTax()) {
                ft1221.setHTML(i + 1, 3, op.getFormattedFinalPriceIncTax());
            } else {
                ft1221.setHTML(i + 1, 3, op.getFormattedFinalPriceExTax());
            }
        }
    }

    // Attach tables
    ft122.setWidget(0, 0, ft1221);
    ft12.setWidget(0, 0, ft121);
    ft12.setWidget(0, 1, ft122);
    ft1.setWidget(row++, 0, ft12);

    // Add spacer
    ft1.setWidget(row++, 0, getVSpacer());

    ft1.setHTML(row++, 0, "<b>" + show_order_details_body_billinginformation + "</b>");

    // Add spacer
    // ft1.setWidget(row++, 0, getSpacer());

    // ft13
    FlexTable ft13 = getTable(0, "100%", 1, 2, null);
    formatCell(ft13, 0, 0, "msg-box-no-pad", null, "top", "30%");
    formatCell(ft13, 0, 1, "msg-box-no-pad", null, "top", "70%");

    // ft131
    FlexTable ft131 = getTable(0, "100%", 0, 2, "body-content-tab");

    ft131.setWidget(0, 0, getEdit(editBillingLink, show_order_details_body_billingaddress));
    ft131.setHTML(1, 0, removeCData(order.getBillingFormattedAddress()));
    ft131.setHTML(2, 0, "<b>" + show_order_details_body_paymentmethod + "</b>");
    ft131.setWidget(3, 0, paymentLB);

    // ft132 - global
    updateOrderTotals();

    // Attach tables
    ft13.setWidget(0, 0, ft131);
    ft13.setWidget(0, 1, ft132);
    ft1.setWidget(row++, 0, ft13);

    /*
     * Display coupon entry field
     */
    if (getKK().isDispCoupon()) {
        // Fill in the coupon code
        if (order.getCouponCode() == null) {
            couponTB.setValue("");
        } else {
            couponTB.setValue(order.getCouponCode());
        }

        // Add spacer
        ft1.setWidget(row++, 0, getVSpacer());

        ft1.setHTML(row++, 0, "<b>" + checkout_common_couponcode + "</b>");

        // ft141
        FlexTable ft141 = getTable(0, "100%", 0, 2, "msg-box-no-pad");
        formatCell(ft141, 0, 0, null, null, "top", "1%");
        formatCell(ft141, 0, 1, "konakart-HandCursor", "left", "top", "99%");
        ft141.setWidget(0, 0, couponTB);
        ft141.setWidget(0, 1, updateCouponCssButton);

        // Attach tables
        ft1.setWidget(row++, 0, ft141);

        // Add spacer
        ft1.setWidget(row++, 0, getVSpacer());
    }

    /*
     * Display gift certificate entry field
     */
    if (getKK().isDispGiftCert()) {
        // Fill in the giftCert code
        if (order.getGiftCertCode() == null) {
            giftCertTB.setValue("");
        } else {
            giftCertTB.setValue(order.getGiftCertCode());
        }

        // Add spacer
        ft1.setWidget(row++, 0, getVSpacer());

        ft1.setHTML(row++, 0, "<b>" + checkout_common_giftcertcode + "</b>");

        // ft141
        FlexTable ft141 = getTable(0, "100%", 0, 2, "msg-box-no-pad");
        formatCell(ft141, 0, 0, null, null, "top", "1%");
        formatCell(ft141, 0, 1, "konakart-HandCursor", "left", "top", "99%");
        ft141.setWidget(0, 0, giftCertTB);
        ft141.setWidget(0, 1, updateGiftCertCssButton);

        // Attach tables
        ft1.setWidget(row++, 0, ft141);

        // Add spacer
        ft1.setWidget(row++, 0, getVSpacer());
    }

    /*
     * Display reward points entry field
     */
    if (getKK().isDispRewardPoints() && rewardPoints > 0) {
        // Set points input field
        if (order.getPointsRedeemed() > 0) {
            pointsTB.setValue(Integer.toString(order.getPointsRedeemed()));
        }

        // Add spacer
        ft1.setWidget(row++, 0, getVSpacer());

        ft1.setHTML(row++, 0, "<b>" + checkout_common_reward_points + "</b>");

        // ft141
        FlexTable ft141 = getTable(0, "100%", 0, 2, "msg-box-no-pad");
        formatCell(ft141, 0, 0, null, null, "top", "1%");
        formatCell(ft141, 0, 1, "konakart-HandCursor", "left", "top", "99%");
        ft141.setWidget(0, 0, pointsTB);
        ft141.setWidget(0, 1, updatePointsCssButton);

        // Attach tables
        ft1.setWidget(row++, 0, ft141);

        // Add spacer
        ft1.setWidget(row++, 0, getVSpacer());
    }

    // Add spacer
    ft1.setWidget(row++, 0, getVSpacer());

    ft1.setHTML(row++, 0, "<b>" + checkout_confirmation_ordercomments + "</b>");

    // ft15
    FlexTable ft15 = getTable(0, "100%", 1, 2, "msg-box-no-pad");

    // ft151
    FlexTable ft151 = getTable(0, "100%", 0, 2, "body-content-tab");
    ft151.setWidget(0, 0, commentTA);

    // Attach tables
    ft15.setWidget(0, 0, ft151);
    ft1.setWidget(row++, 0, ft15);

    containerPanel.add(ft1, BODY_ID);
    containerPanel.add(getButtons(1), BUTTON_ID);

    // Finally, add the outer panel to the RootPanel, so that it will be
    // displayed.
    addToDom(containerPanel);
}

From source file:com.mcherm.zithiacharsheet.client.SkillCatalogDisplay.java

License:Apache License

/**
 * Subroutine of constructor to set up a smaller table with the skills
 * from an individual category.//from w  ww .  j  a v  a 2  s. co  m
 */
private FlexTable makeCategorySkillsSubtable(final SkillCatalog.SkillCategory skillCategory) {
    // FIXME: Make this a subroutine
    FlexTable subTable = new FlexTable();
    final FlexCellFormatter subFormatter = subTable.getFlexCellFormatter();
    int skillRow = 0;
    for (final ZithiaSkill skill : skillCategory.getSkills()) {
        final int SKILL_ROW = skillRow;
        ClickHandler rowClickHandler = new ClickHandler() {
            public void onClick(ClickEvent event) {
                onSkillClicked(event, skill, SKILL_ROW);
            }
        };
        String statsText;
        if (skill.hasRoll()) {
            statsText = skill.getStat().getName() + "/" + skill.getBaseCost() + "/" + skill.getFirstLevelCost();
        } else {
            statsText = Integer.toString(skill.getBaseCost());
        }
        subFormatter.addStyleName(SKILL_ROW, 0, "statsCol");
        Label statsLabel = new Label(statsText);
        statsLabel.addClickHandler(rowClickHandler);
        subTable.setWidget(SKILL_ROW, 0, statsLabel);
        subFormatter.addStyleName(SKILL_ROW, 1, "nameCol");
        Label nameLabel = new Label(skill.getName());
        nameLabel.addClickHandler(rowClickHandler);
        subTable.setWidget(SKILL_ROW, 1, nameLabel);
        skillRow++;
    }
    return subTable;
}

From source file:com.mj.jqplot.sampling.client.utils.Utils.java

License:Open Source License

public static void alignLeft(FlexTable table, int row, int col) {
    table.getFlexCellFormatter().setHorizontalAlignment(row, col, HasAlignment.ALIGN_LEFT);
}

From source file:com.mj.jqplot.sampling.client.utils.Utils.java

License:Open Source License

public static void alignRight(FlexTable table, int row, int col) {
    table.getFlexCellFormatter().setHorizontalAlignment(row, col, HasAlignment.ALIGN_RIGHT);
}