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

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

Introduction

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

Prototype

public FlexTable() 

Source Link

Usage

From source file:com.allen_sauer.gwt.dnd.demo.client.example.puzzle.PuzzleExample.java

License:Apache License

public PuzzleExample(DemoDragHandler demoDragHandler) {
    addStyleName(CSS_DEMO_PUZZLE_EXAMPLE);

    // use the boundary panel as this composite's widget
    AbsolutePanel boundaryPanel = new AbsolutePanel();
    boundaryPanel.setPixelSize(500, 300);
    setWidget(boundaryPanel);//from   w  w w  .  j a va2  s.c o m

    // initialize our flex table
    FlexTable flexTable = new FlexTable();
    flexTable.setStyleName(CSS_DEMO_PUZZLE_TABLE);
    boundaryPanel.add(flexTable, 50, 20);

    // initialize our drag controller
    dragController = new PickupDragController(boundaryPanel, false);
    dragController.addDragHandler(demoDragHandler);
    dragController.setBehaviorMultipleSelection(false);

    // create our grid
    for (int i = 0; i < COLUMNS; i++) {
        for (int j = 0; j < ROWS; j++) {
            // create a simple panel drop target for the current cell
            SimplePanel simplePanel = new SimplePanel();
            simplePanel.setPixelSize(IMAGE_WIDTH, IMAGE_HEIGHT);
            flexTable.setWidget(i, j, simplePanel);
            flexTable.getCellFormatter().setStyleName(i, j, CSS_DEMO_PUZZLE_CELL);

            // place a pumpkin in each panel in the cells in the first column
            if (j == 0) {
                simplePanel.setWidget(createDraggable());
            }

            // instantiate a drop controller of the panel in the current cell
            SetWidgetDropController dropController = new SetWidgetDropController(simplePanel);
            dragController.registerDropController(dropController);
        }
    }
}

From source file:com.allen_sauer.gwt.voices.demo.client.ui.SupportedMimeTypeSummary.java

License:Apache License

public SupportedMimeTypeSummary() {
    VerticalPanel containerPanel = new VerticalPanel();
    containerPanel.clear();/*from   w  ww  .  ja  va 2s. c o m*/

    containerPanel.add(new HTML("Your user agent is:"));
    HTML userAgentHTML = new HTML(getUserAgent());
    userAgentHTML.addStyleName(DemoClientBundle.INSTANCE.css().demoUserAgent());
    containerPanel.add(userAgentHTML);
    containerPanel.add(new HTML("This browser/platform," + " and its installed plugins,"
            + " provide the following sound support via gwt-voices:"));

    FlexTable flexTable = new FlexTable();
    flexTable.addStyleName(DemoClientBundle.INSTANCE.css().demoSupportedMimeTypeSummaryTable());
    containerPanel.add(flexTable);
    flexTable.setWidget(0, 0, new HTML("MIME Type"));
    flexTable.setWidget(0, 1, new HTML("Web Audio API"));
    flexTable.setWidget(0, 2, new HTML("HTML5 audio"));
    flexTable.setWidget(0, 3, new HTML("Native browser <i>or</i> Plugin based support"));
    flexTable.setWidget(0, 4, new HTML("Flash based support"));
    flexTable.getRowFormatter().addStyleName(0, DemoClientBundle.INSTANCE.css().header());

    SoundController soundController = new SoundController();

    int i = 0;
    for (String mimeType : VoicesDemo.MIME_TYPES) {
        i++;

        // Native/Plugin based support
        MimeTypeSupport nativeMimeTypeSupport = NativeSound.getMimeTypeSupport(mimeType);
        String nativeMimeTypeSupportText = mimeTypeSupportToString(nativeMimeTypeSupport);
        Sound dummySound = soundController.createSound(Sound.MIME_TYPE_AUDIO_BASIC, "/empty.au");
        if (nativeMimeTypeSupport == MIME_TYPE_SUPPORT_READY) {
            nativeMimeTypeSupportText += " via <code>" + dummySound.getSoundType() + "</code>";
        }

        // Flash based support
        VoicesMovie movieWidget = new VoicesMovie("gwt-voices-dummy", GWT.getModuleBaseURL());
        MimeTypeSupport flashMimeTypeSupport = movieWidget.getMimeTypeSupport(mimeType);
        String flashMimeTypeSupportText = mimeTypeSupportToString(flashMimeTypeSupport);

        // HTML5 audio
        MimeTypeSupport html5MimeTypeSupport = Html5Sound.getMimeTypeSupport(mimeType);
        String html5MimeTypeSupportText = mimeTypeSupportToString(html5MimeTypeSupport);

        // Web Audio API
        MimeTypeSupport webAudioMimeTypeSupport = WebAudioSound.getMimeTypeSupport(mimeType);
        String webAudioMimeTypeSupportText = mimeTypeSupportToString(webAudioMimeTypeSupport);

        // Place results in the table
        flexTable.setWidget(i + 1, 0, new HTML("<code>" + mimeType + "</code>"));
        flexTable.setWidget(i + 1, 1, new HTML(webAudioMimeTypeSupportText));
        flexTable.setWidget(i + 1, 2, new HTML(html5MimeTypeSupportText));
        flexTable.setWidget(i + 1, 3, new HTML(nativeMimeTypeSupportText));
        flexTable.setWidget(i + 1, 4, new HTML(flashMimeTypeSupportText));
        flexTable.getRowFormatter().addStyleName(i + 1,
                i % 2 == 0 ? DemoClientBundle.INSTANCE.css().odd() : DemoClientBundle.INSTANCE.css().even());
    }

    initWidget(containerPanel);
}

From source file:com.anzsoft.client.ui.LoginForm.java

