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

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

Introduction

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

Prototype

protected CheckBox(Element elem) 

Source Link

Usage

From source file:com.google.sampling.experiential.client.EsmPanel.java

License:Open Source License

public EsmPanel(final SignalScheduleDAO schedule) {
    MyConstants myConstants = GWT.create(MyConstants.class);
    this.schedule = schedule;
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(2);/*from  ww w.j a  v a2 s.  c  om*/
    initWidget(verticalPanel);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(2);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setWidth("");

    Label lblFrequency = new Label(myConstants.frequency() + ":");
    lblFrequency.setStyleName("gwt-Label-Header");
    horizontalPanel.add(lblFrequency);
    ValueSpinnerFixed frequencySpinner = new ValueSpinnerFixed(schedule.getEsmFrequency(), 0, 100);
    frequencySpinner.getTextBox().setWidth("18px");
    frequencySpinner.setWidth("35px");
    horizontalPanel.add(frequencySpinner);
    frequencySpinner.getSpinner().addSpinnerListener(new SpinnerListener() {
        public void onSpinning(long value) {
            schedule.setEsmFrequency((int) value);
        }
    });

    Label lblPeriod = new Label(myConstants.period() + ": ");
    lblPeriod.setStyleName("gwt-Label-Header");
    horizontalPanel.add(lblPeriod);

    final ListBox listBox = new ListBox();
    for (int i = 0; i < SignalScheduleDAO.ESM_PERIODS.length; i++) {
        listBox.addItem(SignalScheduleDAO.ESM_PERIODS_NAMES[i]);
    }
    horizontalPanel.add(listBox);
    listBox.setVisibleItemCount(1);
    Integer period = schedule.getEsmPeriodInDays();
    if (period == null) {
        period = SignalScheduleDAO.DEFAULT_ESM_PERIOD;
        schedule.setEsmPeriodInDays(SignalScheduleDAO.DEFAULT_ESM_PERIOD);
    }
    listBox.setSelectedIndex(period);
    listBox.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            schedule.setEsmPeriodInDays(listBox.getSelectedIndex());
        }
    });
    verticalPanel.add(horizontalPanel);

    HorizontalPanel weekendsPanel = new HorizontalPanel();
    weekendsPanel.setSpacing(2);
    weekendsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(weekendsPanel);
    weekendsPanel.setWidth("");
    Label lblWeekends = new Label(myConstants.includeWeekends() + ": ");
    lblWeekends.setStyleName("gwt-Label-Header");
    weekendsPanel.add(lblWeekends);

    final CheckBox weekendsBox = new CheckBox("");
    weekendsPanel.add(weekendsBox);
    weekendsBox.setValue(schedule.getEsmWeekends());
    weekendsBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            schedule.setEsmWeekends(weekendsBox.getValue());
        }

    });

    HorizontalPanel horizontalPanel_1 = new HorizontalPanel();
    horizontalPanel_1.setSpacing(2);
    horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_1);
    horizontalPanel_1.setWidth("");

    Label lblStartHour = new Label(myConstants.startTime() + ":");
    lblStartHour.setStyleName("gwt-Label-Header");
    horizontalPanel_1.add(lblStartHour);
    lblStartHour.setWidth("83px");

    Date setTime = null;
    if (schedule.getEsmStartHour() != null) {
        setTime = new Date();
        long offset = schedule.getEsmStartHour();
        int hours = (int) (offset / (60 * 60 * 1000));
        int minutes = (int) (offset - (hours * 60 * 60 * 1000)) / (60 * 1000);
        setTime.setHours(hours);
        setTime.setMinutes(minutes);
        setTime.setSeconds(0);
    } else {
        Date now = new Date();
        now.setMinutes(0);
        now.setSeconds(0);
        setTime = now;
    }

    final TimePickerFixed startTimeBox = new TimePickerFixed(setTime, DateTimeFormat.getFormat("aa"),
            DateTimeFormat.getFormat("hh"), DateTimeFormat.getFormat("mm"), null);

    horizontalPanel_1.add(startTimeBox);

    HorizontalPanel horizontalPanel_2 = new HorizontalPanel();
    horizontalPanel_2.setSpacing(2);
    horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(horizontalPanel_2);
    horizontalPanel_2.setWidth("");
    startTimeBox.addValueChangeHandler(new ValueChangeHandler() {
        public void onValueChange(ValueChangeEvent event) {
            Date dateTime = startTimeBox.getDateTime();
            long offset = (dateTime.getHours() * 60 * 60 * 1000) + (dateTime.getMinutes() * 60 * 1000);
            schedule.setEsmStartHour(offset);
        }
    });

    Label lblEndTime = new Label(myConstants.endTime() + ":  ");
    lblEndTime.setStyleName("gwt-Label-Header");
    horizontalPanel_2.add(lblEndTime);
    lblEndTime.setWidth("83px");

    setTime = null;
    if (schedule.getEsmEndHour() != null) {
        setTime = new Date();
        long offset = schedule.getEsmEndHour();
        int hours = (int) (offset / (60 * 60 * 1000));
        int minutes = (int) (offset - (hours * 60 * 60 * 1000)) / (60 * 1000);
        setTime.setHours(hours);
        setTime.setMinutes(minutes);
    } else {
        Date now = new Date();
        now.setMinutes(0);
        now.setSeconds(0);
        setTime = now;
    }

    final TimePickerFixed endTimePicker = new TimePickerFixed(setTime, DateTimeFormat.getFormat("aa"),
            DateTimeFormat.getFormat("hh"), DateTimeFormat.getFormat("mm"), null);

    horizontalPanel_2.add(endTimePicker);
    endTimePicker.addValueChangeHandler(new ValueChangeHandler() {
        public void onValueChange(ValueChangeEvent event) {
            Date dateTime = endTimePicker.getDateTime();
            long offset = (dateTime.getHours() * 60 * 60 * 1000) + (dateTime.getMinutes() * 60 * 1000);
            schedule.setEsmEndHour(offset);
        }
    });

    TimeoutPanel timeoutPanel = new TimeoutPanel(schedule);
    verticalPanel.add(timeoutPanel);
    timeoutPanel.setWidth("286px");

    MinimumBufferPanel minimumBufferPanel = new MinimumBufferPanel(schedule);
    verticalPanel.add(minimumBufferPanel);
    minimumBufferPanel.setWidth("286px");

    SnoozePanel snoozePanel = new SnoozePanel(schedule);
    verticalPanel.add(snoozePanel);
    snoozePanel.setWidth("286px");

}

