Example usage for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_CENTER

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

Introduction

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

Prototype

HorizontalAlignmentConstant ALIGN_CENTER

To view the source code for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_CENTER.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the center.

Usage

From source file:ar.com.kyol.jet.client.JetPaginatedTable.java

License:Open Source License

private void addNavigationLinks() {
    //gmail like pagination:
    int to = from + qtyRetrieved - 1;
    if (qtyRetrieved == 0)
        from = 0; //for empty lists
    if (from > 0) {
        if (from + 1 > (qty + 2)) {
            addOldest();//ww  w .  ja v  a2  s . c om
        }
        addOlder();
    }
    Label label = new Label((from + 1) + " - " + (to + 1) + " " + Jet.constants.of() + " " + total);
    label.addStyleDependentName("navigator-gwtjet");
    //label.setWidth("130px");
    label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    navigationPanel.add(label);
    if (from + qtyRetrieved < total && total != 0) {
        addNewer();
        if (from + qtyRetrieved < (total - qty)) {
            addNewest();
        }
    }
    //
    //-------------------------------------------------------------------------------------------
    //OLD another pagination:
    //      int to = from+qtyRetrieved-1;
    //      if(qtyRetrieved == 0) from = 0; //for empty lists
    //      if(from > 1) {
    ////         if(from > (qty + 2)) {
    ////            navigationPanel.add(new Hyperlink("<< Newest", this.getPlainToken()+"/p1"));
    ////         }
    //         navigationPanel.add(new Hyperlink("previous", this.getPlainToken()+"/p"+(page-1)));
    //      }
    //      int mostrados = 0;
    //      for (int i = page-5; i < page; i++) {
    //         if(i > 0) {
    //            navigationPanel.add(new Hyperlink(Integer.toString(i), this.getPlainToken()+"/p"+(i)));
    //            mostrados++;
    //         }
    //      }
    //      if(mostrados > 0 || total > qty) {
    //         navigationPanel.add(new Hyperlink("<b>"+Integer.toString(page)+"</b>",true, this.getPlainToken()+"/p"+(page)));
    //      }
    //      for (int i = page+1; i < ((int)Math.ceil(Float.valueOf(total) / qty))+1 && i < page+10-mostrados; i++) {
    //         navigationPanel.add(new Hyperlink(Integer.toString(i), this.getPlainToken()+"/p"+(i)));
    //      }
    //      if(from+qtyRetrieved < total && total != 0) {
    //         navigationPanel.add(new Hyperlink("next", this.getPlainToken()+"/p"+(page+1)));
    ////         if(from-1+qtyRetrieved < (total - qty)) {
    ////            navigationPanel.add(new Hyperlink("Oldest >>", this.getPlainToken()+"/p"+(int)Math.ceil(Float.valueOf(total) / qty)));
    ////         }
    //      }
    //      Label label = new Label(" (Showing "+from+" to "+to+" out of "+total+" results)");
    //      label.setWidth("250px");
    //      label.addStyleName("showingResults");
    //      label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    //      navigationPanel.add(label);
    //
    //-------------------------------------------------------------------------------------------
}

From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationSearchResultComposite.java

License:EUPL

