Example usage for com.vaadin.server FontAwesome SEARCH

List of usage examples for com.vaadin.server FontAwesome SEARCH

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome SEARCH.

Prototype

FontAwesome SEARCH

To view the source code for com.vaadin.server FontAwesome SEARCH.

Click Source Link

Usage

From source file:org.jumpmind.metl.ui.common.ButtonBar.java

License:Open Source License

public TextField addFilter() {
    TextField textField = new TextField();
    textField.setColumns(20);//ww w.  ja  v a2 s  .c om
    textField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    textField.setInputPrompt("Filter");
    textField.setIcon(FontAwesome.SEARCH);
    textField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    textField.setTextChangeTimeout(500);
    textField.setNullRepresentation("");
    addRight(textField);
    return textField;
}

From source file:org.jumpmind.metl.ui.mapping.EditMappingPanel.java

License:Open Source License

protected void buildUI() {
    if (!readOnly) {
        ButtonBar buttonBar = new ButtonBar();
        addComponent(buttonBar);//from w w  w. j  av a2 s  .co  m
        Button autoMapButton = buttonBar.addButton("Auto Map", FontAwesome.FLASH);
        removeButton = buttonBar.addButton("Remove", FontAwesome.TRASH_O);
        removeButton.setEnabled(false);
        autoMapButton.addClickListener(new AutoMapListener());
        removeButton.addClickListener(new RemoveListener());
    }

    HorizontalLayout titleHeader = new HorizontalLayout();
    titleHeader.setSpacing(true);
    titleHeader.setMargin(new MarginInfo(false, true, false, true));
    titleHeader.setWidth(100f, Unit.PERCENTAGE);
    titleHeader.addComponent(new Label(
            "<b>Input Model:</b> &nbsp;"
                    + (component.getInputModel() != null ? component.getInputModel().getName() : "?"),
            ContentMode.HTML));
    titleHeader.addComponent(new Label(
            "<b>Output Model:</b> &nbsp;"
                    + (component.getOutputModel() != null ? component.getOutputModel().getName() : "?"),
            ContentMode.HTML));
    addComponent(titleHeader);

    HorizontalLayout filterHeader = new HorizontalLayout();
    filterHeader.setSpacing(true);
    filterHeader.setMargin(new MarginInfo(true, true, true, true));
    filterHeader.setWidth(100f, Unit.PERCENTAGE);
    HorizontalLayout srcFilterHeader = new HorizontalLayout();
    srcFilterHeader.setSpacing(true);
    srcFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    filterHeader.addComponent(srcFilterHeader);
    HorizontalLayout dstFilterHeader = new HorizontalLayout();
    dstFilterHeader.setSpacing(true);
    dstFilterHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    filterHeader.addComponent(dstFilterHeader);
    addComponent(filterHeader);

    srcTextFilter = new TextField();
    srcTextFilter.setInputPrompt("Filter");
    srcTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    srcTextFilter.setIcon(FontAwesome.SEARCH);
    srcTextFilter.setImmediate(true);
    srcTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    srcTextFilter.setTextChangeTimeout(200);
    srcTextFilter.addTextChangeListener(new FilterInputTextListener());
    srcFilterHeader.addComponent(srcTextFilter);

    srcMapFilter = new CheckBox("Mapped Only");
    srcMapFilter.addValueChangeListener(new FilterSrcMapListener());
    srcFilterHeader.addComponent(srcMapFilter);

    dstTextFilter = new TextField();
    dstTextFilter.setInputPrompt("Filter");
    dstTextFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    dstTextFilter.setIcon(FontAwesome.SEARCH);
    dstTextFilter.setImmediate(true);
    dstTextFilter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    dstTextFilter.setTextChangeTimeout(200);
    dstTextFilter.addTextChangeListener(new FilterOutputTextListener());
    dstFilterHeader.addComponent(dstTextFilter);

    dstMapFilter = new CheckBox("Mapped Only");
    dstMapFilter.addValueChangeListener(new FilterDstMapListener());
    dstFilterHeader.addComponent(dstMapFilter);

    Panel panel = new Panel();
    VerticalLayout vlay = new VerticalLayout();
    vlay.setSizeFull();
    diagram = new MappingDiagram(context, component, readOnly);
    diagram.setSizeFull();
    vlay.addComponent(diagram);
    panel.setContent(vlay);
    panel.setSizeFull();
    addComponent(panel);
    setExpandRatio(panel, 1.0f);
    diagram.addListener(new EventListener());
}