From source file:com.google.sampling.experiential.client.ListChoicesPanel.java

License:Open Source License

/**
 * @param input//w  w  w .j  a v a  2 s.  c  om
 */
public ListChoicesPanel(final InputDAO input) {
    this.input = input;
    mainPanel = new VerticalPanel();
    mainPanel.setSpacing(2);
    initWidget(mainPanel);

    final CheckBox multiselect = new CheckBox("Multiple selections");
    multiselect.setValue(input.getMultiselect());
    multiselect.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            input.setMultiselect(multiselect.getValue());
        }

    });
    mainPanel.add(multiselect);

    Label lblSignalTimes = new Label("List Choice (s)");
    lblSignalTimes.setStyleName("gwt-Label-Header");
    mainPanel.add(lblSignalTimes);

    choicePanelsList = new LinkedList<ListChoicePanel>();
    String[] choices = input.getListChoices();
    if (choices == null || choices.length == 0) {
        ListChoicePanel choicePanel = new ListChoicePanel(this);
        String choice = choicePanel.getChoice();
        choices = new String[] { choice };
        mainPanel.add(choicePanel);
        choicePanelsList.add(choicePanel);
        input.setListChoices(choices);
    } else {
        for (int i = 0; i < choices.length; i++) {
            ListChoicePanel choicePanel = new ListChoicePanel(this);
            choicePanel.setChoice(choices[i]);
            mainPanel.add(choicePanel);
            choicePanelsList.add(choicePanel);
        }
    }
}

From source file:com.google.sampling.experiential.client.SchedulePanel.java

License:Open Source License