public ImageAnnotationSearchResultComposite(String searchTerm) {
    initWidget(compositePanel);//w  w w . j av  a2 s.c o  m

    this.searchTerm = searchTerm;
    this.setStyleName("imageAnnotation-searchresult-composite");
    compositePanel.add(resultTable);

    // the search result table
    resultTable.setStyleName("sortableTable");
    resultTable.setBorderWidth(0);
    resultTable.setCellPadding(1);
    resultTable.setCellSpacing(1);

    resultTable.addColumnHeader(Application.getConstants().annotationCreator(), 0);
    resultTable.addColumnHeader(Application.getConstants().annotationCreationDate(), 1);
    resultTable.addColumnHeader(Application.getConstants().annotationImage(), 2);
    resultTable.addColumnHeader(Application.getConstants().annotationTitle(), 3);
    resultTable.addColumnHeader(Application.getConstants().annotationText(), 4);

    RowFormatter rowFormatter = resultTable.getRowFormatter();
    rowFormatter.setStyleName(0, "tableHeader");

    CellFormatter cellFormatter = resultTable.getCellFormatter();
    for (int colIndex = 0; colIndex < 5; colIndex++) {
        cellFormatter.setStyleName(0, colIndex, "headerStyle");
        cellFormatter.setAlignment(0, colIndex, HasHorizontalAlignment.ALIGN_CENTER,
                HasVerticalAlignment.ALIGN_MIDDLE);
    }

    resultTable.setValue(1, 0, Application.getConstants().searching());

    // do the search
    search();
}

From source file:bingo.client.Bingo.java

License:Open Source License

/**
 * This is the entry point method.//from w ww  .  java  2  s . c  om
 */