License:Open Source License

private Widget createAdvancedForm() {
    iJabConstants constants = (iJabConstants) GWT.create(iJabConstants.class);
    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);/* w ww. ja  va 2  s.c om*/
    layout.setWidth("300px");
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    /*
    layout.setHTML(0, 0,constants.iJabLogin());
    cellFormatter.setColSpan(0, 0, 2);
    cellFormatter.setHorizontalAlignment(0, 0,
        HasHorizontalAlignment.ALIGN_CENTER);
    */
    // Add some standard form options
    final TextBox userBox = new TextBox();
    userBox.setText("imdev");
    layout.setHTML(0, 0, constants.user());
    layout.setWidget(0, 1, userBox);
    final PasswordTextBox passBox = new PasswordTextBox();
    passBox.setText("imdev631");

    layout.setHTML(1, 0, constants.password());
    layout.setWidget(1, 1, passBox);

    // Create some advanced options
    Grid advancedOptions = new Grid(5, 2);
    advancedOptions.setCellSpacing(6);

    final TextBox hostBox = new TextBox();
    final TextBox portBox = new TextBox();
    final TextBox domainBox = new TextBox();
    final CheckBox authCheck = new CheckBox("SASL");
    authCheck.setChecked(false);

    hostBox.setEnabled(false);
    portBox.setEnabled(false);
    domainBox.setEnabled(false);
    authCheck.setEnabled(false);

    final CheckBox serverConfig = new CheckBox(constants.defineServerConfig());
    advancedOptions.setWidget(0, 0, serverConfig);
    serverConfig.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (serverConfig.isChecked()) {
                hostBox.setEnabled(true);
                portBox.setEnabled(true);
                domainBox.setEnabled(true);
                authCheck.setEnabled(true);
            } else {
                hostBox.setEnabled(false);
                portBox.setEnabled(false);
                domainBox.setEnabled(false);
                authCheck.setEnabled(false);
            }

        }

    });

    serverConfig.setChecked(false);

    advancedOptions.setHTML(1, 0, constants.domain());
    advancedOptions.setWidget(1, 1, hostBox);

    advancedOptions.setHTML(2, 0, constants.host());
    advancedOptions.setWidget(2, 1, portBox);

    advancedOptions.setHTML(3, 0, constants.port());
    advancedOptions.setWidget(3, 1, domainBox);

    advancedOptions.setWidget(4, 0, authCheck);

    // Add advanced options to form in a disclosure panel
    DisclosurePanel advancedDisclosure = new DisclosurePanel(constants.moreOptions());
    advancedDisclosure.setAnimationEnabled(true);
    advancedDisclosure.ensureDebugId("cwDisclosurePanel");
    advancedDisclosure.setContent(advancedOptions);
    layout.setWidget(2, 0, advancedDisclosure);

    Button loginButton = new Button(constants.login());

    layout.setWidget(3, 0, loginButton);
    loginButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            String user = userBox.getText();
            String pass = passBox.getText();
            String domain = domainBox.getText();
            String host = domainBox.getText();
            boolean sasl = authCheck.isChecked();
            if (serverConfig.isChecked()) {
                int port = Integer.parseInt(portBox.getText());
                //JabberApp.instance().onLogin(host, port, domain, sasl, user, pass);
            } else {
                //JabberApp.instance().onLogin(user, pass);
            }
        }

    });

    cellFormatter.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);

    cellFormatter.setColSpan(3, 0, 2);

    return layout;
}

From source file:com.appspot.codsallarts.client.Application.java

License:Apache License

/**
 * Create the panel at the top of the page that contains the title and links.
 *///from ww  w.  ja va2  s.co  m
private void createTopPanel() {
    boolean isRTL = LocaleInfo.getCurrentLocale().isRTL();
    topPanel = new FlexTable();
    topPanel.setCellPadding(0);
    topPanel.setCellSpacing(0);
    topPanel.setStyleName(DEFAULT_STYLE_NAME + "-top");
    FlexCellFormatter formatter = topPanel.getFlexCellFormatter();

    // Setup the links cell
    linksPanel = new HorizontalPanel();
    topPanel.setWidget(0, 0, linksPanel);
    formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-links");
    if (isRTL) {
        formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
    } else {
        formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    }
    formatter.setColSpan(0, 0, 2);

    // Setup the title cell
    setTitleWidget(null);
    formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-title");

    // Setup the options cell
    setOptionsWidget(null);
    formatter.setStyleName(1, 1, DEFAULT_STYLE_NAME + "-options");
    if (isRTL) {
        formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT);
    } else {
        formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    // Align the content to the top
    topPanel.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
    topPanel.getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP);
}

From source file:com.ariesmcrae.rel.client.view.RelationshipViewImpl.java

License:Open Source License

public RelationshipViewImpl() {
    diffTable = new FlexTable();
    initDiffTable();
    initWidget(uiBinder.createAndBindUi(this));
}

From source file:com.bearsoft.gwt.ui.widgets.grid.Grid.java

