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.ikon.frontend.client.widget.propertygroup.PropertyGroupWidget.java

License:Open Source License

/**
 * start//  w  ww.j  a  v  a  2 s  .  c  o m
 * 
 * @param path
 * @param propertyGroup
 * @param widget
 * @param propertyGroupWidgetToFire
 */
private void start(String path, GWTPropertyGroup propertyGroup, Widget widget,
        PropertyGroupWidgetToFire propertyGroupWidgetToFire) {
    propertyGroupHandlerExtensionList = new ArrayList<PropertyGroupHandlerExtension>();
    manager = new FormManager();
    this.path = path;
    this.propertyGroup = propertyGroup;
    this.propertyGroupWidgetToFire = propertyGroupWidgetToFire;

    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setWidth("100%");

    FlexTable table = manager.getTable();
    table.setWidth("100%");

    FlexTable widgetTable = new FlexTable();
    widgetTable.setCellPadding(0);
    widgetTable.setCellSpacing(0);
    widgetTable.setWidth("100%");
    widgetTable.setWidget(0, 0, widget);
    widgetTable.getFlexCellFormatter().setColSpan(0, 0, 2);

    // Widget format
    widgetTable.getCellFormatter().setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER);
    widgetTable.getCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_MIDDLE);

    RowFormatter rowFormatter = widgetTable.getRowFormatter();
    rowFormatter.setStyleName(0, "okm-Security-Title");

    cellFormatter = widgetTable.getCellFormatter(); // Gets the cell formatter

    // Format borders and margins
    cellFormatter.addStyleName(0, 0, "okm-Security-Title-RightBorder");

    vPanel.add(widgetTable);
    vPanel.add(table);

    initWidget(vPanel);
}

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

License:Open Source License

public ControlSearchIn() {
    controlPanel = new VerticalPanel();
    table = new FlexTable();
    textResults = new HTML(Main.i18n("search.results"));
    previous = new Image(OKMBundleResources.INSTANCE.previous());
    next = new Image(OKMBundleResources.INSTANCE.next());

    previous.addClickHandler(new ClickHandler() {
        @Override//from   w  ww.j ava  2 s  .  c  o m
        public void onClick(ClickEvent event) {
            if (previousEnabled) {
                offset -= limit;
                if (gwtParams != null) {
                    Main.get().mainPanel.search.searchBrowser.searchResult.findPaginated(gwtParams, offset,
                            limit);
                } else {
                    Main.get().mainPanel.search.searchBrowser.searchResult.findSimpleQueryPaginated(statement,
                            offset, limit);
                }
            }
        }
    });
    previous.setStyleName("okm-Hyperlink");

    next.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (nextEnabled) {
                offset += limit;
                if (gwtParams != null) {
                    Main.get().mainPanel.search.searchBrowser.searchResult.findPaginated(gwtParams, offset,
                            limit);
                } else {
                    Main.get().mainPanel.search.searchBrowser.searchResult.findSimpleQueryPaginated(statement,
                            offset, limit);
                }
            }
        }
    });
    next.setStyleName("okm-Hyperlink");

    table.setWidget(0, 0, textResults);
    table.setHTML(0, 1, "&nbsp;&nbsp;&nbsp;");
    table.setWidget(0, 2, previous);
    table.setHTML(0, 3, "");
    table.setWidget(0, 4, next);

    controlPanel.add(table);

    controlPanel.setVisible(false); // Initially not shows only when search has been executed
    controlPanel.setStyleName("okm-DisableSelect");

    initWidget(controlPanel);
}

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

License:Open Source License

/**
 * About popup// w  w w  . j  av a  2  s . c  o m
 */
public GroupPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    vPanel = new VerticalPanel();
    hPanel = new HorizontalPanel();
    groupLabel = new Label(Main.i18n("group.group"));
    propertyLabel = new Label(Main.i18n("group.property.group"));
    table = new FlexTable();

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

    addButton = new Button(Main.i18n("button.add"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (propertyListBox.getSelectedIndex() > 0) {
                String grpName = groupListBox.getValue(groupListBox.getSelectedIndex());
                String grpLabel = groupListBox.getItemText(groupListBox.getSelectedIndex());
                String propertyName = propertyListBox.getValue(propertyListBox.getSelectedIndex());
                for (Iterator<GWTFormElement> it = formElementList.iterator(); it.hasNext();) {
                    GWTFormElement formElement = it.next();
                    if (formElement.getName().endsWith(propertyName)) {
                        GWTPropertyParams param = new GWTPropertyParams();
                        param.setGrpName(grpName);
                        param.setGrpLabel(grpLabel);
                        param.setFormElement(formElement);
                        Main.get().mainPanel.search.searchBrowser.searchIn.searchMetadata.addProperty(param);
                    }
                }
            }
            enableAddGroupButton(); // Enables or disables add group button ( if exist some property still to be added )
            hide();
        }
    });

    groupListBox = new ListBox();
    groupListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            if (groupListBox.getSelectedIndex() > 0) {
                propertyListBox.clear();
                getMetaData();
            } else {
                propertyListBox.clear();
                propertyListBox.setVisible(false);
                propertyLabel.setVisible(false);
                addButton.setEnabled(false);
            }
        }
    });
    groupListBox.setStyleName("okm-Select");

    propertyListBox = new ListBox();
    propertyListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            if (propertyListBox.getSelectedIndex() > 0) {
                addButton.setEnabled(true);
            } else {
                addButton.setEnabled(false);
            }
        }
    });
    propertyListBox.setStyleName("okm-Select");
    propertyListBox.setVisible(false);
    propertyLabel.setVisible(false);

    vPanel.setWidth("300px");
    vPanel.setHeight("100px");
    closeButton.setStyleName("okm-NoButton");
    addButton.setStyleName("okm-AddButton");
    addButton.setEnabled(false);

    hPanel.add(closeButton);
    hPanel.add(new HTML("&nbsp;&nbsp;"));
    hPanel.add(addButton);

    hPanel.setCellHorizontalAlignment(closeButton, VerticalPanel.ALIGN_CENTER);
    hPanel.setCellHorizontalAlignment(addButton, VerticalPanel.ALIGN_CENTER);

    table.setWidget(0, 0, groupLabel);
    table.setWidget(0, 1, groupListBox);
    table.setWidget(1, 0, propertyLabel);
    table.setWidget(1, 1, propertyListBox);

    vPanel.add(new HTML("<br>"));
    vPanel.add(table);
    vPanel.add(new HTML("<br>"));
    vPanel.add(hPanel);
    vPanel.add(new HTML("<br>"));

    vPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(hPanel, VerticalPanel.ALIGN_CENTER);

    super.hide();
    setWidget(vPanel);
}

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

License:Open Source License

/**
 * SearchAdvanced/*from   www  .  j  a va2  s. c  om*/
 */
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//from  www .  j  a v a  2s  .co  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);
}

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

License:Open Source License

/**
 * SearchMetadata/*ww w .java 2  s .com*/
 */
public SearchMetadata(HasSearch search) {
    formManager = new FormManager(search);
    table = new FlexTable();
    scrollPanel = new ScrollPanel(table);

    // Table padding and spacing properties
    formManager.getTable().setCellPadding(2);
    formManager.getTable().setCellSpacing(2);

    groupPopup = new GroupPopup();
    groupPopup.setWidth("300px");
    groupPopup.setHeight("125px");
    groupPopup.setStyleName("okm-Popup");
    groupPopup.addStyleName("okm-DisableSelect");

    addGroup = new Button(Main.i18n("search.add.property.group"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            groupPopup.show();
        }
    });

    table.setWidget(0, 0, addGroup);
    table.setWidget(1, 0, formManager.getTable());

    addGroup.setStyleName("okm-AddButton");
    addGroup.addStyleName("okm-NoWrap");

    initWidget(scrollPanel);
}

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

License:Open Source License

/**
 * SearchNormal//from   ww  w  . ja v  a2 s. c o m
 */