From source file:org.jumpmind.metl.ui.views.admin.LoggingPanel.java

License:Open Source License

public LoggingPanel(ApplicationContext context, TabbedPanel tabbedPanel) {
    this.context = context;
    this.tabbedPanel = tabbedPanel;
    this.backgroundRefresherService = context.getBackgroundRefresherService();
    if (LogUtils.isFileEnabled()) {
        logFile = new File(LogUtils.getLogFilePath());
    }/* w  w w  .j ava2  s.c om*/
    setSizeFull();
    setSpacing(true);
    setMargin(true);

    HorizontalLayout topPanelLayout = new HorizontalLayout();
    topPanelLayout.setWidth(100, Unit.PERCENTAGE);
    topPanelLayout.setSpacing(true);

    Button refreshButton = new Button("Refresh");
    refreshButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            refresh();
        }
    });
    topPanelLayout.addComponent(refreshButton);
    topPanelLayout.setComponentAlignment(refreshButton, Alignment.BOTTOM_LEFT);

    bufferSize = new TextField();
    bufferSize.setImmediate(true);
    bufferSize.setWidth(5, Unit.EM);
    bufferSize.setValue("1000");
    bufferSize.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            refresh();
        }
    });
    topPanelLayout.addComponent(bufferSize);

    filter = new TextField();
    filter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filter.setInputPrompt("Filter");
    filter.setIcon(FontAwesome.SEARCH);
    filter.setNullRepresentation("");
    filter.setImmediate(true);
    filter.setTextChangeEventMode(TextChangeEventMode.LAZY);
    filter.setTextChangeTimeout(200);
    filter.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            refresh();
        }
    });
    topPanelLayout.addComponent(filter);
    topPanelLayout.setComponentAlignment(filter, Alignment.BOTTOM_LEFT);

    autoRefreshOn = new CheckBox("Auto Refresh");
    autoRefreshOn.setValue(true);
    autoRefreshOn.setImmediate(true);
    topPanelLayout.addComponent(autoRefreshOn);
    topPanelLayout.setComponentAlignment(autoRefreshOn, Alignment.BOTTOM_LEFT);

    Label spacer = new Label();
    topPanelLayout.addComponent(spacer);
    topPanelLayout.setExpandRatio(spacer, 1);

    if (logFile != null && logFile.exists()) {
        Button downloadButton = new Button("Download log file");
        downloadButton.addStyleName(ValoTheme.BUTTON_LINK);
        downloadButton.addStyleName(ValoTheme.BUTTON_SMALL);

        FileDownloader fileDownloader = new FileDownloader(getLogFileResource());
        fileDownloader.extend(downloadButton);
        topPanelLayout.addComponent(downloadButton);
        topPanelLayout.setComponentAlignment(downloadButton, Alignment.BOTTOM_RIGHT);
    }

    addComponent(topPanelLayout);

    logPanel = new Panel("Log Output");
    logPanel.setSizeFull();
    logView = new Label("", ContentMode.HTML);
    logView.setSizeUndefined();
    logPanel.setContent(logView);
    addComponent(logPanel);
    setExpandRatio(logPanel, 1);
    refresh();
    backgroundRefresherService.register(this);
}

From source file:org.jumpmind.metl.ui.views.ManageView.java

License:Open Source License