public void onModuleLoad() {
    Label titleLabel = new Label();
    titleLabel.setText(strings.title());
    RootPanel.get("title").add(titleLabel);

    // This is the general notification text box
    RootPanel.get("message").add(message);

    // Cheking if the user has already an user id
    final String cookie = Cookies.getCookie(COOKIE_ID);

    // Validating the cookie
    bingoService.statusUserId(cookie, new AsyncCallback<Integer>() {
        @Override
        public void onFailure(Throwable caught) {
            message.setText(caught.getMessage());
            Cookies.removeCookie(COOKIE_ID);
        }

        @Override
        public void onSuccess(Integer status) {
            // TODO: Control the logged status (I should not get a user if s/he is already logged)
            if (status.intValue() == BingoService.NO_LOGGED || status.intValue() == BingoService.LOGGED) {
                bingoService.getUserId(new AsyncCallback<String>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(strings.errorUserCreation());
                    }

                    @Override
                    public void onSuccess(String result) {
                        userId = result;
                    }
                });

                message.setHTML("");

                // Showing image to enter
                ImageResource imageResource = BingoResources.INSTANCE.entry();
                Image entryImage = new Image(imageResource.getSafeUri());
                RootPanel.get("buttons").add(entryImage);

                // Selecting behavior (admin / voter) 
                HorizontalPanel entryPoint = new HorizontalPanel();

                entryPoint.setStyleName("mainSelectorPanel");
                entryPoint.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                entryPoint.setSpacing(50);

                // 
                // CREATING A BINGO
                //
                VerticalPanel leftPanel = new VerticalPanel();
                leftPanel.setStyleName("selectorPanel");

                Label leftPanelTitle = new Label();
                leftPanelTitle.setStyleName("selectorPanelTitle");
                leftPanelTitle.setText(strings.leftPanelTitle());
                leftPanel.add(leftPanelTitle);
                leftPanel.setCellHorizontalAlignment(leftPanelTitle, HasHorizontalAlignment.ALIGN_CENTER);

                Grid leftSubPanel = new Grid(2, 2);
                leftSubPanel.setWidget(0, 0, new Label(strings.createBingoName()));
                final TextBox bingoNameBox = new TextBox();
                leftSubPanel.setWidget(0, 1, bingoNameBox);

                leftSubPanel.setWidget(1, 0, new Label(strings.createBingoPassword()));
                final PasswordTextBox bingoPasswordBox = new PasswordTextBox();
                leftSubPanel.setWidget(1, 1, bingoPasswordBox);
                leftPanel.add(leftSubPanel);

                final Button createButton = new Button("Create");
                createButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        bingoService.createBingo(userId, bingoNameBox.getText(), bingoPasswordBox.getText(),
                                new AsyncCallback<String>() {
                                    @Override
                                    public void onFailure(Throwable caught) {
                                        message.setText(caught.getMessage());
                                    }

                                    @Override
                                    public void onSuccess(final String gameId) {
                                        final BingoGrid bingoGrid = new BingoGrid();
                                        initAdminGrid(userId, bingoGrid, false);
                                        RootPanel.get("bingoTable").clear();
                                        RootPanel.get("bingoTable").add(bingoGrid);
                                        message.setText(strings.welcomeMessageCreation());

                                        // Setting the cookie
                                        Date expirationDate = new Date();
                                        expirationDate.setHours(expirationDate.getHours() + EXPIRATION_VALUE);
                                        Cookies.setCookie(COOKIE_ID, userId, expirationDate);
                                    }
                                });
                    }
                });
                leftPanel.add(createButton);
                leftPanel.setCellHorizontalAlignment(createButton, HasHorizontalAlignment.ALIGN_CENTER);
                entryPoint.add(leftPanel);

                // 
                // JOINING
                //
                VerticalPanel rightPanel = new VerticalPanel();
                rightPanel.setStyleName("selectorPanel");

                Label rightPanelTitle = new Label();
                rightPanelTitle.setStyleName("selectorPanelTitle");
                rightPanelTitle.setText(strings.rightPanelTitle());
                rightPanel.add(rightPanelTitle);
                rightPanel.setCellHorizontalAlignment(rightPanelTitle, HasHorizontalAlignment.ALIGN_CENTER);

                Grid rightSubPanel = new Grid(2, 2);
                rightSubPanel.setWidget(0, 0, new Label(strings.joinToBingoName()));
                final ListBox joinExistingBingoBox = new ListBox();
                bingoService.getBingos(new AsyncCallback<String[][]>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        joinExistingBingoBox.addItem(strings.noBingos());
                    }

                    @Override
                    public void onSuccess(String[][] result) {
                        if (result == null) {
                            joinExistingBingoBox.addItem(strings.noBingos());
                        } else {
                            for (int i = 0; i < result.length; i++) {
                                String gameName = result[i][0];
                                String gameId = result[i][1];
                                joinExistingBingoBox.addItem(gameName, gameId);
                            }
                        }
                    }
                });
                rightSubPanel.setWidget(0, 1, joinExistingBingoBox);

                rightSubPanel.setWidget(1, 0, new Label(strings.joinToBingoPassword()));
                final PasswordTextBox joinBingoPasswordBox = new PasswordTextBox();
                rightSubPanel.setWidget(1, 1, joinBingoPasswordBox);
                rightPanel.add(rightSubPanel);

                final Button joinButton = new Button("Join");
                joinButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        int index = joinExistingBingoBox.getSelectedIndex();
                        if (index < 0)
                            message.setText(strings.noSelectedItem());
                        else {
                            final String gameId = joinExistingBingoBox.getValue(index);
                            if (gameId == null)
                                message.setText(strings.noSelectedItem());
                            else {
                                bingoService.joinBingo(userId, gameId, joinBingoPasswordBox.getText(),
                                        new AsyncCallback<Void>() {
                                            @Override
                                            public void onFailure(Throwable caught) {
                                                message.setText(caught.getMessage());
                                            }

                                            @Override
                                            public void onSuccess(Void result) {
                                                final BingoGrid bingoGrid = new BingoGrid();
                                                initUserGrid(bingoGrid);
                                                RootPanel.get("bingoTable").clear();
                                                RootPanel.get("bingoTable").add(bingoGrid);

                                                message.setText(strings.welcomeMessageJoin());

                                                // Setting the cookie
                                                Date expirationDate = new Date();
                                                expirationDate
                                                        .setHours(expirationDate.getHours() + EXPIRATION_VALUE);
                                                Cookies.setCookie(COOKIE_ID, userId, expirationDate);
                                            }
                                        });
                            }
                        }
                    }
                });
                rightPanel.add(joinButton);
                rightPanel.setCellHorizontalAlignment(joinButton, HasHorizontalAlignment.ALIGN_CENTER);
                entryPoint.add(rightPanel);

                RootPanel.get("bingoTable").add(entryPoint);

            } else if (status.intValue() == BingoService.ADMIN) {
                message.setText("Detected cookie: " + cookie + " as admin");
                userId = cookie;

                bingoService.statusBingo(userId, new AsyncCallback<Integer>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Integer result) {
                        int status = result.intValue();
                        final BingoGrid bingoGrid = new BingoGrid();
                        if (status == BingoService.RUNNING) {
                            initAdminGrid(userId, bingoGrid, false);
                            message.setText(strings.welcomeMessageCreation());
                        } else if (status == BingoService.FINISHED) {
                            initAdminGrid(userId, bingoGrid, true);
                            message.setText(strings.finishMessage());
                        }
                        RootPanel.get("bingoTable").clear();
                        RootPanel.get("bingoTable").add(bingoGrid);
                    }
                });

            } else if (status.intValue() == BingoService.PARTICIPANT) {
                message.setText("Detected cookie: " + cookie + " as participant");
                userId = cookie;

                final BingoGrid bingoGrid = new BingoGrid();
                initUserGrid(bingoGrid);
                updateUserGrid(bingoGrid, null);
                RootPanel.get("bingoTable").clear();
                RootPanel.get("bingoTable").add(bingoGrid);
            }
        }
    });
}