private Widget createUserEditable(SignalScheduleDAO schedule2) {
    HorizontalPanel userEditablePanel = new HorizontalPanel();
    userEditablePanel.setSpacing(2);/*  ww w  .  j a v a 2 s .  c  o  m*/
    userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    userEditablePanel.setWidth("");
    Label lblUserEditable = new Label("User Editable: ");
    lblUserEditable.setStyleName("gwt-Label-Header");
    userEditablePanel.add(lblUserEditable);

    final CheckBox userEditableCheckBox = new CheckBox("");
    userEditablePanel.add(userEditableCheckBox);
    userEditableCheckBox
            .setValue(schedule.getUserEditable() != null ? schedule.getUserEditable() : Boolean.TRUE);
    userEditableCheckBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            schedule.setUserEditable(userEditableCheckBox.getValue());
        }

    });
    return userEditablePanel;
}

From source file:com.google.sampling.experiential.client.SchedulePanel.java

License:Open Source License

private Widget createUserEditableOnce(SignalScheduleDAO schedule2) {
    HorizontalPanel userEditablePanel = new HorizontalPanel();
    userEditablePanel.setSpacing(2);/*from   w  w w.  ja  va 2  s.  c  om*/
    userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    userEditablePanel.setWidth("");
    Label lblUserEditable = new Label("Only Editable on Join: ");
    lblUserEditable.setStyleName("gwt-Label-Header");
    userEditablePanel.add(lblUserEditable);

    final CheckBox userEditableCheckBox = new CheckBox("");
    userEditablePanel.add(userEditableCheckBox);
    userEditableCheckBox.setValue(
            schedule.getOnlyEditableOnJoin() != null ? schedule.getOnlyEditableOnJoin() : Boolean.FALSE);
    userEditableCheckBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            schedule.setOnlyEditableOnJoin(userEditableCheckBox.getValue());
        }

    });
    return userEditablePanel;
}

From source file:com.google.sampling.experiential.client.WeekDayPanel.java

License:Open Source License

public WeekDayPanel(boolean multiSelect, SignalScheduleDAO schedule) {
    MyConstants myConstants = GWT.create(MyConstants.class);
    this.schedule = schedule;
    this.multiSelect = multiSelect;
    VerticalPanel verticalPanel = new VerticalPanel();
    Grid grid = new Grid(2, 7);
    grid.setSize("102px", "49px");
    initWidget(verticalPanel);/*from   w w  w  .  j  ava 2s  .co  m*/
    verticalPanel.add(grid);

    checkBoxSun = new CheckBox("");
    grid.setWidget(0, 0, checkBoxSun);
    checkBoxMon = new CheckBox("");
    grid.setWidget(0, 1, checkBoxMon);
    checkBoxTue = new CheckBox("");
    grid.setWidget(0, 2, checkBoxTue);
    checkBoxWed = new CheckBox("");
    grid.setWidget(0, 3, checkBoxWed);
    checkBoxThu = new CheckBox("");
    grid.setWidget(0, 4, checkBoxThu);
    checkBoxFri = new CheckBox("");
    grid.setWidget(0, 5, checkBoxFri);
    checkBoxSat = new CheckBox("");
    grid.setWidget(0, 6, checkBoxSat);

    grid.setText(1, 0, myConstants.sundayInitial());
    grid.setText(1, 1, myConstants.mondayInitial());
    grid.setText(1, 2, myConstants.tuesdayInitial());
    grid.setText(1, 3, myConstants.wednesdayInitial());
    grid.setText(1, 4, myConstants.thursdayInitial());
    grid.setText(1, 5, myConstants.fridayInitial());
    grid.setText(1, 6, myConstants.satdayInitial());
    checkBoxes = new CheckBox[7];
    checkBoxes[0] = checkBoxSun;
    checkBoxes[1] = checkBoxMon;
    checkBoxes[2] = checkBoxTue;
    checkBoxes[3] = checkBoxWed;
    checkBoxes[4] = checkBoxThu;
    checkBoxes[5] = checkBoxFri;
    checkBoxes[6] = checkBoxSat;

    setSelctedCheckboxes();

    checkBoxSun.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(0);
        }
    });
    checkBoxMon.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(1);
        }
    });
    checkBoxTue.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(2);
        }
    });
    checkBoxWed.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(3);
        }
    });
    checkBoxThu.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(4);
        }
    });
    checkBoxFri.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(5);
        }
    });
    checkBoxSat.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            selected(6);
        }
    });

}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.KnownRiskViewImpl.java