@SuppressWarnings("serial")
@PostConstruct//  w ww.  ja va2 s.  c om
protected void init() {
    viewButton = new Button("View Log");
    viewButton.setEnabled(false);
    viewButton.addClickListener(new ClickListener() {
        public void buttonClick(ClickEvent event) {
            viewLog(table.getValue());
        }
    });

    VerticalLayout mainTab = new VerticalLayout();
    mainTab.setSizeFull();
    HorizontalLayout header = new HorizontalLayout();
    header.addComponent(viewButton);
    header.setComponentAlignment(viewButton, Alignment.BOTTOM_RIGHT);

    statusSelect = new ComboBox("Status");
    statusSelect.setNewItemsAllowed(false);
    statusSelect.setNullSelectionAllowed(false);
    statusSelect.addItem(ANY);
    statusSelect.setValue(ANY);
    for (ExecutionStatus status : ExecutionStatus.values()) {
        statusSelect.addItem(status.toString());
    }
    ;
    statusSelect.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            refreshUI(getBackgroundData());
        }
    });
    header.addComponent(statusSelect);
    header.setComponentAlignment(statusSelect, Alignment.BOTTOM_RIGHT);

    HorizontalLayout limitLayout = new HorizontalLayout();
    limitLayout.setSpacing(true);
    Label limitLabel = new Label("Limit:");
    limitLayout.addComponent(limitLabel);
    limitLayout.setComponentAlignment(limitLabel, Alignment.MIDDLE_CENTER);
    TextField limitField = new TextField(null, String.valueOf(DEFAULT_LIMIT));
    limitField.setWidth("5em");
    limitField.setImmediate(true);
    limitField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    limitField.setTextChangeTimeout(200);
    limitField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            try {
                limit = Integer.parseInt(event.getText());
            } catch (Exception e) {
            }
            refreshUI(getBackgroundData());
        }
    });
    limitLayout.addComponent(limitField);
    limitLayout.setComponentAlignment(limitField, Alignment.BOTTOM_RIGHT);
    header.addComponent(limitLayout);
    header.setComponentAlignment(limitLayout, Alignment.BOTTOM_RIGHT);
    header.setExpandRatio(limitLayout, 1.0f);

    TextField filterField = new TextField();
    filterField.setInputPrompt("Filter");
    filterField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.setImmediate(true);
    filterField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    filterField.setTextChangeTimeout(200);
    filterField.addTextChangeListener(new TextChangeListener() {
        public void textChange(TextChangeEvent event) {
            executionContainer.removeAllContainerFilters();
            if (!StringUtils.isBlank(event.getText())) {
                executionContainer.addContainerFilter(new MultiPropertyFilter(event.getText(), new String[] {
                        "agentName", "hostName", "flowName", "status", "startTime", "endTime" }));
            }
        }
    });
    header.addComponent(filterField);
    header.setComponentAlignment(filterField, Alignment.BOTTOM_RIGHT);

    header.setSpacing(true);
    header.setMargin(true);
    header.setWidth("100%");
    mainTab.addComponent(header);

    table = new Table();
    table.setContainerDataSource(executionContainer);
    table.setSelectable(true);
    table.setMultiSelect(false);
    table.setSizeFull();
    table.addItemClickListener(new ItemClickListener() {
        @Override
        public void itemClick(ItemClickEvent event) {
            if (event.isDoubleClick()) {
                viewLog(event.getItemId());
            }
        }
    });
    table.setVisibleColumns(
            new Object[] { "agentName", "deploymentName", "hostName", "status", "startTime", "endTime" });
    table.setColumnHeaders(new String[] { "Agent", "Deployment", "Host", "Status", "Start", "End" });
    table.setSortContainerPropertyId("startTime");
    table.setSortAscending(false);
    table.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            viewButton.setEnabled(table.getValue() != null);
        }
    });
    mainTab.addComponent(table);
    mainTab.setExpandRatio(table, 1.0f);

    tabs = new TabbedPanel();
    tabs.setMainTab("Executions", Icons.EXECUTION, mainTab);

    HorizontalSplitPanel split = new HorizontalSplitPanel();
    split.setSizeFull();
    split.setSplitPosition(AppConstants.DEFAULT_LEFT_SPLIT, Unit.PIXELS, false);

    manageNavigator = new ManageNavigator(FolderType.AGENT, context);
    manageNavigator.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            refreshUI(getBackgroundData());
        }
    });
    split.setFirstComponent(manageNavigator);

    VerticalLayout container = new VerticalLayout();
    container.setSizeFull();
    container.addComponent(tabs);
    split.setSecondComponent(container);

    addComponent(split);
    setSizeFull();
    context.getBackgroundRefresherService().register(this);
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.DefaultButtonBar.java