From source file:bingo.client.Bingo.java

License:Open Source License

private void initAdminGrid(final String userId, final BingoGrid bingoGrid, final boolean hasFinished) {
    final Timer timer = new Timer() {
        int totalParticipants = 0;

        @Override//from  w ww .ja va  2s. c om
        public void run() {
            bingoService.getTotalParticipants(userId, new AsyncCallback<Integer>() {
                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(Integer result) {
                    totalParticipants = result.intValue();
                }
            });

            bingoService.getVotes(userId, new AsyncCallback<int[][]>() {
                @Override
                public void onFailure(Throwable caught) {
                    message.setText(caught.getMessage());
                }

                @Override
                public void onSuccess(int[][] result) {
                    if (result == null) {
                        result = new int[BingoGrid.ROW][BingoGrid.COL];
                        for (int i = 0; i < BingoGrid.ROW; i++)
                            for (int j = 0; j < BingoGrid.COL; j++)
                                result[i][j] = 0;
                    }

                    for (int row = 0; row < BingoGrid.ROW; ++row)
                        for (int col = 0; col < BingoGrid.COL; ++col) {
                            bingoGrid.setVoteString(row, col, String.valueOf(result[row][col]),
                                    String.valueOf(totalParticipants));
                        }
                }
            });
        }
    };

    // If the game is not finished, repeat; if so, run once
    if (!hasFinished)
        timer.scheduleRepeating(ADMIN_TIMER);
    else
        timer.run();

    HorizontalPanel panel = new HorizontalPanel();
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    final Button finishButton = new Button();

    // If the game is not finished, allow finishing it; if so, allow download data
    if (!hasFinished)
        finishButton.setText(strings.finishBingo());
    else
        finishButton.setText(strings.download());

    finishButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (!hasFinished)
                bingoService.finishBingo(userId, new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        message.setText(strings.finishedBingo());
                        finishButton.setText(strings.download());
                        timer.cancel();
                    }
                });

            bingoService.getVotes(userId, new AsyncCallback<int[][]>() {
                @Override
                public void onFailure(Throwable caught) {
                    message.setText(caught.getMessage());
                }

                @Override
                public void onSuccess(int[][] result) {
                    // Create a popup dialog box
                    final DialogBox box = new DialogBox();
                    box.setText(strings.info());
                    box.setAnimationEnabled(true);

                    final Button boxAcceptButton = new Button(strings.accept());
                    boxAcceptButton.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            box.hide();
                        }
                    });

                    Label boxLabel = new Label();
                    boxLabel.setText(strings.finishMessage());
                    HTML voteData = new HTML();
                    if (result == null) {
                        result = new int[BingoGrid.ROW][BingoGrid.COL];
                        for (int i = 0; i < BingoGrid.ROW; i++)
                            for (int j = 0; j < BingoGrid.COL; j++)
                                result[i][j] = 0;
                    }

                    String cellKey = "";
                    String cellString = "";
                    String voteDataString = "";
                    for (int row = 0; row < BingoGrid.ROW; ++row)
                        for (int col = 0; col < BingoGrid.COL; ++col) {
                            cellKey = "cell" + row + col;
                            cellString = strings.map().get(cellKey);
                            voteDataString += "&nbsp;&nbsp;&nbsp;" + cellString + " = " + result[row][col]
                                    + "<br>";
                        }
                    voteData.setHTML(voteDataString);
                    voteData.addStyleName("boxData");

                    VerticalPanel boxPanel = new VerticalPanel();
                    boxPanel.addStyleName("boxPanel");
                    boxPanel.add(boxLabel);
                    boxPanel.add(voteData);

                    HorizontalPanel buttonsPanel = new HorizontalPanel();
                    buttonsPanel.add(boxAcceptButton);
                    boxPanel.add(buttonsPanel);
                    boxPanel.setCellHorizontalAlignment(buttonsPanel, HasHorizontalAlignment.ALIGN_CENTER);

                    box.setWidget(boxPanel);
                    box.center();
                }
            });
        }
    });
    panel.add(finishButton);

    final Button terminateButton = new Button(strings.terminateButton());
    terminateButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Create a popup dialog box
            final DialogBox box = new DialogBox();
            box.setText(strings.warning());
            box.setAnimationEnabled(true);

            final Button boxCancelButton = new Button(strings.cancel());
            boxCancelButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    box.hide();
                }
            });
            final Button boxAcceptButton = new Button(strings.accept());
            boxAcceptButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    bingoService.terminateBingo(userId, new AsyncCallback<Void>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            message.setText(caught.getMessage());
                        }

                        @Override
                        public void onSuccess(Void result) {
                            message.setText(strings.terminatedBingo());
                            timer.cancel();
                        }

                    });
                    box.hide();
                }
            });

            final Label boxLabel = new Label();
            boxLabel.setText(strings.terminateMessage());

            VerticalPanel boxPanel = new VerticalPanel();

            boxPanel.addStyleName("boxPanel");
            boxPanel.add(boxLabel);

            HorizontalPanel buttonsPanel = new HorizontalPanel();
            buttonsPanel.add(boxCancelButton);
            buttonsPanel.add(boxAcceptButton);
            boxPanel.add(buttonsPanel);

            box.setWidget(boxPanel);
            box.center();
        }
    });
    panel.add(terminateButton);

    RootPanel.get("buttons").clear();
    RootPanel.get("buttons").add(panel);
}