public Grid(ProvidesKey<T> aKeyProvider) {
    super();/*  w w  w.ja v  a2s  .  c  om*/
    getElement().getStyle().setPosition(Style.Position.RELATIVE);
    getElement().appendChild(tdsStyleElement);
    getElement().appendChild(cellsStyleElement);
    getElement().appendChild(oddRowsStyleElement);
    getElement().appendChild(evenRowsStyleElement);
    setRowsHeight(25);
    hive = new FlexTable();
    setWidget(hive);
    hive.setCellPadding(0);
    hive.setCellSpacing(0);
    hive.setBorderWidth(0);
    headerLeft = new GridSection<T>(aKeyProvider);
    headerLeftContainer = new ScrollPanel(headerLeft);
    headerRight = new GridSection<T>(aKeyProvider);
    headerRightContainer = new ScrollPanel(headerRight);
    frozenLeft = new GridSection<T>(aKeyProvider) {

        @Override
        protected void replaceAllChildren(List<T> values, SafeHtml html) {
            super.replaceAllChildren(values, html);
            footerLeft.redrawFooters();
        }

        @Override
        protected void replaceChildren(List<T> values, int start, SafeHtml html) {
            super.replaceChildren(values, start, html);
            footerLeft.redrawFooters();
        }

    };

    frozenLeftContainer = new ScrollPanel(frozenLeft);
    frozenRight = new GridSection<T>(aKeyProvider) {

        @Override
        protected void replaceAllChildren(List<T> values, SafeHtml html) {
            super.replaceAllChildren(values, html);
            footerRight.redrawFooters();
        }

        @Override
        protected void replaceChildren(List<T> values, int start, SafeHtml html) {
            super.replaceChildren(values, start, html);
            footerRight.redrawFooters();
        }

    };
    frozenRightContainer = new ScrollPanel(frozenRight);
    scrollableLeft = new GridSection<T>(aKeyProvider) {

        @Override
        protected void replaceAllChildren(List<T> values, SafeHtml html) {
            super.replaceAllChildren(values, html);
            footerLeft.redrawFooters();
        }

        @Override
        protected void replaceChildren(List<T> values, int start, SafeHtml html) {
            super.replaceChildren(values, start, html);
            footerLeft.redrawFooters();
        }

    };
    scrollableLeftContainer = new ScrollPanel(scrollableLeft);
    scrollableRight = new GridSection<T>(aKeyProvider) {

        @Override
        protected void replaceAllChildren(List<T> values, SafeHtml html) {
            super.replaceAllChildren(values, html);
            footerRight.redrawFooters();
        }

        @Override
        protected void replaceChildren(List<T> values, int start, SafeHtml html) {
            super.replaceChildren(values, start, html);
            footerRight.redrawFooters();
        }
    };
    scrollableRightContainer = new ScrollPanel(scrollableRight);
    footerLeft = new GridSection<>(aKeyProvider);
    footerLeftContainer = new ScrollPanel(footerLeft);
    footerRight = new GridSection<>(aKeyProvider);
    footerRightContainer = new ScrollPanel(footerRight);
    // positioning context / overflow setup
    // overflow
    for (Widget w : new Widget[] { headerLeftContainer, headerRightContainer, frozenLeftContainer,
            frozenRightContainer, scrollableLeftContainer, footerLeftContainer, footerRightContainer }) {
        w.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
    }
    // scrollableRightContainer.getElement().getStyle().setOverflow(Style.Overflow.AUTO);
    // default value
    // context
    for (Widget w : new Widget[] { headerLeftContainer, headerRightContainer, frozenLeftContainer,
            frozenRightContainer, scrollableLeftContainer, scrollableRightContainer, footerLeftContainer,
            footerRightContainer }) {
        w.getElement().getFirstChildElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    }
    // propagation of some widths
    headerLeft.setWidthPropagator(new GridWidthPropagator<T>(headerLeft) {

        @Override
        public void changed() {
            super.changed();
            propagateHeaderWidth();
        }

    });
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { headerRight, frozenLeft,
            frozenRight, scrollableLeft, scrollableRight, footerLeft, footerRight }) {
        section.setWidthPropagator(new GridWidthPropagator<>(section));
    }
    headerLeft.setColumnsPartners(new AbstractCellTable[] { frozenLeft, scrollableLeft, footerLeft });
    headerRight.setColumnsPartners(new AbstractCellTable[] { frozenRight, scrollableRight, footerRight });
    ColumnsRemover leftColumnsRemover = new ColumnsRemoverAdapter<T>(headerLeft, frozenLeft, scrollableLeft,
            footerLeft);
    ColumnsRemover rightColumnsRemover = new ColumnsRemoverAdapter<T>(headerRight, frozenRight, scrollableRight,
            footerRight);
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { headerLeft, frozenLeft,
            scrollableLeft, footerLeft }) {
        section.setColumnsRemover(leftColumnsRemover);
    }
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { headerRight, frozenRight,
            scrollableRight, footerRight }) {
        section.setColumnsRemover(rightColumnsRemover);
    }
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { frozenLeft, scrollableLeft,
            footerLeft }) {
        section.setHeaderSource(headerLeft);
    }
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { frozenRight, scrollableRight,
            footerRight }) {
        section.setHeaderSource(headerRight);
    }
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { headerLeft, frozenLeft,
            scrollableLeft }) {
        section.setFooterSource(footerLeft);
    }
    for (GridSection<T> section : (GridSection<T>[]) new GridSection<?>[] { headerRight, frozenRight,
            scrollableRight }) {
        section.setFooterSource(footerRight);
    }

    // hive organization
    hive.setWidget(0, 0, headerLeftContainer);
    hive.setWidget(0, 1, headerRightContainer);
    hive.setWidget(1, 0, frozenLeftContainer);
    hive.setWidget(1, 1, frozenRightContainer);
    hive.setWidget(2, 0, scrollableLeftContainer);
    hive.setWidget(2, 1, scrollableRightContainer);
    hive.setWidget(3, 0, footerLeftContainer);
    hive.setWidget(3, 1, footerRightContainer);

    for (Widget w : new Widget[] { headerLeftContainer, headerRightContainer, frozenLeftContainer,
            frozenRightContainer, scrollableLeftContainer, scrollableRightContainer, footerLeftContainer,
            footerRightContainer }) {
        w.setWidth("100%");
        w.setHeight("100%");
    }
    // misc
    for (Widget w : new Widget[] { headerRightContainer, frozenRightContainer, footerRightContainer,
            scrollableLeftContainer }) {
        w.getElement().getParentElement().getStyle().setOverflow(Style.Overflow.HIDDEN);
    }
    hive.getElement().getStyle().setTableLayout(Style.TableLayout.FIXED);
    hive.getElement().getStyle().setPosition(Style.Position.RELATIVE);
    for (CellTable<?> tbl : new CellTable<?>[] { headerLeft, headerRight, frozenLeft, frozenRight,
            scrollableLeft, scrollableRight, footerLeft, footerRight }) {
        tbl.setTableLayoutFixed(true);
    }
    // header
    headerLeft.setHeaderBuilder(new ThemedHeaderOrFooterBuilder<T>(headerLeft, false, this));
    headerLeft.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(headerLeft, true));
    headerRight.setHeaderBuilder(new ThemedHeaderOrFooterBuilder<T>(headerRight, false, this));
    headerRight.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(headerRight, true));
    // footer
    footerLeft.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(footerLeft, false));
    footerLeft.setFooterBuilder(new ThemedHeaderOrFooterBuilder<T>(footerLeft, true));
    footerRight.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(footerRight, false));
    footerRight.setFooterBuilder(new ThemedHeaderOrFooterBuilder<T>(footerRight, true));
    // data bodies
    for (GridSection<?> section : new GridSection<?>[] { frozenLeft, frozenRight, scrollableLeft,
            scrollableRight }) {
        GridSection<T> gSection = (GridSection<T>) section;
        gSection.setHeaderBuilder(new NullHeaderOrFooterBuilder<T>(gSection, false));
        gSection.setFooterBuilder(new NullHeaderOrFooterBuilder<T>(gSection, true));
    }
    for (GridSection<?> section : new GridSection<?>[] { headerLeft, headerRight, frozenLeft, frozenRight,
            scrollableLeft, scrollableRight, footerLeft, footerRight }) {
        section.setAutoHeaderRefreshDisabled(true);
    }
    for (GridSection<?> section : new GridSection<?>[] { headerLeft, headerRight, footerLeft, footerRight }) {
        section.setAutoFooterRefreshDisabled(true);
    }
    // cells
    installCellBuilders();

    scrollableRightContainer.addScrollHandler(new ScrollHandler() {

        @Override
        public void onScroll(ScrollEvent event) {
            int aimTop = scrollableRightContainer.getElement().getScrollTop();
            int aimLeft = scrollableRightContainer.getElement().getScrollLeft();

            scrollableLeftContainer.getElement().setScrollTop(aimTop);
            int factTopDelta = aimTop - scrollableLeftContainer.getElement().getScrollTop();
            if (factTopDelta > 0) {
                scrollableLeftContainer.getElement().getStyle().setBottom(factTopDelta, Style.Unit.PX);
            } else {
                scrollableLeftContainer.getElement().getStyle().clearBottom();
            }
            headerRightContainer.getElement().setScrollLeft(aimLeft);
            int factLeftDelta0 = aimLeft - headerRightContainer.getElement().getScrollLeft();
            if (factLeftDelta0 > 0) {
                headerRightContainer.getElement().getStyle().setRight(factLeftDelta0, Style.Unit.PX);
            } else {
                headerRightContainer.getElement().getStyle().clearRight();
            }
            frozenRightContainer.getElement().setScrollLeft(aimLeft);
            int factLeftDelta1 = aimLeft - frozenRightContainer.getElement().getScrollLeft();
            if (factLeftDelta1 > 0) {
                frozenRightContainer.getElement().getStyle().setRight(factLeftDelta1, Style.Unit.PX);
            } else {
                frozenRightContainer.getElement().getStyle().clearRight();
            }
            footerRightContainer.getElement()
                    .setScrollLeft(scrollableRightContainer.getElement().getScrollLeft());
            int factLeftDelta2 = aimLeft - footerRightContainer.getElement().getScrollLeft();
            if (factLeftDelta2 > 0) {
                footerRightContainer.getElement().getStyle().setRight(factLeftDelta2, Style.Unit.PX);
            } else {
                footerRightContainer.getElement().getStyle().clearRight();
            }
        }

    });
    ghostLine = Document.get().createDivElement();
    ghostLine.addClassName(RULER_STYLE);
    ghostLine.getStyle().setPosition(Style.Position.ABSOLUTE);
    ghostLine.getStyle().setTop(0, Style.Unit.PX);
    ghostColumn = Document.get().createDivElement();
    ghostColumn.addClassName(COLUMN_PHANTOM_STYLE);
    ghostColumn.getStyle().setPosition(Style.Position.ABSOLUTE);
    ghostColumn.getStyle().setTop(0, Style.Unit.PX);
    addDomHandler(new DragEnterHandler() {

        @Override
        public void onDragEnter(DragEnterEvent event) {
            if (DraggedColumn.instance != null) {
                if (DraggedColumn.instance.isMove()) {
                    event.preventDefault();
                    event.stopPropagation();
                    DraggedColumn<T> target = findTargetDraggedColumn(event.getNativeEvent().getEventTarget());
                    if (target != null) {
                        showColumnMoveDecorations(target);
                        event.getDataTransfer().<XDataTransfer>cast().setDropEffect("move");
                    } else {
                        event.getDataTransfer().<XDataTransfer>cast().setDropEffect("none");
                    }
                } else {
                }
            } else {
                event.getDataTransfer().<XDataTransfer>cast().setDropEffect("none");
            }
        }
    }, DragEnterEvent.getType());
    addDomHandler(new DragHandler() {

        @Override
        public void onDrag(DragEvent event) {
            if (DraggedColumn.instance != null && DraggedColumn.instance.isResize()) {
                event.stopPropagation();
                /*
                int newWidth = event.getNativeEvent().getClientX() - DraggedColumn.instance.getCellElement().getAbsoluteLeft();
                if (newWidth > MINIMUM_COLUMN_WIDTH) {
                   event.getDataTransfer().<XDataTransfer> cast().setDropEffect("move");
                } else {
                   event.getDataTransfer().<XDataTransfer> cast().setDropEffect("none");
                }
                */
            }
        }
    }, DragEvent.getType());
    addDomHandler(new DragOverHandler() {

        @Override
        public void onDragOver(DragOverEvent event) {
            if (DraggedColumn.instance != null) {
                event.preventDefault();
                event.stopPropagation();
                if (DraggedColumn.instance.isMove()) {
                    DraggedColumn<T> target = findTargetDraggedColumn(event.getNativeEvent().getEventTarget());
                    if (target != null) {
                        event.getDataTransfer().<XDataTransfer>cast().setDropEffect("move");
                    } else {
                        hideColumnDecorations();
                        event.getDataTransfer().<XDataTransfer>cast().setDropEffect("none");
                    }
                } else {
                    Element hostElement = Grid.this.getElement();
                    int clientX = event.getNativeEvent().getClientX();
                    int hostAbsX = hostElement.getAbsoluteLeft();
                    int hostScrollX = hostElement.getScrollLeft();
                    int docScrollX = hostElement.getOwnerDocument().getScrollLeft();
                    int relativeX = clientX - hostAbsX + hostScrollX + docScrollX;
                    ghostLine.getStyle().setLeft(relativeX, Style.Unit.PX);
                    ghostLine.getStyle().setHeight(hostElement.getClientHeight(), Style.Unit.PX);
                    if (ghostLine.getParentElement() != hostElement) {
                        hostElement.appendChild(ghostLine);
                    }
                }
            }
        }
    }, DragOverEvent.getType());
    addDomHandler(new DragLeaveHandler() {

        @Override
        public void onDragLeave(DragLeaveEvent event) {
            if (DraggedColumn.instance != null) {
                event.stopPropagation();
                if (DraggedColumn.instance.isMove()) {
                    if (event.getNativeEvent().getEventTarget() == (JavaScriptObject) Grid.this.getElement()) {
                        hideColumnDecorations();
                    }
                }
            }
        }
    }, DragLeaveEvent.getType());
    addDomHandler(new DragEndHandler() {

        @Override
        public void onDragEnd(DragEndEvent event) {
            event.stopPropagation();
            hideColumnDecorations();
            DraggedColumn.instance = null;
        }
    }, DragEndEvent.getType());
    addDomHandler(new DropHandler() {

        @Override
        public void onDrop(DropEvent event) {
            DraggedColumn<?> source = DraggedColumn.instance;
            DraggedColumn<T> target = targetDraggedColumn;
            hideColumnDecorations();
            DraggedColumn.instance = null;
            if (source != null) {
                event.preventDefault();
                event.stopPropagation();
                if (source.isMove()) {
                    AbstractCellTable<T> sourceSection = (AbstractCellTable<T>) source.getTable();
                    // target table may be any section in our grid
                    if (target != null) {
                        Header<?> sourceHeader = source.getHeader();
                        Header<?> targetHeader = target.getHeader();
                        if (sourceHeader instanceof DraggableHeader<?>
                                && targetHeader instanceof DraggableHeader<?>) {
                            DraggableHeader<T> sourceDH = (DraggableHeader<T>) sourceHeader;
                            DraggableHeader<T> targetDH = (DraggableHeader<T>) targetHeader;
                            moveColumnNode(sourceDH.getHeaderNode(), targetDH.getHeaderNode());
                        } else {
                            int sourceIndex = source.getColumnIndex();
                            int targetIndex = target.getColumnIndex();
                            GridSection<T> targetSection = (GridSection<T>) target.getTable();

                            boolean isSourceLeft = sourceSection == headerLeft || sourceSection == frozenLeft
                                    || sourceSection == scrollableLeft || sourceSection == footerLeft;
                            boolean isTargetLeft = targetSection == headerLeft || targetSection == frozenLeft
                                    || targetSection == scrollableLeft || targetSection == footerLeft;
                            sourceSection = isSourceLeft ? headerLeft : headerRight;
                            targetSection = isTargetLeft ? headerLeft : headerRight;
                            int generalSourceIndex = isSourceLeft ? sourceIndex : sourceIndex + frozenColumns;
                            int generalTargetIndex = isTargetLeft ? targetIndex : targetIndex + frozenColumns;
                            Header<?> header = sourceSection.getHeader(sourceIndex);
                            if (header instanceof DraggableHeader) {
                                ((DraggableHeader) header).setTable(targetSection);
                            }
                            if (generalSourceIndex != generalTargetIndex) {
                                Column<T, ?> column = (Column<T, ?>) source.getColumn();
                                if (!(header instanceof DraggableHeader)
                                        || ((DraggableHeader) header).isMoveable()) {
                                    moveColumn(generalSourceIndex, generalTargetIndex);
                                }
                            }
                        }
                    }
                } else {
                    Header<?> header = source.getHeader();
                    if (!(header instanceof DraggableHeader) || ((DraggableHeader) header).isResizable()) {
                        int newWidth = Math.max(
                                event.getNativeEvent().getClientX() - source.getCellElement().getAbsoluteLeft(),
                                MINIMUM_COLUMN_WIDTH);
                        // Source and target tables are the same, so we can
                        // cast to DraggedColumn<T> with no care
                        setColumnWidthFromHeaderDrag(((DraggedColumn<T>) source).getColumn(), newWidth,
                                Style.Unit.PX);
                    }
                }
            }
        }
    }, DropEvent.getType());

    columnsChevron.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);
    columnsChevron.getElement().addClassName(COLUMNS_CHEVRON_STYLE);
    getElement().appendChild(columnsChevron.getElement());
    columnsChevron.addDomHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            PopupPanel pp = new PopupPanel();
            pp.setAutoHideEnabled(true);
            pp.setAutoHideOnHistoryEventsEnabled(true);
            pp.setAnimationEnabled(true);
            MenuBar columnsMenu = new MenuBar(true);
            fillColumns(columnsMenu, headerLeft);
            fillColumns(columnsMenu, headerRight);
            pp.setWidget(columnsMenu);
            pp.setPopupPosition(columnsChevron.getAbsoluteLeft(), columnsChevron.getAbsoluteTop());
            pp.showRelativeTo(columnsChevron);
        }

        private void fillColumns(MenuBar aTarget, final GridSection<T> aSection) {
            for (int i = 0; i < aSection.getColumnCount(); i++) {
                Header<?> h = aSection.getHeader(i);
                final Column<T, ?> column = aSection.getColumn(i);
                SafeHtml rendered;
                if (h.getValue() instanceof String) {
                    String hVal = (String) h.getValue();
                    rendered = hVal.startsWith("<html>") ? SafeHtmlUtils.fromTrustedString(hVal.substring(6))
                            : SafeHtmlUtils.fromString(hVal);
                } else {
                    Cell.Context context = new Cell.Context(0, i, h.getKey());
                    SafeHtmlBuilder sb = new SafeHtmlBuilder();
                    h.render(context, sb);
                    rendered = sb.toSafeHtml();
                }
                MenuItemCheckBox miCheck = new MenuItemCheckBox(!aSection.isColumnHidden(column),
                        rendered.asString(), true);
                miCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

                    @Override
                    public void onValueChange(ValueChangeEvent<Boolean> event) {
                        if (Boolean.TRUE.equals(event.getValue())) {
                            showColumn(column);
                        } else {
                            hideColumn(column);
                        }
                        Grid.this.onResize();
                    }

                });
                aTarget.addItem(miCheck);
            }
        }

    }, ClickEvent.getType());

    ColumnSortEvent.Handler sectionSortHandler = new ColumnSortEvent.Handler() {

        @Override
        public void onColumnSort(ColumnSortEvent event) {
            boolean isCtrlKey = ((GridSection<?>) event.getSource()).isCtrlKey();
            boolean contains = false;
            int containsAt = -1;
            for (int i = 0; i < sortList.size(); i++) {
                if (sortList.get(i).getColumn() == event.getColumn()) {
                    contains = true;
                    containsAt = i;
                    break;
                }
            }
            if (!contains) {
                if (!isCtrlKey) {
                    sortList.clear();
                }
                sortList.insert(sortList.size(), new ColumnSortList.ColumnSortInfo(event.getColumn(), true));
            } else {
                boolean wasAscending = sortList.get(containsAt).isAscending();
                if (!isCtrlKey) {
                    sortList.clear();
                    if (wasAscending) {
                        sortList.push(new ColumnSortList.ColumnSortInfo(event.getColumn(), false));
                    }
                } else {
                    sortList.remove(sortList.get(containsAt));
                    if (wasAscending) {
                        sortList.insert(containsAt,
                                new ColumnSortList.ColumnSortInfo(event.getColumn(), false));
                    }
                }
            }
            ColumnSortEvent.fire(Grid.this, sortList);
        }
    };
    headerLeft.getColumnSortList().setLimit(1);
    headerLeft.addColumnSortHandler(sectionSortHandler);
    headerRight.getColumnSortList().setLimit(1);
    headerRight.addColumnSortHandler(sectionSortHandler);
    gridColor = PublishedColor.create(211, 211, 211, 255);
    regenerateDynamicTDStyles();
    regenerateDynamicOddRowsStyles();
    getElement().<XElement>cast().addResizingTransitionEnd(this);
}