License:Open Source License

protected void populate(MenuBar menuBar) {
    executeAtCursorButton = menuBar.addItem("", FontAwesome.PLAY, new Command() {

        private static final long serialVersionUID = 1L;

        @Override//from  w w  w.  jav a2  s  .  c o m
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.execute(false);
        }
    });
    executeAtCursorButton.setDescription("Run sql under cursor (CTRL+ENTER)");

    executeScriptButton = menuBar.addItem("", FontAwesome.FORWARD, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.execute(true);
        }
    });
    executeScriptButton.setDescription("Run as script");

    commitButton = menuBar.addItem("", FontAwesome.ARROW_CIRCLE_O_RIGHT, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.commit();
        }
    });
    commitButton.setStyleName("green");
    commitButton.setDescription("Commit");
    commitButton.setEnabled(false);

    rollbackButton = menuBar.addItem("", FontAwesome.ARROW_CIRCLE_O_LEFT, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            queryPanel.rollback();
        }
    });
    rollbackButton.setStyleName("red");
    rollbackButton.setDescription("Rollback");
    rollbackButton.setEnabled(false);

    historyButton = menuBar.addItem("", FontAwesome.SEARCH, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new SqlHistoryDialog(settingsProvider, queryPanel).showAtSize(0.6);
        }
    });
    historyButton.setDescription("Sql History");
    historyButton.setEnabled(true);

    MenuItem optionsButton = menuBar.addItem("", FontAwesome.TASKS, null);
    optionsButton.setDescription("Options");

    importButton = optionsButton.addItem("DB Import", FontAwesome.DOWNLOAD, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new DbImportDialog(db.getPlatform()).showAtSize(0.6);
        }
    });

    exportButton = optionsButton.addItem("DB Export", FontAwesome.UPLOAD, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new DbExportDialog(db.getPlatform(), queryPanel).showAtSize(0.6);
        }
    });

    fillButton = optionsButton.addItem("DB Fill", FontAwesome.BEER, new Command() {

        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            new DbFillDialog(db.getPlatform(), queryPanel).showAtSize(0.6);
        }
    });

    for (IDbMenuItem item : additionalMenuItems) {
        optionsButton.addItem(item.getCaption(), item.getIcon(), item.getCommand());
    }
}

From source file:org.jumpmind.vaadin.ui.sqlexplorer.TableSelectionLayout.java

License:Open Source License