From source file:bingo.client.BingoCell.java

License:Open Source License

public BingoCell(SafeUri uri, String label, String votes) {
    super(3, 1);//from w  ww.j a va2  s.c o  m
    this.setCellPadding(3);

    FlowPanel imagePanel = new FlowPanel();
    imagePanel.setSize(IMAGE_WIDTH, IMAGE_HEIGHT);
    Image cellImage = new Image(uri);
    cellImage.setStyleName("cell-image");
    imagePanel.add(cellImage);

    Label labelText = new Label();
    labelText.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    labelText.setText(label);
    labelText.setStyleName("cell-label");

    Label votesText = new Label(votes);
    this.votes = votesText;
    this.votes.setStyleName("cell-votes");

    this.voted = false;

    this.setWidget(0, 0, imagePanel);
    this.getCellFormatter().setHeight(0, 0, IMAGE_HEIGHT);
    this.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    this.setWidget(1, 0, labelText);
    this.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    this.setWidget(2, 0, this.votes);
    this.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:bingo.client.BingoGrid.java

License:Open Source License

private void initGrid() {
    cells = new BingoCell[ROW][COL];

    this.setCellPadding(5);

    String cellKey = "";
    for (int row = 0; row < ROW; ++row)
        for (int col = 0; col < COL; ++col) {
            cellKey = "cell" + row + col;

            // Getting the picture
            ImageResource imageResource = getImageResource(row, col);

            // Getting the text
            String cellString = strings.map().get(cellKey);

            BingoCell bingoCell = new BingoCell(imageResource.getSafeUri(), cellString, "");

            // Building the panel
            this.setWidget(row, col, bingoCell);
            cells[row][col] = bingoCell;

            this.getCellFormatter().setStyleName(row, col, "cell-noselected");
            this.getCellFormatter().setHorizontalAlignment(row, col, HasHorizontalAlignment.ALIGN_CENTER);
            this.getCellFormatter().setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_MIDDLE);
            this.getCellFormatter().setWidth(row, col, CELL_WIDTH);
            this.getCellFormatter().setHeight(row, col, CELL_HEIGHT);
        }/*ww  w . j  av a  2s .  c o m*/
}