License:Apache License

/**
 * Returns a CheckBox to control the RiskProvider (changing the check state regenerates the risk
 * grid's colors.)//  w w w .  ja  va 2  s .c om
 */
private CheckBox getRiskProviderCheckBox(RiskProvider provider) {
    CheckBox providerCheckBox = new CheckBox(provider.getName());
    providerCheckBox.setValue(true);
    providerCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            refreshRiskCalculation();
        }
    });
    return providerCheckBox;
}

From source file:com.googlesource.gerrit.plugins.emoticons.client.EmoticonsConfigScreen.java

License:Apache License

protected void display(ConfigInfo info) {
    HorizontalPanel p = new HorizontalPanel();
    p.setStyleName("emoticons-label-panel");
    showEmoticonsBox = new CheckBox("Show emoticons as images");
    showEmoticonsBox.setValue(info.showEmoticons());
    p.add(showEmoticonsBox);//  ww  w . j  a  v  a2  s .c om
    Image stageInfo = new Image(EmoticonsPlugin.RESOURCES.lightbulb());
    stageInfo.setTitle("Emoticons in comments are replaced by images.");
    p.add(stageInfo);
    add(p);

    HorizontalPanel buttons = new HorizontalPanel();
    add(buttons);

    saveButton = new Button("Save");
    saveButton.setStyleName("emoticons-save-button");
    saveButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            doSave();
        }
    });
    buttons.add(saveButton);
    saveButton.setEnabled(false);
    new OnEditEnabler(saveButton, showEmoticonsBox);

    showEmoticonsBox.setFocus(true);
    saveButton.setEnabled(false);
}

From source file:com.gwtmodel.table.view.ewidget.gwt.RadioBoxString.java

License:Apache License

private void setRadio(List<String> sList, boolean enable) {
    for (String s : sList) {
        CheckBox c = new CheckBox(s);
        c.setEnabled(enable);//from  w w w.  ja va2 s  .c  o  m
        CC cc = new CC(s, c);
        aL.add(cc);
        vP.add(c);
    }
    sync.signalDone();
}

From source file:com.ikon.frontend.client.widget.searchin.SearchAdvanced.java

License:Open Source License

/**
 * SearchAdvanced// w w  w  .jav  a2 s .  co m
 */