protected void createTableSelectionLayout(String titleKey) {

    this.addComponent(new Label(titleKey));

    HorizontalLayout schemaChooserLayout = new HorizontalLayout();
    schemaChooserLayout.setWidth(100, Unit.PERCENTAGE);
    schemaChooserLayout.setSpacing(true);
    this.addComponent(schemaChooserLayout);

    catalogSelect = new ComboBox("Catalog");
    catalogSelect.setImmediate(true);/*from  w  ww . j a v a  2  s .c om*/
    CommonUiUtils.addItems(getCatalogs(), catalogSelect);
    schemaChooserLayout.addComponent(catalogSelect);
    if (selectedTablesSet.iterator().hasNext()) {
        catalogSelect.select(selectedTablesSet.iterator().next().getCatalog());
    } else {
        catalogSelect.select(databasePlatform.getDefaultCatalog());
    }
    schemaSelect = new ComboBox("Schema");
    schemaSelect.setImmediate(true);
    CommonUiUtils.addItems(getSchemas(), schemaSelect);
    schemaChooserLayout.addComponent(schemaSelect);
    if (selectedTablesSet.iterator().hasNext()) {
        schemaSelect.select(selectedTablesSet.iterator().next().getSchema());
    } else {
        schemaSelect.select(databasePlatform.getDefaultSchema());
    }

    Label spacer = new Label();
    schemaChooserLayout.addComponent(spacer);
    schemaChooserLayout.setExpandRatio(spacer, 1);

    filterField = new TextField();
    filterField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filterField.setIcon(FontAwesome.SEARCH);
    filterField.setInputPrompt("Filter Tables");
    filterField.setNullRepresentation("");
    filterField.setImmediate(true);
    filterField.setTextChangeEventMode(TextChangeEventMode.LAZY);
    filterField.setTextChangeTimeout(200);
    filterField.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        public void textChange(TextChangeEvent event) {
            filterField.setValue(event.getText());
            refreshTableOfTables();
        }
    });

    schemaChooserLayout.addComponent(filterField);
    schemaChooserLayout.setComponentAlignment(filterField, Alignment.BOTTOM_RIGHT);

    listOfTablesTable = CommonUiUtils.createTable();
    listOfTablesTable.setImmediate(true);
    listOfTablesTable.addItemClickListener(new ItemClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(ItemClickEvent event) {
            CheckBox checkBox = (CheckBox) event.getItem().getItemProperty("selected").getValue();
            checkBox.setValue(!checkBox.getValue());
        }
    });
    listOfTablesTable.addContainerProperty("selected", CheckBox.class, null);
    listOfTablesTable.setColumnWidth("selected", UiConstants.TABLE_SELECTED_COLUMN_WIDTH);
    listOfTablesTable.setColumnHeader("selected", "");
    listOfTablesTable.addContainerProperty("table", String.class, null);
    listOfTablesTable.setColumnHeader("table", "");
    listOfTablesTable.setSizeFull();
    this.addComponent(listOfTablesTable);
    this.setExpandRatio(listOfTablesTable, 1);

    schemaSelect.addValueChangeListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            refreshTableOfTables();
        }
    });

    catalogSelect.addValueChangeListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            refreshTableOfTables();
        }
    });

    refreshTableOfTables();

}

From source file:org.lucidj.vaadinui.BaseVaadinUI.java

License:Apache License