public SearchNormal() {
    table = new FlexTable();
    scrollPanel = new ScrollPanel(table);

    context = new ListBox();
    context.setStyleName("okm-Select");
    int count = 0;
    posTaxonomy = count++;
    context.addItem(Main.i18n("leftpanel.label.taxonomy"), "");

    if (templatesVisible) {
        posTemplates = count++;
        context.addItem(Main.i18n("leftpanel.label.templates"), "");
    }

    if (personalVisible) {
        posPersonal = count++;
        context.addItem(Main.i18n("leftpanel.label.my.documents"), "");
    }

    if (mailVisible) {
        posMail = count++;
        context.addItem(Main.i18n("leftpanel.label.mail"), "");
    }

    if (trashVisible) {
        posTrash = count++;
        context.addItem(Main.i18n("leftpanel.label.trash"), "");
    }

    context.setSelectedIndex(posTaxonomy);

    context.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            // each time list is changed must clean folder
            Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced.path.setText("");

            // Always enable mail search in mail view
            if (mailVisible && context.getSelectedIndex() == posMail) {
                Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced.enableMailSearch();
            }
        }
    });

    content = new TextBox();
    name = new TextBox();
    keywords = new TextBox();
    userListBox = new ListBox();
    startDate = new TextBox();
    endDate = new TextBox();
    dateRange = new HorizontalPanel();
    calendar = new CalendarWidget();
    calendarPopup = new PopupPanel(true);
    startCalendarIcon = new Image(OKMBundleResources.INSTANCE.calendar());
    endCalendarIcon = new Image(OKMBundleResources.INSTANCE.calendar());
    cleanIcon = new Image(OKMBundleResources.INSTANCE.cleanIcon());
    dateBetween = new HTML("&nbsp;&harr;&nbsp;");

    userListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.evaluateSearchButtonVisible();
        }
    });

    // Calendar widget
    calendarPopup.setWidget(calendar);

    calendar.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            calendarPopup.hide();
            DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.day.pattern"));

            switch (calendarFired) {
            case CALENDAR_FIRED_START:
                startDate.setText(dtf.format(calendar.getDate()));
                modifyDateFrom = (Date) calendar.getDate().clone();
                break;

            case CALENDAR_FIRED_END:
                endDate.setText(dtf.format(calendar.getDate()));
                modifyDateTo = (Date) calendar.getDate().clone();
                break;
            }

            calendarFired = CALENDAR_FIRED_NONE;
            Main.get().mainPanel.search.searchBrowser.searchIn.searchControl.evaluateSearchButtonVisible();
        }
    });

    startCalendarIcon.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            calendarFired = CALENDAR_FIRED_START;
            if (modifyDateFrom != null) {
                calendar.setNow((Date) modifyDateFrom.clone());
            } else {
                calendar.setNow(null);
            }
            calendarPopup.setPopupPosition(startCalendarIcon.getAbsoluteLeft(),
                    startCalendarIcon.getAbsoluteTop() - 2);
            calendarPopup.show();
        }
    });
    startCalendarIcon.setStyleName("okm-Hyperlink");

    endCalendarIcon.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            calendarFired = CALENDAR_FIRED_END;
            if (modifyDateTo != null) {
                calendar.setNow((Date) modifyDateTo.clone());
            } else {
                calendar.setNow(null);
            }
            calendarPopup.setPopupPosition(endCalendarIcon.getAbsoluteLeft(),
                    endCalendarIcon.getAbsoluteTop() - 2);
            calendarPopup.show();
        }
    });
    endCalendarIcon.setStyleName("okm-Hyperlink");

    cleanIcon.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            startDate.setText("");
            modifyDateFrom = null;
            endDate.setText("");
            modifyDateTo = null;
        }
    });
    cleanIcon.setStyleName("okm-Hyperlink");

    // Date range panel
    dateRange.add(startDate);
    dateRange.add(startCalendarIcon);
    dateRange.add(dateBetween);
    dateRange.add(endDate);
    dateRange.add(endCalendarIcon);
    dateRange.add(cleanIcon);
    startDate.setWidth("70");
    endDate.setWidth("70");
    startDate.setMaxLength(10);
    endDate.setMaxLength(10);
    startDate.setReadOnly(true);
    endDate.setReadOnly(true);
    dateRange.setCellVerticalAlignment(startCalendarIcon, HasAlignment.ALIGN_MIDDLE);
    dateRange.setCellVerticalAlignment(endCalendarIcon, HasAlignment.ALIGN_MIDDLE);
    dateRange.setCellVerticalAlignment(cleanIcon, HasAlignment.ALIGN_MIDDLE);
    dateRange.setCellWidth(cleanIcon, "25");
    dateRange.setCellHorizontalAlignment(cleanIcon, HasAlignment.ALIGN_RIGHT);
    dateBetween.addStyleName("okm-NoWrap");

    table.setHTML(0, 0, Main.i18n("search.context"));
    table.setWidget(0, 1, context);
    table.setHTML(1, 0, Main.i18n("search.content"));
    table.setWidget(1, 1, content);
    table.setHTML(2, 0, Main.i18n("search.name"));
    table.setWidget(2, 1, name);
    table.setHTML(3, 0, Main.i18n("search.keywords"));
    table.setWidget(3, 1, keywords);
    table.setHTML(4, 0, Main.i18n("search.user"));
    table.setWidget(4, 1, userListBox);
    table.setHTML(5, 0, Main.i18n("search.date.range"));
    table.setWidget(5, 1, dateRange);

    CellFormatter cellFormatter = table.getCellFormatter();
    cellFormatter.setStyleName(0, 0, "okm-DisableSelect");
    cellFormatter.setStyleName(1, 0, "okm-DisableSelect");
    cellFormatter.setStyleName(2, 0, "okm-DisableSelect");
    cellFormatter.setStyleName(3, 0, "okm-DisableSelect");
    cellFormatter.setStyleName(4, 0, "okm-DisableSelect");
    cellFormatter.setStyleName(5, 0, "okm-DisableSelect");

    // Sets wordWrap for al rows
    setRowWordWarp(table, 0, 1, false);
    setRowWordWarp(table, 1, 1, false);
    setRowWordWarp(table, 2, 1, false);
    setRowWordWarp(table, 3, 1, false);
    setRowWordWarp(table, 4, 1, false);
    setRowWordWarp(table, 5, 1, false);

    content.setStyleName("okm-Input");
    name.setStyleName("okm-Input");
    keywords.setStyleName("okm-Input");
    userListBox.setStyleName("okm-Input");
    startDate.setStyleName("okm-Input");
    endDate.setStyleName("okm-Input");

    initWidget(scrollPanel);
}

