Search in sources :

Example 1 with HTMLTable

use of com.google.gwt.user.client.ui.HTMLTable in project zxing by zxing.

the class Generator method setGridStyle.

private static void setGridStyle(HTMLTable grid) {
    grid.getColumnFormatter().addStyleName(0, "firstColumn");
    grid.getColumnFormatter().addStyleName(1, "secondColumn");
    HTMLTable.CellFormatter cellFormatter = grid.getCellFormatter();
    for (int i = 0; i < grid.getRowCount(); ++i) {
        cellFormatter.addStyleName(i, 0, "firstColumn");
        cellFormatter.addStyleName(i, 1, "secondColumn");
    }
}
Also used : HTMLTable(com.google.gwt.user.client.ui.HTMLTable) EntryPoint(com.google.gwt.core.client.EntryPoint)

Example 2 with HTMLTable

use of com.google.gwt.user.client.ui.HTMLTable in project zxing by zxing.

the class Generator method setupLeftPanel.

void setupLeftPanel() {
    topPanel.setHTML(2, 0, "<span id=\"errorMessageID\" class=\"" + StylesDefs.ERROR_MESSAGE + "\"></span>");
    // fills up the list of generators
    for (GeneratorSource generator : generators) {
        genList.addItem(generator.getName());
        setGridStyle(generator.getWidget());
    }
    sizeList.addItem("Small", "120");
    sizeList.addItem("Medium", "230");
    sizeList.addItem("Large", "350");
    sizeList.setSelectedIndex(2);
    ecLevelList.addItem("L");
    ecLevelList.addItem("M");
    ecLevelList.addItem("Q");
    ecLevelList.addItem("H");
    ecLevelList.setSelectedIndex(0);
    encodingList.addItem("UTF-8");
    encodingList.addItem("ISO-8859-1");
    encodingList.addItem("Shift_JIS");
    encodingList.setSelectedIndex(0);
    // updates the second row of the table with the content of the selected generator
    genList.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent Event) {
            int i = genList.getSelectedIndex();
            setWidget(i);
        }
    });
    // grid for the generator picker
    HTMLTable selectionTable = new Grid(1, 2);
    selectionTable.setText(0, 0, "Contents");
    selectionTable.setWidget(0, 1, genList);
    setGridStyle(selectionTable);
    topPanel.setWidget(0, 0, selectionTable);
    // grid for the generate button
    HTMLTable generateGrid = new Grid(1, 2);
    setGridStyle(generateGrid);
    Button generateButton = new Button("Generate &rarr;");
    generateButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            generate();
        }
    });
    generateGrid.setWidget(0, 1, generateButton);
    topPanel.setWidget(4, 0, generateGrid);
    HTMLTable configTable = new Grid(3, 2);
    configTable.setText(0, 0, "Barcode size");
    configTable.setWidget(0, 1, sizeList);
    configTable.setText(1, 0, "Error correction");
    configTable.setWidget(1, 1, ecLevelList);
    configTable.setText(2, 0, "Character encoding");
    configTable.setWidget(2, 1, encodingList);
    setGridStyle(configTable);
    topPanel.setWidget(3, 0, configTable);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Button(com.google.gwt.user.client.ui.Button) Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HTMLTable(com.google.gwt.user.client.ui.HTMLTable)

Aggregations

HTMLTable (com.google.gwt.user.client.ui.HTMLTable)2 EntryPoint (com.google.gwt.core.client.EntryPoint)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Button (com.google.gwt.user.client.ui.Button)1 Grid (com.google.gwt.user.client.ui.Grid)1