/*
 * Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.

 * Author: Eugeniy Degtyarjov
 * Created: 20.07.2010 14:39:14
 *
 * $Id$
 */
package cuba.client.web.ui.report.edit;

import com.haulmont.cuba.core.global.MessageProvider;
import com.haulmont.cuba.gui.components.AbstractEditor;
import com.haulmont.cuba.gui.components.IFrame;
import com.haulmont.cuba.gui.components.LookupField;
import com.haulmont.cuba.gui.AppConfig;
import com.haulmont.cuba.gui.data.ValueListener;
import com.haulmont.cuba.gui.config.WindowInfo;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.report.ReportScreen;

import java.util.Map;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;

public class ReportScreenEditor extends AbstractEditor {
    private static final long serialVersionUID = -5176428889018585775L;
    private ReportScreen reportScreen;

    public ReportScreenEditor(IFrame frame) {
        super(frame);
    }

    @Override
    public void setItem(Entity item) {
        super.setItem(item);
        reportScreen = (ReportScreen) getItem();
    }

    @Override
    protected void init(Map<String, Object> params) {
        super.init(params);

        LookupField screenLookupField = getComponent("screenId");
        Collection<WindowInfo> windowInfoCollection = AppConfig.getInstance().getWindowConfig().getWindows();
        List<String> screenAliases = new ArrayList<String>();
        for (WindowInfo windowInfo : windowInfoCollection) {
            String id = windowInfo.getId();
            String menuId = "menu-config." + id;
            String localeMsg = MessageProvider.getMessage(AppConfig.getInstance().getMessagesPack(),menuId);
            String title = menuId.equals(localeMsg) ? id : id + " ( " + localeMsg + " )";
            screenAliases.add(title);
        }
        screenLookupField.setOptionsList(screenAliases);
        screenLookupField.addListener(new ValueListener() {
            public void valueChanged(Object source, String property, Object prevValue, Object value) {
                reportScreen.setScreenId(value != null ? value.toString() : null);
            }
        });

    }
}

@@ -318,30 +318,117 @@
 ore.
-global.MessageProvider
+entity.Entity;%0D%0Aimport com.haulmont.cuba.core.global.MessageProvider;%0D%0Aimport com.haulmont.cuba.gui.AppConfig
 ;%0D%0Ai
@@ -611,33 +611,41 @@
 nt.cuba.gui.
-AppC
+c
 onfig
+.WindowInfo
 ;%0D%0Aimport co
@@ -689,103 +689,8 @@
 r;%0D%0A
-import com.haulmont.cuba.gui.config.WindowInfo;%0D%0Aimport com.haulmont.cuba.core.entity.Entity;%0D%0A
 impo
@@ -738,31 +738,8 @@
 %0D%0A%0D%0A
-import java.util.Map;%0D%0A
 impo
@@ -781,20 +781,23 @@
 va.util.
-List
+HashMap
 ;%0D%0Aimpor
@@ -808,25 +808,19 @@
 va.util.
-ArrayList
+Map
 ;%0D%0A%0D%0Apub
@@ -1503,27 +1503,33 @@
     
-List
+Map
 %3CString
+,Object
 %3E screen
 Alia
@@ -1528,22 +1528,16 @@
 reen
-Aliase
 s = new 
 Arra
@@ -1536,24 +1536,29 @@
 new 
-ArrayList%3CString
+HashMap%3CString,Object
 %3E();
@@ -1939,25 +1939,22 @@
 reen
-Aliases.add
+s.put
 (title
+,id
 );%0D%0A
@@ -2004,25 +2004,18 @@
 ions
-List
+Map
 (screen
-Aliase
 s);%0D

Fix (Запуск отчёта без показа списка, если для данного экрана он один)