private void initSystemToolbar() {
    desktop_canvas.setSizeFull();//from ww w.  j a  va 2s .  com
    desktop_canvas.setWidth("100%");

    ui_header = new HorizontalLayout();
    {
        ui_header.setStyleName("ui-header-area");
        ui_header.setWidth(100, Sizeable.Unit.PERCENTAGE);
        ui_header.setHeightUndefined();
        ui_header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

        Label logo = new Label("&nbsp;", ContentMode.HTML);
        {
            logo.addStyleName("ui-header-logo");
            logo.setWidth(default_sidebar_width_pixels, Sizeable.Unit.PIXELS);
        }
        ui_header.addComponent(logo);

        HorizontalLayout header_components = new HorizontalLayout();
        {
            header_components.setWidth(100, com.vaadin.server.Sizeable.Unit.PERCENTAGE);
            header_components.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
            header_components.setSpacing(true);

            // Search component
            CssLayout search_component = new CssLayout();
            {
                search_component.setWidth(100, com.vaadin.server.Sizeable.Unit.PERCENTAGE);
                search_component.setWidthUndefined();
                search_component.addStyleName("v-component-group");
                search_component.addStyleName("ui-header-search");
                final ComboBox search_text = new ComboBox();
                {
                    search_text.setInputPrompt("Search or paste URL...");
                    //combo.setContainerDataSource(StringGenerator.generateContainer(200, false));
                    search_text.setNullSelectionAllowed(true);
                    search_text.setTextInputAllowed(true);
                    search_text.setNewItemsAllowed(true);
                    //combo.select(combo.getItemIds().iterator().next());
                    //combo.setItemCaptionPropertyId(StringGenerator.CAPTION_PROPERTY);
                    //combo.setItemIconPropertyId(StringGenerator.ICON_PROPERTY);

                    // TODO: SOMEDAY DISCOVER HOW TO EXPAND THIS GROUPED COMPONENT, AND THE CURE FOR CANCER
                    search_text.setWidth("480px");
                    search_text.addStyleName("invisible-focus");
                    search_text.addValueChangeListener(new Property.ValueChangeListener() {
                        @Override
                        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
                            String search_args = (String) search_text.getValue();

                            if (search_args != null) {
                                fireEvent("search", search_text.getValue());
                                value_change_button_quirk = true;
                            }
                        }
                    });

                    // Handles the Enter key by activating on focus and deactivating on blur
                    final ShortcutListener handle_enter = new ShortcutListener("Enter",
                            ShortcutAction.KeyCode.ENTER, null) {
                        @Override
                        public void handleAction(Object o, Object o1) {
                            value_change_button_quirk = false;
                            fireEvent("search", search_text.getValue());
                        }
                    };

                    search_text.addFocusListener(new FieldEvents.FocusListener() {
                        @Override
                        public void focus(FieldEvents.FocusEvent focusEvent) {
                            if (nested_focus_blur_bug_count++ == 0) {
                                search_text.addShortcutListener(handle_enter);
                            }
                        }
                    });

                    search_text.addBlurListener(new FieldEvents.BlurListener() {
                        @Override
                        public void blur(FieldEvents.BlurEvent blurEvent) {
                            if (--nested_focus_blur_bug_count == 0) {
                                search_text.removeShortcutListener(handle_enter);
                            }
                        }
                    });

                }
                search_component.addComponent(search_text);

                Button search_button = new Button();
                {
                    search_button.setIcon(FontAwesome.SEARCH);
                    search_button.addClickListener(new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent clickEvent) {
                            if (!value_change_button_quirk) {
                                fireEvent("search", search_text.getValue());
                            }
                            value_change_button_quirk = false;
                        }
                    });
                    search_button.addStyleName("invisible-focus");
                }
                search_component.addComponent(search_button);
            }
            header_components.addComponent(search_component);

            // User component
            user_component = new HorizontalLayout();
            {
                user_component.setStyleName("ui-header-user");
                user_component.setWidthUndefined();
            }
            header_components.addComponent(user_component);

            // I swear someday I'll learn CSS, AFTER implementing my own distributed
            // operating system with augmented reality interface and a machine learning kernel,
            // all written in Z80 assembly, as a preparation for the task.
            Label spacer = new Label();
            spacer.setWidthUndefined();
            header_components.addComponent(spacer);

            // Search expands
            header_components.setExpandRatio(search_component, 1.0f);
        }
        ui_header.addComponent(header_components);
        ui_header.setExpandRatio(header_components, 1.0f);
    }

    desktop_canvas.addComponent(ui_header);
    desktop_canvas.addComponent(empty_desktop);
    desktop_canvas.setExpandRatio(empty_desktop, 1.0f);
    setContent(desktop_canvas);
}

From source file:org.tylproject.vaadin.addon.fields.zoom.ZoomField.java

License:Apache License

public ZoomField(TextField field, Class<T> type) {
    super(field, new Button(FontAwesome.SEARCH), type);
    getBackingField().setReadOnly(true);
    getButton().addClickListener(new ButtonClickListener());
}

From source file:org.tylproject.vaadin.addon.fields.zoom.ZoomField.java

License:Apache License

@Override
public void setReadOnly(boolean readOnly) {
    super.setReadOnly(readOnly);
    getBackingField().setReadOnly(true);
    getZoomDialog().setReadOnly(readOnly);
    if (readOnly) {
        getButton().setIcon(FontAwesome.ELLIPSIS_H);
    } else {/*from w w w. ja  v  a  2s . com*/
        getButton().setIcon(FontAwesome.SEARCH);
    }
}