public SearchAdvanced() {
    table = new FlexTable();
    scrollPanel = new ScrollPanel(table);

    // Sets the folder explorer
    folderSelectPopup = new FolderSelectPopup();
    pathExplorerPanel = new HorizontalPanel();
    path = new TextBox();
    path.setReadOnly(true);
    pathExplorer = new Image(OKMBundleResources.INSTANCE.folderExplorer());

    pathExplorerPanel.add(path);
    pathExplorerPanel.add(new HTML("&nbsp;"));
    pathExplorerPanel.add(pathExplorer);

    pathExplorer.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            folderSelectPopup.show(false);
        }
    });

    pathExplorerPanel.setCellVerticalAlignment(pathExplorer, HasAlignment.ALIGN_MIDDLE);

    // Sets the category explorer
    categoryExplorerPanel = new HorizontalPanel();
    categoryPath = new TextBox();
    categoryUuid = "";
    categoryPath.setReadOnly(true);
    categoryExplorer = new Image(OKMBundleResources.INSTANCE.folderExplorer());

    categoryExplorerPanel.add(categoryPath);
    categoryExplorerPanel.add(new HTML("&nbsp;"));
    categoryExplorerPanel.add(categoryExplorer);

    categoryExplorer.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            folderSelectPopup.show(true);
        }
    });

    categoryExplorerPanel.setCellVerticalAlignment(categoryExplorer, HasAlignment.ALIGN_MIDDLE);

    // Sets type document
    tableMail = new FlexTable();
    typePanel = new HorizontalPanel();
    typeDocument = new CheckBox(Main.i18n("search.type.document"));
    typeDocument.setValue(true);
    typeFolder = new CheckBox(Main.i18n("search.type.folder"));
    typeFolder.setValue(false);
    typeMail = new CheckBox(Main.i18n("search.type.mail"));
    typeMail.setValue(false);
    typeMail.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (typeMail.getValue()) {
                mailText.setVisible(true);
                tableMail.setVisible(true);
            } else {
                mailText.setVisible(false);
                tableMail.setVisible(false);
            }
        }
    });

    typePanel.add(typeDocument);
    typePanel.add(new HTML("&nbsp;"));
    typePanel.add(typeFolder);
    typePanel.add(new HTML("&nbsp;"));
    typePanel.add(typeMail);
    typePanel.add(new HTML("&nbsp;"));

    // Sets mime types values
    mimeTypes = new ListBox();
    mimeTypes.addItem(" ", "");
    mimeTypes.addItem("HTML", "text/html");
    mimeTypes.addItem("MS Excel", "application/vnd.ms-excel");
    mimeTypes.addItem("MS PowerPoint", "application/vnd.ms-powerpoint");
    mimeTypes.addItem("MS Word", "application/msword");
    mimeTypes.addItem("OpenOffice.org Database", "application/vnd.oasis.opendocument.database");
    mimeTypes.addItem("OpenOffice.org Draw", "application/vnd.oasis.opendocument.graphics");
    mimeTypes.addItem("OpenOffice.org Presentation", "application/vnd.oasis.opendocument.presentation");
    mimeTypes.addItem("OpenOffice.org Spreadsheet", "application/vnd.oasis.opendocument.spreadsheet");
    mimeTypes.addItem("OpenOffice.org Word Processor", "application/vnd.oasis.opendocument.text");
    mimeTypes.addItem("PDF", "application/pdf");
    mimeTypes.addItem("RTF", "application/rtf");
    mimeTypes.addItem("TXT", "text/plain");
    mimeTypes.addItem("XML", "text/xml");
    mimeTypes.addItem("JPEG", "image/jpeg");
    mimeTypes.addItem("TIFF", "image/tiff");
    mimeTypes.addItem("GIF", "image/gif");
    mimeTypes.addItem("PNG", "image/png");
    mimeTypes.addItem("PSD", "image/x-psd");

    mimeTypes.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.evaluateSearchButtonVisible();
        }
    });
    mailText = new HTML(Main.i18n("search.type.mail"));
    mailText.setVisible(false);
    table.setHTML(1, 0, Main.i18n("search.folder"));
    table.setWidget(1, 1, pathExplorerPanel);
    table.setHTML(2, 0, Main.i18n("search.category"));
    table.setWidget(2, 1, categoryExplorerPanel);
    table.setHTML(3, 0, Main.i18n("search.type"));
    table.setWidget(3, 1, typePanel);
    table.setHTML(4, 0, Main.i18n("search.mimetype"));
    table.setWidget(4, 1, mimeTypes);
    table.setWidget(5, 0, mailText);
    table.setWidget(5, 1, tableMail);
    table.getCellFormatter().setVerticalAlignment(5, 0, HasAlignment.ALIGN_TOP);

    // Adding mail search params
    from = new TextBox();
    to = new TextBox();
    subject = new TextBox();
    tableMail.setHTML(0, 0, Main.i18n("mail.from"));
    tableMail.setWidget(0, 1, from);
    tableMail.setHTML(1, 0, Main.i18n("mail.to"));
    tableMail.setWidget(1, 1, to);
    tableMail.setHTML(2, 0, Main.i18n("mail.subject"));
    tableMail.setWidget(2, 1, subject);
    setRowWordWarp(tableMail, 0, 2, false);
    setRowWordWarp(tableMail, 1, 2, false);
    setRowWordWarp(tableMail, 2, 2, false);
    setRowWordWarp(tableMail, 3, 2, false);
    tableMail.setVisible(false);

    path.setStyleName("okm-Input");
    categoryPath.setStyleName("okm-Input");
    folderSelectPopup.setStyleName("okm-Popup");
    folderSelectPopup.addStyleName("okm-DisableSelect");
    from.setStyleName("okm-Input");
    to.setStyleName("okm-Input");
    subject.setStyleName("okm-Input");
    mimeTypes.setStyleName("okm-Select");

    initWidget(scrollPanel);
}