From source file:carteirainveste.client.DateUtil.java

License:Creative Commons License

Carteira() {
    accountList.add("--"); // built-in account NONE

    aboutPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    aboutPanel.add(new Label("Carteira Investe"));
    aboutPanel.add(new Label(Constant.VERSION + ": " + Constant.V_NUMBER));
    aboutPanel.add(new HTML(Constant.LICENSE));

    portfolioEndDate.setFormat(new DateBox.DefaultFormat(Preference.dateFormat));
    portfolioEndDate.setValue(new Date());
    portfolioEndDate.addValueChangeHandler(portfolioEndDateHandler);

    summaryEndDate.setFormat(new DateBox.DefaultFormat(Preference.dateFormat));
    summaryEndDate.setValue(new Date());
    summaryEndDate.addValueChangeHandler(summaryEndDateHandler);

    evolutionEndDate.setFormat(new DateBox.DefaultFormat(Preference.dateFormat));
    evolutionEndDate.setValue(new Date());
    evolutionEndDate.addValueChangeHandler(evolutionEndDateHandler);

    taxEndDate.setFormat(new DateBox.DefaultFormat(Preference.dateFormat));
    taxEndDate.setValue(new Date());
    taxEndDate.addValueChangeHandler(taxEndDateHandler);

    tabPanel.addSelectionHandler(mainTabSelectionHandler);

    addYieldAsset.addChangeHandler(assetHandler);
    addAssetName.addChangeHandler(assetHandler);
    addAssetAmount.addChangeHandler(addAssetAmountHandler);
    addAssetGrossValue.addChangeHandler(addAssetGrossValueCurrencyHandler);
    addAssetCost.addChangeHandler(addAssetCostCurrencyHandler);
    addAssetExpense.addChangeHandler(addAssetExpenseCurrencyHandler);
    addAssetRetainedTax.addChangeHandler(addAssetRetainedTaxCurrencyHandler);
    addAccountValue.addChangeHandler(currencyHandler);
    addAccountExpense.addChangeHandler(currencyHandler);
    addYieldGrossValue.addChangeHandler(currencyHandler);
    addYieldNetValue.addChangeHandler(currencyHandler);

    addAssetDtBuyGross.addChangeHandler(addAssetDtBuyGrossCurrencyHandler);
    addAssetDtSellGross.addChangeHandler(addAssetDtSellGrossCurrencyHandler);
    addAssetDtSellNet.addChangeHandler(addAssetDtSellNetCurrencyHandler);

    assetAccountDropBox.setSelectedIndex(addAssetPanelCurrAccountIndex);
    assetAccountDropBox.addChangeHandler(assetAccountHandler);

    tradeFilterYear.addChangeHandler(tradeFilterHandler);
    tradeFilterAssetSuggest.getValueBox().addChangeHandler(tradeFilterHandler);
    tradeFilterAccountSuggest.getValueBox().addChangeHandler(tradeFilterHandler);
    tradeFilterAssetSuggest.addSelectionHandler(tradeFilterHandler);
    tradeFilterAccountSuggest.addSelectionHandler(tradeFilterHandler);

    portfolioHideSoldPositionsCheckBox.setValue(false);
    portfolioHideSoldPositionsCheckBox.addValueChangeHandler(portfolioHideSoldPositionsHandler);

    prefSellSpreadText.addChangeHandler(prefChangeHandler);
    prefBrokerFeeText.addChangeHandler(prefChangeHandler);
    prefTaxExemptionText.addChangeHandler(prefChangeHandler);
    prefTaxFeeText.addChangeHandler(prefChangeHandler);
    prefDayTradeTaxFeeText.addChangeHandler(prefChangeHandler);

    Preference.stockDayTradeAffectExemptionLimit.addValueChangeHandler(dayTradeAffectExemptionHandler);
    Preference.stockExemptGainsReduceCarriedLoss.addValueChangeHandler(exemptGainReduceLossHandler);
    Preference.stockTaxRatioOverPretaxEarnings.addValueChangeHandler(taxRatioOverPretaxHandler);

    Preference.startTaxCarryLoss.addChangeHandler(startTaxCarryLossHandler);
    Preference.startTaxDayTradeCarryLoss.addChangeHandler(startTaxDayTradeCarryLossHandler);

    taxGrid.addStyleName("taxGrid");
    taxYearlySummaryGrid.addStyleName("taxGrid");
    summaryAccountGrid.addStyleName("boxedTable");
    summaryAssetGrid.addStyleName("boxedTable");
    summaryGrid.addStyleName("boxedTable");
    summaryFlowGrid.addStyleName("boxedTable");
    evolutionGrid.addStyleName("boxedTable");

    build();//  w  ww.j a  v  a 2 s .  c  om
}

