Improve runtime attribute editor usability #PL-4815

This commit is contained in:
Gleb Gorelov 2015-02-24 10:17:48 +00:00
parent 4014484842
commit 61711a8187
3 changed files with 8 additions and 6 deletions

View File

@ -17,7 +17,6 @@ import com.haulmont.cuba.gui.config.WindowInfo;
import org.apache.commons.lang.StringUtils;
import javax.annotation.Nullable;
import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
@ -30,16 +29,15 @@ import static com.haulmont.bali.util.Preconditions.checkNotNullArgument;
*/
public class DesktopRelatedEntities extends DesktopPopupButton implements RelatedEntities {
@Inject
protected ScreensHelper screensHelper;
protected ListComponent listComponent;
protected WindowManager.OpenType openType = WindowManager.OpenType.THIS_TAB;
protected Map<String, PropertyOption> propertyOptions = new HashMap<>();
protected String excludeRegex;
protected ScreensHelper screensHelper;
public DesktopRelatedEntities() {
screensHelper = AppBeans.get(ScreensHelper.NAME);
Messages messages = AppBeans.get(Messages.NAME);
setCaption(messages.getMainMessage("actions.Related"));
}

View File

@ -39,8 +39,10 @@ public class WebRelatedEntities extends WebPopupButton implements RelatedEntitie
protected Map<String, PropertyOption> propertyOptions = new HashMap<>();
protected String excludeRegex;
protected ScreensHelper screensHelper;
public WebRelatedEntities() {
screensHelper = AppBeans.get(ScreensHelper.NAME);
Messages messages = AppBeans.get(Messages.NAME);
setCaption(messages.getMainMessage("actions.Related"));
}
@ -137,7 +139,7 @@ public class WebRelatedEntities extends WebPopupButton implements RelatedEntitie
// check if browse screen available
PropertyOption propertyOption = propertyOptions.get(metaProperty.getName());
WindowInfo defaultScreen = AppBeans.get(ScreensHelper.class).getAvailableBrowseScreen(metaProperty.getRange().asClass());
WindowInfo defaultScreen = screensHelper.getAvailableBrowseScreen(metaProperty.getRange().asClass());
if (defaultScreen != null
|| (propertyOption != null && StringUtils.isNotEmpty(propertyOption.getScreen()))) {
RelatedAction relatedAction = new RelatedAction("related" + actionOrder.size(), listComponent, metaClass, metaProperty);

View File

@ -40,8 +40,10 @@ public class WebRelatedEntities extends WebPopupButton implements RelatedEntitie
protected Map<String, PropertyOption> propertyOptions = new HashMap<>();
protected String excludeRegex;
protected ScreensHelper screensHelper;
public WebRelatedEntities() {
screensHelper = AppBeans.get(ScreensHelper.NAME);
Messages messages = AppBeans.get(Messages.NAME);
setCaption(messages.getMainMessage("actions.Related"));
}
@ -139,7 +141,7 @@ public class WebRelatedEntities extends WebPopupButton implements RelatedEntitie
// check if browse screen available
PropertyOption propertyOption = propertyOptions.get(metaProperty.getName());
WindowInfo defaultScreen = AppBeans.get(ScreensHelper.class).getAvailableBrowseScreen(metaProperty.getRange().asClass());
WindowInfo defaultScreen = screensHelper.getAvailableBrowseScreen(metaProperty.getRange().asClass());
if (defaultScreen != null
|| (propertyOption != null && StringUtils.isNotEmpty(propertyOption.getScreen()))) {
RelatedAction relatedAction = new RelatedAction("related" + actionOrder.size(), listComponent, metaClass, metaProperty);