From source file:com.databasepreservation.visualization.client.common.lists.AsyncTableCell.java

public AsyncTableCell(Filter filter, boolean justActive, Facets facets, String summary, boolean selectable,
        boolean exportable, int initialPageSize, int pageSizeIncrement, O object) {
    super();//from   w  ww .  j a va  2  s . com

    this.initialPageSize = initialPageSize;
    this.pageSizeIncrement = pageSizeIncrement;
    this.object = object;

    if (summary == null) {
        summary = "summary" + Random.nextInt(1000);
    }

    this.filter = filter;
    this.justActive = justActive;
    this.facets = facets;
    this.selectable = selectable;

    display = new AccessibleCellTable<T>(getInitialPageSize(),
            (MyCellTableResources) GWT.create(MyCellTableResources.class), getKeyProvider(), summary);
    display.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    display.setLoadingIndicator(new HTML(SafeHtmlUtils.fromSafeConstant(
            "<div class='spinner'><div class='double-bounce1'></div><div class='double-bounce2'></div></div>")));

    configure(display);

    this.dataProvider = new MyAsyncDataProvider<T>(display, new IndexResultDataProvider<T>() {

        @Override
        public void getData(Sublist sublist, ColumnSortList columnSortList,
                AsyncCallback<IndexResult<T>> callback) {
            AsyncTableCell.this.getData(sublist, columnSortList, callback);
        }
    }) {

        @Override
        protected void fireChangeEvent(IndexResult<T> result) {
            ValueChangeEvent.fire(AsyncTableCell.this, result);
        }
    };

    dataProvider.addDataDisplay(display);

    if (exportable) {
        // mimic PageSizePager
        exportButtons = new FlexTable();
        exportButtons.setCellPadding(0);
        exportButtons.setCellSpacing(0);

        exportVisibleButton = new Anchor("Export visible");
        exportVisibleButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                AsyncTableCell.this.exportVisibleClickHandler();
            }
        });

        exportAllButton = new Anchor("Export all");
        exportAllButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                AsyncTableCell.this.exportAllClickHandler();
            }
        });

        exportButtons.setWidget(0, 0, exportVisibleButton);
        exportButtons.setText(0, 1, " | ");
        exportButtons.setWidget(0, 2, exportAllButton);
    }

    resultsPager = new AccessibleSimplePager(AccessibleSimplePager.TextLocation.LEFT,
            (SimplePager.Resources) GWT.create(SimplePager.Resources.class), false, initialPageSize, false,
            false, (SimplePager.ImageButtonsConstants) GWT.create(SimplePager.ImageButtonsConstants.class));
    resultsPager.setDisplay(display);

    pageSizePager = new PageSizePager(getPageSizePagerIncrement());
    pageSizePager.setDisplay(display);

    createSelectAllPanel();

    displayScroll = new ScrollPanel(display);
    displayScrollWrapper = new SimplePanel(displayScroll);

    add(selectAllPanel);
    add(displayScrollWrapper);
    add(resultsPager);
    if (exportButtons != null) {
        add(exportButtons);
    }
    add(pageSizePager);

    selectionModel = new SingleSelectionModel<>(getKeyProvider());

    Handler<T> selectionEventManager = getSelectionEventManager();
    if (selectionEventManager != null) {
        display.setSelectionModel(selectionModel, selectionEventManager);
    } else {
        display.setSelectionModel(selectionModel);
    }

    columnSortHandler = new AsyncHandler(display);
    display.addColumnSortHandler(columnSortHandler);

    display.addLoadingStateChangeHandler(new LoadingStateChangeEvent.Handler() {
        @Override
        public void onLoadingStateChanged(LoadingStateChangeEvent event) {
            if (LoadingStateChangeEvent.LoadingState.LOADED.equals(event.getLoadingState())) {
                handleScrollChanges();
            }
        }
    });

    addStyleName("my-asyncdatagrid");
    resultsPager.addStyleName("my-asyncdatagrid-pager-results");
    pageSizePager.addStyleName("my-asyncdatagrid-pager-pagesize");
    displayScrollWrapper.addStyleName("my-asyncdatagrid-display-scroll-wrapper");
    display.addStyleName("my-asyncdatagrid-display");
    if (exportButtons != null) {
        exportButtons.addStyleName("my-asyncdatagrid-pager-pagesize");
        // exportVisibleButton.addStyleName("btn btn-export btn-export-visible");
        // exportAllButton.addStyleName("btn btn-export btn-export-all");
    }

    displayScroll.addScrollHandler(new ScrollHandler() {
        @Override
        public void onScroll(ScrollEvent event) {
            handleScrollChanges();
        }
    });

    addValueChangeHandler(new ValueChangeHandler<IndexResult<T>>() {
        @Override
        public void onValueChange(ValueChangeEvent<IndexResult<T>> event) {
            selected = new HashSet<T>();
            hideSelectAllPanel();
        }
    });

    Label emptyInfo = new Label(messages.noItemsToDisplay());
    display.setEmptyTableWidget(emptyInfo);
}