From source file:cc.alcina.framework.gwt.client.ClientNotificationsImpl.java

License:Apache License

@Override
public void showDialog(String captionHTML, Widget captionWidget, String msg, MessageType messageType,
        List<Button> extraButtons, String containerStyle) {
    ensureImages();/*from  ww  w  .ja  va 2  s . c o m*/
    HorizontalAlignmentConstant align = messageType == MessageType.ERROR ? HasHorizontalAlignment.ALIGN_LEFT
            : HasHorizontalAlignment.ALIGN_CENTER;
    if (dialogBox != null) {
        dialogBox.hide();
    }
    String title = CommonUtils.friendlyConstant(messageType);
    dialogBox = new GlassDialogBox();
    dialogBox.setAnimationEnabled(dialogAnimationEnabled);
    AbstractImagePrototype aip = null;
    String text = "";
    switch (messageType) {
    case INFO:
        aip = AbstractImagePrototype.create(images.info());
        text = "Information";
        break;
    case WARN:
        aip = AbstractImagePrototype.create(images.warning());
        text = "Warning";
        break;
    case ERROR:
        aip = AbstractImagePrototype.create(images.error());
        text = "Problem notification";
        break;
    }
    dialogBox.setText(text);
    FlexTable ft = new FlexTable();
    containerStyle = containerStyle != null ? containerStyle
            : (messageType == MessageType.ERROR || !CommonUtils.isNullOrEmpty(msg)) ? "medium" : "narrow";
    ft.setCellSpacing(4);
    ft.setStyleName("alcina-Notification");
    ft.addStyleName(containerStyle);
    FlexCellFormatter cf = (FlexCellFormatter) ft.getCellFormatter();
    ft.setWidget(0, 0, aip.createImage());
    cf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    cf.setWidth(0, 0, "40px");
    FlowPanel fp = new FlowPanel();
    fp.setStyleName("text");
    Widget capWidget = captionHTML != null ? new HTML(captionHTML) : captionWidget;
    if (captionHTML != null) {
        capWidget.setStyleName("caption");
    }
    fp.add(capWidget);
    if (!CommonUtils.isNullOrEmpty(msg)) {
        Link nh = new Link("View detail");
        nh.addStyleName("pad-5");
        dialogHtml = new HTML("<span class='logboxpre'>" + msg.replace("\n", "<br>") + "</span>", true);
        final ScrollPanel sp = new ScrollPanel(dialogHtml);
        sp.setStyleName("logbox");
        sp.setVisible(containerStyle.equals("wide"));
        nh.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                sp.setVisible(!sp.isVisible());
            }
        });
        if (LooseContext.getBoolean(ClientNotifications.CONTEXT_AUTOSHOW_DIALOG_DETAIL)) {
            sp.setVisible(true);
        }
        fp.add(nh);
        fp.add(sp);
    }
    ft.setWidget(0, 1, fp);
    cf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(8);
    Button closeButton = new Button("Close");
    hp.add(closeButton);
    if (extraButtons != null) {
        for (Button b : extraButtons) {
            hp.add(b);
        }
    }
    ft.setWidget(1, 0, hp);
    cf.setColSpan(1, 0, 2);
    cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.setWidget(ft);
    dialogBox.center();
    dialogBox.show();
    Scheduler.get().scheduleDeferred(() -> closeButton.setFocus(true));
}