From source file:com.ikon.frontend.client.widget.searchin.SearchControl.java

License:Open Source License

/**
 * SearchControl/* ww  w . j a  va 2 s.  c  o  m*/
 */
public SearchControl() {
    table = new FlexTable();
    table.setCellPadding(2);
    table.setCellSpacing(2);
    scrollPanel = new ScrollPanel(table);
    advancedView = new CheckBox(Main.i18n("search.view.advanced"));
    advancedView.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (advancedView.getValue()) {
                clean();
                switchSearchMode(SEARCH_MODE_ADVANCED);
            } else {
                clean();
                switchSearchMode(SEARCH_MODE_SIMPLE);
            }
        }
    });
    compactResultsView = new CheckBox(Main.i18n("search.view.compact.results"));
    compactResultsView.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (compactResultsView.getValue()) {
                switchResultsViewMode(RESULTS_VIEW_COMPACT);
                table.getCellFormatter().setVisible(2, 0, false); // hide view property groups
            } else {
                switchResultsViewMode(RESULTS_VIEW_NORMAL);
                table.getCellFormatter().setVisible(2, 0, true); // show view property groups
            }
        }
    });
    showPropertyGroups = new CheckBox(Main.i18n("search.view.propety.groups"));
    showPropertyGroups.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (searchButton.isEnabled()) {
                executeSearch();
            }
        }
    });
    saveUserNews = new CheckBox(Main.i18n("search.save.as.news"));
    searchSavedName = new TextBox();
    searchSavedName.setWidth("200");
    controlSearch = new ControlSearchIn();
    resultPage = new ListBox();
    resultPage.addItem("10", "10");
    resultPage.addItem("20", "20");
    resultPage.addItem("30", "30");
    resultPage.addItem("50", "50");
    resultPage.addItem("100", "100");

    keyUpHandler = new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            evaluateSearchButtonVisible();

            if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && searchButton.isEnabled()) {
                executeSearch();
            }
        }
    };

    searchButton = new Button(Main.i18n("button.search"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            executeSearch();
        }
    });

    cleanButton = new Button(Main.i18n("button.clean"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            clean();
        }
    });

    saveSearchButton = new Button(Main.i18n("button.save.search"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long domain = 0;
            SearchNormal searchNormal = Main.get().mainPanel.search.searchBrowser.searchIn.searchNormal;
            SearchAdvanced searchAdvanced = Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced;
            String operator = GWTQueryParams.OPERATOR_AND;
            params = new GWTQueryParams();

            if (!searchAdvanced.path.getText().equals("")) {
                params.setPath(searchAdvanced.path.getText());
            } else {
                params.setPath(searchNormal.context.getValue(searchNormal.context.getSelectedIndex()));
            }

            if (!searchAdvanced.categoryUuid.equals("")) {
                params.setCategoryUuid(searchAdvanced.categoryUuid);
                params.setCategoryPath(searchAdvanced.categoryPath.getText().substring(16)); // removes /openkm:category 
            }

            params.setContent(searchNormal.content.getText());
            params.setName(searchNormal.name.getText());
            params.setKeywords(searchNormal.keywords.getText());
            params.setProperties(Main.get().mainPanel.search.searchBrowser.searchIn.getProperties());
            params.setAuthor(searchNormal.userListBox.getValue(searchNormal.userListBox.getSelectedIndex()));
            params.setLastModifiedFrom(searchNormal.modifyDateFrom);
            params.setLastModifiedTo(searchNormal.modifyDateTo);
            params.setDashboard(saveUserNews.getValue());
            params.setMailFrom(searchAdvanced.from.getText());
            params.setMailTo(searchAdvanced.to.getText());
            params.setMailSubject(searchAdvanced.subject.getText());

            if (searchAdvanced.typeDocument.getValue()) {
                domain += GWTQueryParams.DOCUMENT;
            }

            if (searchAdvanced.typeFolder.getValue()) {
                domain += GWTQueryParams.FOLDER;
            }

            if (searchAdvanced.typeMail.getValue()) {
                domain += GWTQueryParams.MAIL;
            }

            params.setDomain(domain);

            if (searchTypeAnd.getValue()) {
                operator = GWTQueryParams.OPERATOR_AND;
            } else {
                operator = GWTQueryParams.OPERATOR_OR;
            }

            params.setOperator(operator);

            // Removes dates if dashboard is checked
            if (saveUserNews.getValue()) {
                params.setLastModifiedFrom(null);
                params.setLastModifiedTo(null);
            }

            params.setMimeType(searchAdvanced.mimeTypes.getValue(searchAdvanced.mimeTypes.getSelectedIndex()));

            if (!searchSavedName.getText().equals("")) {
                saveSearchButton.setEnabled(false);
                params.setQueryName(searchSavedName.getText());
                isUserNews = params.isDashboard();
                saveSearch(params, "sql");
            }
        }
    });

    searchSavedName.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            evalueSaveSearchButtonVisible();
        }
    });

    searchButton.setEnabled(false);
    saveSearchButton.setEnabled(false);

    // Type of search
    searchTypePanel = new HorizontalPanel();
    searchTypePanel.setVisible(true); // On openkm 4.0 has hidden AND / OR option list
    searchTypeAnd = new CheckBox("AND");
    searchTypeOr = new CheckBox("OR");
    searchTypeAnd.setValue(true);
    searchTypeOr.setValue(false);

    searchTypeAnd.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            searchTypeOr.setValue(!searchTypeAnd.getValue()); // Always set changed between and and or type
        }
    });

    searchTypeOr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            searchTypeAnd.setValue(!searchTypeOr.getValue()); // Always set changed between and and or type
        }
    });

    HTML space1 = new HTML("");
    searchTypePanel.add(searchTypeAnd);
    searchTypePanel.add(space1);
    searchTypePanel.add(searchTypeOr);
    searchTypePanel.setCellWidth(space1, "10");

    table.setWidget(0, 0, advancedView);
    table.setWidget(1, 0, compactResultsView);
    table.setWidget(2, 0, showPropertyGroups);
    table.setWidget(3, 0, saveUserNews);
    table.setWidget(4, 0, saveSearchButton);
    table.setWidget(4, 1, searchSavedName);

    resultsPageText = new HTML(Main.i18n("search.page.results"));
    table.setWidget(5, 0, resultsPageText);
    table.setWidget(5, 1, resultPage);

    searchTypeText = new HTML(Main.i18n("search.type"));
    table.setHTML(6, 0, Main.i18n("search.type"));
    table.setWidget(6, 1, searchTypePanel);

    table.setWidget(6, 0, cleanButton);
    table.setWidget(6, 1, searchButton);

    table.setWidget(7, 0, controlSearch);

    table.getCellFormatter().setHorizontalAlignment(4, 0, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(5, 0, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(6, 0, HasAlignment.ALIGN_RIGHT);
    table.getFlexCellFormatter().setColSpan(0, 0, 2);
    table.getFlexCellFormatter().setColSpan(1, 0, 2);
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    table.getFlexCellFormatter().setColSpan(3, 0, 2);
    table.getFlexCellFormatter().setColSpan(7, 0, 2);

    // By default is enabled search mode simple
    table.getCellFormatter().setVisible(3, 0, false);
    table.getCellFormatter().setVisible(4, 0, false);
    table.getCellFormatter().setVisible(4, 1, false);

    searchButton.setStyleName("okm-YesButton");
    saveSearchButton.setStyleName("okm-AddButton");
    saveSearchButton.addStyleName("okm-NoWrap");
    cleanButton.setStyleName("okm-NoButton");
    searchSavedName.setStyleName("okm-Input");
    resultPage.setStyleName("okm-Input");

    initWidget(scrollPanel);
}