From source file:org.vaadin.addons.filterbuilder.FilterBuilderUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("FilterBuilder demo");

    HorizontalSplitPanel content = new HorizontalSplitPanel();
    content.setSizeFull();// www. jav  a 2 s  . c om

    // Left pane
    leftPane = new VerticalLayout();
    {
        leftPane.setSizeFull();
        leftPane.setMargin(true);
        leftPane.setSpacing(true);

        filterField = new TextField();
        filterField.setInputPrompt("Write your filter here");
        filterField.setIcon(FontAwesome.SEARCH);
        filterField.addStyleName("filter-field inline-icon");
        filterField.setWidth(100, Unit.PERCENTAGE);
        filterField.setTextChangeEventMode(TextField.TextChangeEventMode.LAZY);
        filterField.setTextChangeTimeout(1000);
        filterField.addTextChangeListener(this);
        leftPane.addComponent(filterField);

        filterLabel = new Label();
        filterLabel.setWidth(100, Unit.PERCENTAGE);

        try {
            dataSource = new BeanItemContainer<>(TestCaseBean.class, TestCaseBean.loadMockData());
            dataSource.removeContainerProperty("address");
            dataSource.addNestedContainerProperty("address.country");
            dataSource.addNestedContainerProperty("address.city");
            dataSource.addNestedContainerProperty("address.street");
            dataSource.addNestedContainerProperty("address.address");
        } catch (Exception e) {
            logger.error("Could not load mock data");
        }
        table = new Table(null, dataSource);
        table.setSizeFull();
        table.setVisibleColumns("id", "firstName", "lastName", "jobTitle", "dob", "salary", "address.country",
                "address.city", "address.street", "address.address", "unemployed");
        table.setSelectable(true);
        leftPane.addComponent(table);
        leftPane.setExpandRatio(table, 1);

    }
    content.setFirstComponent(leftPane);

    // Right pane
    rightPane = new TabSheet();
    {
        rightPane.setSizeFull();

        VerticalLayout lastUsedFiltersPane = new VerticalLayout();
        lastUsedFiltersPane.setSizeFull();
        lastUsedFiltersPane.setMargin(true);
        lastUsedFiltersPane.setSpacing(true);
        lastUsedFilters = new IndexedContainer();
        lastUsedFilters.addContainerProperty("filter", String.class, null);
        lastUsedFiltersTable = new Table();
        lastUsedFiltersTable.setSizeFull();
        lastUsedFiltersTable.setContainerDataSource(lastUsedFilters);
        lastUsedFiltersTable.setSortEnabled(false);
        lastUsedFiltersTable.setSelectable(true);
        lastUsedFiltersTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
        lastUsedFiltersTable.addItemClickListener(this);

        final Button removeFilterButton = new Button("Remove", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                if (lastUsedFiltersTable.getValue() != null) {
                    lastUsedFilters.removeItem(lastUsedFiltersTable.getValue());
                    lastUsedFiltersTable.setValue(null);
                }
            }
        });
        removeFilterButton.setEnabled(false);
        lastUsedFiltersTable.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                removeFilterButton.setEnabled(lastUsedFiltersTable.getValue() != null);
            }
        });
        lastUsedFiltersPane.addComponents(lastUsedFiltersTable, removeFilterButton);
        lastUsedFiltersPane.setExpandRatio(lastUsedFiltersTable, 1);
        rightPane.addTab(lastUsedFiltersPane).setCaption("Last used filters");

        VerticalLayout dateFormatsPane = new VerticalLayout();
        dateFormatsPane.setMargin(true);
        dateFormats = new IndexedContainer();
        dateFormats.addContainerProperty("format", String.class, null);
        for (SimpleDateFormat dateFormat : FilterBuilder.DATE_FORMATS) {
            final Item item = dateFormats.addItem(dateFormat.toPattern());
            item.getItemProperty("format").setValue(dateFormat.toPattern());
        }
        dateFormatsTable = new Table();
        dateFormatsTable.setWidth(100, Unit.PERCENTAGE);
        dateFormatsTable.setContainerDataSource(dateFormats);
        dateFormatsTable.setSortEnabled(false);
        dateFormatsTable.setSelectable(true);
        dateFormatsTable.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
        dateFormatsPane.addComponent(dateFormatsTable);
        rightPane.addTab(dateFormatsPane).setCaption("Known date formats");
    }
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    content.setSecondComponent(rightPane);
    content.setSplitPosition(80, Unit.PERCENTAGE);

    setContent(content);
    logger.debug("UI initialized");
}