From source file:cc.alcina.framework.gwt.client.gwittir.widget.BoundTableExt.java

License:Open Source License

public void renderBottom() {
    if ((this.provider != null) && ((this.masks & BoundTableExt.SCROLL_MASK) == 0)
            && ((this.masks & BoundTableExt.NO_NAV_ROW_MASK) == 0) && numberOfChunks > 1) {
        int row = this.table.getRowCount();
        this.table.setWidget(row, 0, this.createNavWidget());
        this.table.getFlexCellFormatter().setColSpan(row, 0, this.columns.length);
        table.getCellFormatter().setHorizontalAlignment(row, 0, HasHorizontalAlignment.ALIGN_CENTER);
    }//from   w  ww. j a v a 2  s  . com
    setVisible(true);
}

From source file:cc.alcina.framework.gwt.client.gwittir.widget.BoundTableExt.java

License:Open Source License

private Widget createNavWidget() {
    Grid p = new Grid(1, 5);
    p.setStyleName(BoundTableExt.NAV_STYLE);
    Button b = new Button("<<", new ClickListener() {
        public void onClick(Widget sender) {
            first();/* w w  w . ja va 2  s. co m*/
        }
    });
    b.setStyleName(BoundTableExt.NAV_STYLE);
    if (this.getCurrentChunk() == 0) {
        b.setEnabled(false);
    }
    p.setWidget(0, 0, b);
    b = new Button("<", new ClickListener() {
        public void onClick(Widget sender) {
            previous();
        }
    });
    b.setStyleName(BoundTableExt.NAV_STYLE);
    if (this.getCurrentChunk() == 0) {
        b.setEnabled(false);
    }
    p.setWidget(0, 1, b);
    b = new Button(">", new ClickListener() {
        public void onClick(Widget sender) {
            next();
        }
    });
    b.setStyleName(BoundTableExt.NAV_STYLE);
    if (this.getCurrentChunk() == (this.getNumberOfChunks() - 1)) {
        b.setEnabled(false);
    }
    Label l = new Label((this.getCurrentChunk() + 1) + " / " + this.getNumberOfChunks());
    p.setWidget(0, 2, l);
    p.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_CENTER);
    p.setWidget(0, 3, b);
    b = new Button(">>", new ClickListener() {
        public void onClick(Widget sender) {
            last();
        }
    });
    b.setStyleName(BoundTableExt.NAV_STYLE);
    if (this.getCurrentChunk() == (this.getNumberOfChunks() - 1)) {
        b.setEnabled(false);
    }
    p.setWidget(0, 4, b);
    return p;
}