From source file:com.dawg6.gwt.client.ApplicationPanel.java

License:Open Source License

public static DialogBox showDialogBox(String title, IsWidget component, int buttons,
        final DialogBoxResultHandler handler) {
    // Create the popup dialog box
    final DialogBox dialogBox = createDialogBox();
    dialogBox.setText(title);/* www . j  a  v  a 2s  . co  m*/
    dialogBox.setAnimationEnabled(true);
    dialogBox.setModal(false);
    FlexTable table = new FlexTable();
    table.setWidget(0, 0, component);
    dialogBox.setWidget(table);

    HorizontalPanel row = new HorizontalPanel();
    row.setSpacing(5);
    row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.setWidget(1, 0, row);

    boolean firstButton = true;

    if (buttons == 0)
        buttons = OK;

    for (final ButtonInfo b : allButtons) {
        if ((buttons > 0) && ((buttons & b.id) != 0)) {
            final Button button = createDialogBoxButton(b.label);

            button.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    dialogBox.hide();

                    if (handler != null)
                        handler.dialogBoxResult(b.id);
                }
            });
            row.add(button);

            if (firstButton) {
                button.setFocus(true);
                firstButton = false;
            }
        }
    }

    dialogBox.center();

    return dialogBox;
}

From source file:com.dawg6.web.dhcalc.client.AboutDialog.java