From source file:com.ikon.frontend.client.widget.searchresult.SearchFullResult.java

License:Open Source License

/**
 * SearchFullResult//  w  ww.  jav  a  2s .co  m
 */
public SearchFullResult() {
    table = new FlexTable();
    scrollPanel = new ScrollPanel(table);

    scrollPanel.setStyleName("okm-Input");

    initWidget(scrollPanel);
}

From source file:com.ikon.frontend.client.widget.searchresult.SearchFullResult.java

License:Open Source License

/**
 * drawCategoriesKeywords//from   w w  w .  j  av a2 s . c  om
 * 
 * @param categories
 * @param keywords
 * @param table
 * @return
 */
private int addCategoriesKeywords(Set<GWTFolder> categories, Set<String> keywords, FlexTable table) {
    int rows = table.getRowCount();
    // Categories and tagcloud
    if (categories.size() > 0 || keywords.size() > 0) {
        HorizontalPanel hPanel = new HorizontalPanel();
        hPanel.setStyleName("okm-NoWrap");
        if (categories.size() > 0) {
            FlexTable tableSubscribedCategories = new FlexTable();
            tableSubscribedCategories.setStyleName("okm-DisableSelect");
            // Sets the document categories
            for (Iterator<GWTFolder> it = categories.iterator(); it.hasNext();) {
                drawCategory(tableSubscribedCategories, it.next());
            }
            hPanel.add(new HTML("<b>" + Main.i18n("document.categories") + "</b>"));
            hPanel.add(Util.hSpace("5"));
            hPanel.add(tableSubscribedCategories);
            hPanel.add(Util.hSpace("33"));
        }
        if (keywords.size() > 0) {
            // Tag cloud
            TagCloud keywordsCloud = new TagCloud();
            keywordsCloud.setWidth("350");
            WidgetUtil.drawTagCloud(keywordsCloud, keywords);
            hPanel.add(new HTML("<b>" + Main.i18n("document.keywords.cloud") + "</b>"));
            hPanel.add(Util.hSpace("5"));
            hPanel.add(keywordsCloud);
        }
        table.setWidget(rows++, 0, hPanel);
    }
    return rows;
}

From source file:com.ikon.frontend.client.widget.startup.StartUpPopup.java

License:Open Source License

public StartUpPopup() {
    // Establishes auto-close when click outside
    super(false, true);

    vPanel = new VerticalPanel();
    status = new VerticalPanel();
    table = new FlexTable();
    button = new Button(Main.i18n("button.close"), this);
    scrollPanel = new ScrollPanel(status);
    scrollPanel.setAlwaysShowScrollBars(false);
    scrollPanel.setSize("490", "160");
    scrollPanel.setStyleName("okm-Input");

    status.setWidth("" + (490 - IE_SIZE_RECTIFICATION));

    vPanel.add(new HTML("&nbsp;"));
    vPanel.add(scrollPanel);/*from  ww w .ja v a  2  s .c o m*/
    vPanel.add(new HTML("&nbsp;"));
    vPanel.add(table);
    vPanel.add(button);
    vPanel.add(new HTML("&nbsp;"));

    button.setVisible(false);
    button.setStyleName("okm-YesButton");

    vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(table, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(button, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(scrollPanel, HasAlignment.ALIGN_MIDDLE);

    int left = (Window.getClientWidth() - 510) / 2;
    int top = (Window.getClientHeight() - 220) / 2;
    vPanel.setWidth("510px");
    vPanel.setHeight("220px");

    for (int i = 0; i < StartUp.STARTUP_LOADING_HISTORY_SEARCH; i++) {
        table.setWidget(0, i, new Image(OKMBundleResources.INSTANCE.loadedDisabledIcon()));
    }

    setText(Main.i18n("startup.openkm"));
    setPopupPosition(left, top);
    setWidget(vPanel);
}