Search in sources :

Example 1 with CmsFileTableDialogContext

use of org.opencms.ui.components.CmsFileTableDialogContext in project opencms-core by alkacon.

the class CmsSourceSearchApp method getComponentForState.

/**
 * @see org.opencms.ui.apps.A_CmsWorkplaceApp#getComponentForState(java.lang.String)
 */
@Override
protected Component getComponentForState(String state) {
    m_rootLayout.setMainHeightFull(true);
    HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setSizeFull();
    m_searchForm = new CmsSourceSearchForm(this);
    sp.setFirstComponent(m_searchForm);
    VerticalLayout result = new VerticalLayout();
    result.setSizeFull();
    m_infoIntroLayout = CmsVaadinUtils.getInfoLayout(Messages.GUI_SOURCESEARCH_INTRO_0);
    m_infoEmptyResult = CmsVaadinUtils.getInfoLayout(Messages.GUI_SOURCESEARCH_EMPTY_0);
    m_resultTable = new CmsFileTable(null);
    result.addComponent(m_resultTable);
    result.addComponent(m_infoEmptyResult);
    result.addComponent(m_infoIntroLayout);
    m_resultTable.setVisible(false);
    m_infoEmptyResult.setVisible(false);
    m_infoIntroLayout.setVisible(true);
    m_resultTable.applyWorkplaceAppSettings();
    m_resultTable.setContextProvider(new I_CmsContextProvider() {

        /**
         * @see org.opencms.ui.apps.I_CmsContextProvider#getDialogContext()
         */
        public I_CmsDialogContext getDialogContext() {
            CmsFileTableDialogContext context = new CmsFileTableDialogContext(CmsProjectManagerConfiguration.APP_ID, ContextType.fileTable, m_resultTable, m_resultTable.getSelectedResources());
            storeCurrentFileSelection(m_resultTable.getSelectedResources());
            context.setEditableProperties(CmsFileExplorer.INLINE_EDIT_PROPERTIES);
            return context;
        }
    });
    m_resultTable.setSizeFull();
    if (m_resultTableFilter == null) {
        m_resultTableFilter = new TextField();
        m_resultTableFilter.setIcon(FontOpenCms.FILTER);
        m_resultTableFilter.setInputPrompt(Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_FILTER_0));
        m_resultTableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
        m_resultTableFilter.setWidth("200px");
        m_resultTableFilter.addTextChangeListener(new TextChangeListener() {

            private static final long serialVersionUID = 1L;

            public void textChange(TextChangeEvent event) {
                m_resultTable.filterTable(event.getText());
            }
        });
        m_infoLayout.addComponent(m_resultTableFilter);
    }
    sp.setSecondComponent(result);
    sp.setSplitPosition(CmsFileExplorer.LAYOUT_SPLIT_POSITION, Unit.PIXELS);
    if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(state)) {
        CmsSearchReplaceSettings settings = getSettingsFromState(state);
        if (settings != null) {
            m_currentState = state;
            m_searchForm.initFormValues(settings);
            search(settings, false);
        }
    }
    return sp;
}
Also used : I_CmsDialogContext(org.opencms.ui.I_CmsDialogContext) TextChangeEvent(com.vaadin.v7.event.FieldEvents.TextChangeEvent) HorizontalSplitPanel(com.vaadin.ui.HorizontalSplitPanel) CmsFileTableDialogContext(org.opencms.ui.components.CmsFileTableDialogContext) VerticalLayout(com.vaadin.v7.ui.VerticalLayout) I_CmsContextProvider(org.opencms.ui.apps.I_CmsContextProvider) TextField(com.vaadin.v7.ui.TextField) CmsFileTable(org.opencms.ui.components.CmsFileTable) TextChangeListener(com.vaadin.v7.event.FieldEvents.TextChangeListener)

Example 2 with CmsFileTableDialogContext

use of org.opencms.ui.components.CmsFileTableDialogContext in project opencms-core by alkacon.

the class CmsProjectManager method getProjectFiles.

/**
 * Returns the project files table.<p>
 *
 * @param projectId the selected project id
 *
 * @return the file table
 */
protected CmsFileTable getProjectFiles(CmsUUID projectId) {
    final CmsFileTable fileTable = new CmsFileTable(null);
    fileTable.applyWorkplaceAppSettings();
    fileTable.setContextProvider(new I_CmsContextProvider() {

        /**
         * @see org.opencms.ui.apps.I_CmsContextProvider#getDialogContext()
         */
        public I_CmsDialogContext getDialogContext() {
            CmsFileTableDialogContext context = new CmsFileTableDialogContext(CmsProjectManagerConfiguration.APP_ID, ContextType.fileTable, fileTable, fileTable.getSelectedResources());
            context.setEditableProperties(CmsFileExplorer.INLINE_EDIT_PROPERTIES);
            return context;
        }
    });
    CmsObject cms = A_CmsUI.getCmsObject();
    List<CmsResource> childResources;
    try {
        childResources = cms.readProjectView(projectId, CmsResource.STATE_KEEP);
        fileTable.fillTable(cms, childResources);
    } catch (CmsException e) {
        CmsErrorDialog.showErrorDialog(CmsVaadinUtils.getMessageText(Messages.ERR_PROJECTS_CAN_NOT_DISPLAY_FILES_0), e);
    }
    return fileTable;
}
Also used : CmsObject(org.opencms.file.CmsObject) I_CmsDialogContext(org.opencms.ui.I_CmsDialogContext) CmsResource(org.opencms.file.CmsResource) CmsFileTableDialogContext(org.opencms.ui.components.CmsFileTableDialogContext) CmsException(org.opencms.main.CmsException) I_CmsContextProvider(org.opencms.ui.apps.I_CmsContextProvider) CmsFileTable(org.opencms.ui.components.CmsFileTable)

Aggregations

I_CmsDialogContext (org.opencms.ui.I_CmsDialogContext)2 I_CmsContextProvider (org.opencms.ui.apps.I_CmsContextProvider)2 CmsFileTable (org.opencms.ui.components.CmsFileTable)2 CmsFileTableDialogContext (org.opencms.ui.components.CmsFileTableDialogContext)2 HorizontalSplitPanel (com.vaadin.ui.HorizontalSplitPanel)1 TextChangeEvent (com.vaadin.v7.event.FieldEvents.TextChangeEvent)1 TextChangeListener (com.vaadin.v7.event.FieldEvents.TextChangeListener)1 TextField (com.vaadin.v7.ui.TextField)1 VerticalLayout (com.vaadin.v7.ui.VerticalLayout)1 CmsObject (org.opencms.file.CmsObject)1 CmsResource (org.opencms.file.CmsResource)1 CmsException (org.opencms.main.CmsException)1