License:Open Source License

public AboutDialog() {

    flexTable = new FlexTable();
    flexTable.setBorderWidth(0);/*from ww w.  ja  va2 s  .co m*/
    flexTable.setCellPadding(5);
    initWidget(flexTable);

    Label lblNewLabel = new Label("DH DPS Calculator");
    lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    lblNewLabel.setStyleName("boldText");
    lblNewLabel.setWordWrap(false);
    flexTable.setWidget(0, 0, lblNewLabel);
    flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setSpacing(5);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(1, 0, horizontalPanel);

    Label lblNewLabel_1 = new Label("Version:");
    horizontalPanel.add(lblNewLabel_1);

    versionLabel = new Label(Version.getVersionString());
    horizontalPanel.add(versionLabel);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_1.setSpacing(5);
    horizontalPanel_1.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(3, 0, horizontalPanel_1);

    Label lblWritteByDawg = new Label("Written By:");
    horizontalPanel_1.add(lblWritteByDawg);

    Anchor label_1 = new Anchor("New label");
    label_1.setTarget("_blank");
    label_1.setText("dawg6");
    label_1.setHref("http://us.battle.net/d3/en/profile/Dawg6-1416/");
    horizontalPanel_1.add(label_1);

    Label lblNewLabel_2 = new Label("(");
    horizontalPanel_1.add(lblNewLabel_2);

    Anchor anchor_1 = new Anchor("New label");
    anchor_1.setText("scott@dawg6.com");
    anchor_1.setTarget("_blank");
    anchor_1.setHref("mailto:scott@dawg6.com");
    horizontalPanel_1.add(anchor_1);

    Label lblNewLabel_3 = new Label(")");
    horizontalPanel_1.add(lblNewLabel_3);
    flexTable.getCellFormatter().setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_2.setSpacing(5);
    horizontalPanel_2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(5, 0, horizontalPanel_2);

    Label lblRedditThread = new Label("Reddit Thread:");
    horizontalPanel_2.add(lblRedditThread);

    Anchor anchor = new Anchor("New label");
    anchor.setTarget("_blank");
    anchor.setText("http://redd.it/2jiynj");
    anchor.setHref("http://redd.it/2jiynj");
    horizontalPanel_2.add(anchor);
    flexTable.getCellFormatter().setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel_3.setSpacing(5);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(6, 0, horizontalPanel_3);

    Label lblBlizzardThread = new Label("Blizzard Thread:");
    horizontalPanel_3.add(lblBlizzardThread);

    Anchor anchor_2 = new Anchor("New label");
    anchor_2.setText("http://us.battle.net/d3/en/forum/topic/18706673688");
    anchor_2.setTarget("_blank");
    anchor_2.setHref("http://us.battle.net/d3/en/forum/topic/18706673688");
    horizontalPanel_3.add(anchor_2);
    flexTable.getCellFormatter().setHorizontalAlignment(6, 0, HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizontalPanel_4 = new HorizontalPanel();
    horizontalPanel_4.setSpacing(5);
    horizontalPanel_4.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    flexTable.setWidget(7, 0, horizontalPanel_4);

    Anchor anchor_3 = new Anchor("New label");
    anchor_3.setText("Change Log");
    anchor_3.setTarget("_blank");
    anchor_3.setHref("changeLog.txt?v2");
    horizontalPanel_4.add(anchor_3);

    Anchor anchor_4 = new Anchor("New label");
    anchor_4.setText("To-do List");
    anchor_4.setTarget("_blank");
    anchor_4.setHref("https://github.com/dawg6/dhcalc/issues");
    horizontalPanel_4.add(anchor_4);
    flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER);

    Anchor anchor_5 = new Anchor("Source Code");
    anchor_5.setTarget("_blank");
    anchor_5.setHref("https://github.com/dawg6/dhcalc");
    horizontalPanel_4.add(anchor_5);
    flexTable.getCellFormatter().setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_CENTER);

}

From source file:com.dawg6.web.dhcalc.client.BPData.java

License:Open Source License

public BPData() {

    VerticalPanel panel = new VerticalPanel();
    initWidget(panel);//from   w w  w  . j  a  va2  s  . c  o m

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setSpacing(5);
    panel.add(horizontalPanel);

    Label lblNewLabel = new Label("Skill:");
    lblNewLabel.setStyleName("boldText");
    horizontalPanel.add(lblNewLabel);

    skills = new ListBox();
    horizontalPanel.add(skills);

    Label lblNewLabel2 = new Label("Weapon Type:");
    lblNewLabel2.setStyleName("boldText");
    horizontalPanel.add(lblNewLabel2);

    weaponType = new ListBox();
    horizontalPanel.add(weaponType);

    for (WeaponType t : WeaponType.values()) {
        weaponType.addItem(t.getName(), t.name());
    }

    CaptionPanel cptnpnlNewPanel = new CaptionPanel("Skill Break Point Data");
    panel.add(cptnpnlNewPanel);

    table = new FlexTable();
    cptnpnlNewPanel.setContentWidget(table);
    table.setSize("5cm", "3cm");
    table.setStyleName("breakpointTable");
    table.setCellPadding(5);
    table.setBorderWidth(1);

    table.getRowFormatter().addStyleName(0, "headerRow");

    int col = 0;

    Label bp = new Label("BP");
    bp.setWordWrap(false);
    table.setWidget(0, col++, bp);

    Label fpa = new Label("FPA");
    fpa.setWordWrap(false);
    table.setWidget(0, col++, fpa);

    Label minAps = new Label("Min APS");
    minAps.setWordWrap(false);
    table.setWidget(0, col++, minAps);

    Label actualAps = new Label("Actual APS");
    actualAps.setWordWrap(false);
    table.setWidget(0, col++, actualAps);

    List<Pair<String, String>> list = new Vector<Pair<String, String>>();

    for (ActiveSkill s : ActiveSkill.values()) {

        if (DamageFunction.hasDamage(s) && (s.getFrames() != 0))
            list.add(new Pair<String, String>(s.getLongName(), s.name()));
    }

    Collections.sort(list, new Comparator<Pair<String, String>>() {

        @Override
        public int compare(Pair<String, String> o1, Pair<String, String> o2) {
            return o1.getA().toLowerCase().compareTo(o2.getA().toLowerCase());
        }
    });

    for (Pair<String, String> p : list) {
        skills.addItem(p.getA(), p.getB());
    }

    skills.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            skillChanged();
        }
    });

    weaponType.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            skillChanged();
        }
    });

    skills.setSelectedIndex(0);
    weaponType.setSelectedIndex(0);

    skillChanged();
}