mirror of
https://gitee.com/jmix/cuba.git
synced 2024-11-30 18:27:56 +08:00
Shotcut'ы таблиц вешаются на весь UI #PL-2142 Fixed
This commit is contained in:
parent
ff6cbd3623
commit
f24d785cbd
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.horizontalactionslayout;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaHorizontalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout.CubaOrderedActionsLayoutConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
@Connect(value = CubaHorizontalActionsLayout.class, loadStyle = Connect.LoadStyle.EAGER)
|
||||
public class CubaHorizontalActionsLayoutConnector extends CubaOrderedActionsLayoutConnector {
|
||||
|
||||
@Override
|
||||
public CubaHorizontalActionsLayoutWidget getWidget() {
|
||||
return (CubaHorizontalActionsLayoutWidget) super.getWidget();
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.horizontalactionslayout;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout.CubaOrderedActionsLayoutWidget;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaHorizontalActionsLayoutWidget extends CubaOrderedActionsLayoutWidget {
|
||||
|
||||
public static final String CLASSNAME = "v-horizontallayout";
|
||||
|
||||
public CubaHorizontalActionsLayoutWidget(){
|
||||
super(CLASSNAME, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaOrderedActionsLayout;
|
||||
import com.vaadin.client.ApplicationConnection;
|
||||
import com.vaadin.client.Paintable;
|
||||
import com.vaadin.client.UIDL;
|
||||
import com.vaadin.client.ui.ShortcutActionHandler;
|
||||
import com.vaadin.client.ui.orderedlayout.AbstractOrderedLayoutConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
@Connect(value = CubaOrderedActionsLayout.class, loadStyle = Connect.LoadStyle.EAGER)
|
||||
public class CubaOrderedActionsLayoutConnector extends AbstractOrderedLayoutConnector implements Paintable {
|
||||
|
||||
|
||||
@Override
|
||||
public CubaOrderedActionsLayoutWidget getWidget() {
|
||||
return (CubaOrderedActionsLayoutWidget) super.getWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
|
||||
final int cnt = uidl.getChildCount();
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
UIDL childUidl = uidl.getChildUIDL(i);
|
||||
if (childUidl.getTag().equals("actions")) {
|
||||
if (getWidget().getShortcutHandler() == null) {
|
||||
getWidget().setShortcutHandler(new ShortcutActionHandler(uidl.getId(), client));
|
||||
}
|
||||
getWidget().getShortcutHandler().updateActionMap(childUidl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout;
|
||||
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.vaadin.client.StyleConstants;
|
||||
import com.vaadin.client.ui.ShortcutActionHandler;
|
||||
import com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaOrderedActionsLayoutWidget extends VAbstractOrderedLayout {
|
||||
protected ShortcutActionHandler shortcutHandler;
|
||||
|
||||
public CubaOrderedActionsLayoutWidget(){
|
||||
super(false);
|
||||
}
|
||||
|
||||
public CubaOrderedActionsLayoutWidget(String className, boolean vertical) {
|
||||
super(vertical);
|
||||
getElement().setTabIndex(0);
|
||||
setStyleName(className);
|
||||
DOM.sinkEvents(getElement(), Event.ONKEYDOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStyleName(String style) {
|
||||
super.setStyleName(style);
|
||||
addStyleName(StyleConstants.UI_LAYOUT);
|
||||
addStyleName(vertical ? "v-vertical" : "v-horizontal");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
super.onBrowserEvent(event);
|
||||
|
||||
final int type = DOM.eventGetType(event);
|
||||
if (type == Event.ONKEYDOWN && shortcutHandler != null) {
|
||||
shortcutHandler.handleKeyboardEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
public ShortcutActionHandler getShortcutHandler() {
|
||||
return shortcutHandler;
|
||||
}
|
||||
|
||||
public void setShortcutHandler(ShortcutActionHandler shortcutHandler) {
|
||||
this.shortcutHandler = shortcutHandler;
|
||||
}
|
||||
}
|
@ -10,7 +10,6 @@ import com.google.gwt.core.client.GWT;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaGroupTable;
|
||||
import com.vaadin.client.ApplicationConnection;
|
||||
import com.vaadin.client.UIDL;
|
||||
import com.vaadin.client.ui.table.TableConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
/**
|
||||
@ -18,7 +17,7 @@ import com.vaadin.shared.ui.Connect;
|
||||
* @version $Id$
|
||||
*/
|
||||
@Connect(value = CubaGroupTable.class, loadStyle = Connect.LoadStyle.LAZY)
|
||||
public class CubaGroupTableConnector extends TableConnector {
|
||||
public class CubaGroupTableConnector extends CubaScrollTableConnector {
|
||||
|
||||
@Override
|
||||
public CubaGroupTableWidget getWidget() {
|
||||
|
@ -15,7 +15,6 @@ import com.haulmont.cuba.web.toolkit.ui.client.Tools;
|
||||
import com.vaadin.client.BrowserInfo;
|
||||
import com.vaadin.client.UIDL;
|
||||
import com.vaadin.client.Util;
|
||||
import com.vaadin.client.ui.VScrollTable;
|
||||
import com.vaadin.shared.ui.table.TableConstants;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -25,7 +24,7 @@ import java.util.Set;
|
||||
* @author artamonov
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaGroupTableWidget extends VScrollTable {
|
||||
public class CubaGroupTableWidget extends CubaScrollTableWidget {
|
||||
|
||||
public static final String CLASSNAME = "cuba-grouptable";
|
||||
public static final String GROUP_DIVIDER_COLUMN_KEY = "-1";
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.table;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaTable;
|
||||
import com.vaadin.client.ApplicationConnection;
|
||||
import com.vaadin.client.UIDL;
|
||||
import com.vaadin.client.ui.ShortcutActionHandler;
|
||||
import com.vaadin.client.ui.table.TableConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
@Connect(value = CubaTable.class, loadStyle = Connect.LoadStyle.EAGER)
|
||||
public class CubaScrollTableConnector extends TableConnector {
|
||||
|
||||
@Override
|
||||
public CubaScrollTableWidget getWidget() {
|
||||
return (CubaScrollTableWidget) super.getWidget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
|
||||
super.updateFromUIDL(uidl, client);
|
||||
|
||||
// We may have actions attached to this panel
|
||||
if (uidl.getChildCount() > 1) {
|
||||
final int cnt = uidl.getChildCount();
|
||||
for (int i = 1; i < cnt; i++) {
|
||||
UIDL childUidl = uidl.getChildUIDL(i);
|
||||
if (childUidl.getTag().equals("actions")) {
|
||||
if (getWidget().getShortcutActionHandler() == null) {
|
||||
getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
|
||||
}
|
||||
getWidget().getShortcutActionHandler().updateActionMap(childUidl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.table;
|
||||
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.vaadin.client.UIDL;
|
||||
import com.vaadin.client.ui.ShortcutActionHandler;
|
||||
import com.vaadin.client.ui.VScrollTable;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaScrollTableWidget extends VScrollTable implements ShortcutActionHandler.ShortcutActionHandlerOwner {
|
||||
|
||||
protected ShortcutActionHandler shortcutHandler;
|
||||
|
||||
protected CubaScrollTableWidget() {
|
||||
// handle shortcuts
|
||||
DOM.sinkEvents(getElement(), Event.ONKEYDOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBrowserEvent(Event event) {
|
||||
super.onBrowserEvent(event);
|
||||
|
||||
final int type = DOM.eventGetType(event);
|
||||
if (type == Event.ONKEYDOWN && shortcutHandler != null) {
|
||||
shortcutHandler.handleKeyboardEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
public void setShortcutActionHandler(ShortcutActionHandler handler){
|
||||
this.shortcutHandler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShortcutActionHandler getShortcutActionHandler() {
|
||||
return shortcutHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateActionMap(UIDL mainUidl) {
|
||||
UIDL actionsUidl = mainUidl.getChildByTagName("actions");
|
||||
if (actionsUidl == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Iterator<?> it = actionsUidl.getChildIterator();
|
||||
while (it.hasNext()) {
|
||||
final UIDL action = (UIDL) it.next();
|
||||
final String key = action.getStringAttribute("key");
|
||||
final String caption = action.getStringAttribute("caption");
|
||||
if (!action.hasAttribute("kc")) {
|
||||
actionMap.put(key + "_c", caption);
|
||||
if (action.hasAttribute("icon")) {
|
||||
// TODO need some uri handling ??
|
||||
actionMap.put(key + "_i", client.translateVaadinUri(action
|
||||
.getStringAttribute("icon")));
|
||||
} else {
|
||||
actionMap.remove(key + "_i");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.verticalactionslayout;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout.CubaOrderedActionsLayoutConnector;
|
||||
import com.vaadin.shared.ui.Connect;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
@Connect(value = CubaVerticalActionsLayout.class, loadStyle = Connect.LoadStyle.EAGER)
|
||||
public class CubaVerticalActionsLayoutConnector extends CubaOrderedActionsLayoutConnector {
|
||||
|
||||
@Override
|
||||
public CubaVerticalActionsLayoutWidget getWidget() {
|
||||
return (CubaVerticalActionsLayoutWidget) super.getWidget();
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
|
||||
package com.haulmont.cuba.web.toolkit.ui.client.verticalactionslayout;
|
||||
|
||||
import com.haulmont.cuba.web.toolkit.ui.client.orderedactionslayout.CubaOrderedActionsLayoutWidget;
|
||||
|
||||
/**
|
||||
* @author devyatkin
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaVerticalActionsLayoutWidget extends CubaOrderedActionsLayoutWidget {
|
||||
|
||||
public static final String CLASSNAME = "v-verticallayout";
|
||||
|
||||
public CubaVerticalActionsLayoutWidget(){
|
||||
super(CLASSNAME, true);
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ import com.haulmont.cuba.web.gui.components.WebComponentsHelper;
|
||||
import com.haulmont.cuba.web.gui.components.WebFrameActionsHolder;
|
||||
import com.haulmont.cuba.web.toolkit.VersionedThemeResource;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaTimer;
|
||||
import com.haulmont.cuba.web.toolkit.ui.VerticalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import com.vaadin.event.ItemClickEvent;
|
||||
import com.vaadin.server.Sizeable;
|
||||
import com.vaadin.shared.ui.MarginInfo;
|
||||
@ -124,7 +124,7 @@ public class WebWindow implements Window, Component.Wrapper,
|
||||
}
|
||||
|
||||
protected com.vaadin.ui.Component createLayout() {
|
||||
VerticalActionsLayout layout = new VerticalActionsLayout();
|
||||
CubaVerticalActionsLayout layout = new CubaVerticalActionsLayout();
|
||||
layout.setSizeFull();
|
||||
return layout;
|
||||
}
|
||||
@ -1044,7 +1044,7 @@ public class WebWindow implements Window, Component.Wrapper,
|
||||
|
||||
@Override
|
||||
protected com.vaadin.ui.Component createLayout() {
|
||||
final VerticalActionsLayout form = new VerticalActionsLayout();
|
||||
final CubaVerticalActionsLayout form = new CubaVerticalActionsLayout();
|
||||
|
||||
container = new VerticalLayout();
|
||||
|
||||
|
@ -9,8 +9,8 @@ import com.haulmont.cuba.gui.components.*;
|
||||
import com.haulmont.cuba.gui.components.Formatter;
|
||||
import com.haulmont.cuba.web.toolkit.VersionedThemeResource;
|
||||
import com.haulmont.cuba.web.toolkit.data.AggregationContainer;
|
||||
import com.haulmont.cuba.web.toolkit.ui.HorizontalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.VerticalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaHorizontalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import com.vaadin.event.Action;
|
||||
import com.vaadin.server.ClassResource;
|
||||
import com.vaadin.server.FileResource;
|
||||
@ -186,12 +186,12 @@ public class WebComponentsHelper {
|
||||
|
||||
public static boolean isVerticalLayout(AbstractOrderedLayout layout) {
|
||||
return (layout instanceof VerticalLayout)
|
||||
|| (layout instanceof VerticalActionsLayout);
|
||||
|| (layout instanceof CubaVerticalActionsLayout);
|
||||
}
|
||||
|
||||
public static boolean isHorizontalLayout(AbstractOrderedLayout layout) {
|
||||
return (layout instanceof HorizontalLayout)
|
||||
|| (layout instanceof HorizontalActionsLayout);
|
||||
|| (layout instanceof CubaHorizontalActionsLayout);
|
||||
}
|
||||
|
||||
public static Alignment convertAlignment(com.haulmont.cuba.gui.components.Component.Alignment alignment) {
|
||||
|
@ -46,8 +46,8 @@ import com.haulmont.cuba.web.app.folders.FolderEditWindow;
|
||||
import com.haulmont.cuba.web.app.folders.FoldersPane;
|
||||
import com.haulmont.cuba.web.gui.components.filter.*;
|
||||
import com.haulmont.cuba.web.toolkit.VersionedThemeResource;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.FilterSelect;
|
||||
import com.haulmont.cuba.web.toolkit.ui.VerticalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.converters.SimpleIntegerToStringConverter;
|
||||
import com.vaadin.data.Property;
|
||||
import com.vaadin.data.Validator;
|
||||
@ -74,7 +74,7 @@ import java.util.regex.Pattern;
|
||||
* @author krivopustov
|
||||
* @version $Id$
|
||||
*/
|
||||
public class WebFilter extends WebAbstractComponent<VerticalActionsLayout> implements Filter {
|
||||
public class WebFilter extends WebAbstractComponent<CubaVerticalActionsLayout> implements Filter {
|
||||
|
||||
private static final String MESSAGES_PACK = "com.haulmont.cuba.gui.components.filter";
|
||||
|
||||
@ -134,7 +134,7 @@ public class WebFilter extends WebAbstractComponent<VerticalActionsLayout> imple
|
||||
|
||||
public WebFilter() {
|
||||
persistenceManager = AppBeans.get(PersistenceManagerService.NAME);
|
||||
component = new VerticalActionsLayout();
|
||||
component = new CubaVerticalActionsLayout();
|
||||
|
||||
messages = AppBeans.get(Messages.class);
|
||||
userSessionSource = AppBeans.get(UserSessionSource.class);
|
||||
|
@ -9,12 +9,12 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.haulmont.cuba.gui.ComponentsHelper;
|
||||
import com.haulmont.cuba.gui.components.*;
|
||||
import com.haulmont.cuba.gui.components.Component;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaGroupBox;
|
||||
import com.haulmont.cuba.web.toolkit.ui.HorizontalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.OrderedActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.VerticalActionsLayout;
|
||||
import com.vaadin.ui.*;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaHorizontalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaOrderedActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import com.vaadin.ui.AbstractOrderedLayout;
|
||||
import com.vaadin.ui.Layout;
|
||||
import org.apache.commons.lang.BooleanUtils;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.dom4j.Element;
|
||||
@ -44,7 +44,7 @@ public class WebGroupBox extends WebAbstractComponent<CubaGroupBox>
|
||||
component = new CubaGroupBox();
|
||||
component.setExpandChangeHandler(this);
|
||||
|
||||
VerticalActionsLayout container = new VerticalActionsLayout();
|
||||
CubaVerticalActionsLayout container = new CubaVerticalActionsLayout();
|
||||
initContainer(container);
|
||||
}
|
||||
|
||||
@ -71,16 +71,16 @@ public class WebGroupBox extends WebAbstractComponent<CubaGroupBox>
|
||||
@Override
|
||||
public void add(Component childComponent) {
|
||||
AbstractOrderedLayout newContent = null;
|
||||
if (orientation == Orientation.VERTICAL && !(component.getContent() instanceof VerticalActionsLayout)) {
|
||||
newContent = new VerticalActionsLayout();
|
||||
} else if (orientation == Orientation.HORIZONTAL && !(component.getContent() instanceof HorizontalActionsLayout))
|
||||
newContent = new HorizontalActionsLayout();
|
||||
if (orientation == Orientation.VERTICAL && !(component.getContent() instanceof CubaVerticalActionsLayout)) {
|
||||
newContent = new CubaVerticalActionsLayout();
|
||||
} else if (orientation == Orientation.HORIZONTAL && !(component.getContent() instanceof CubaHorizontalActionsLayout))
|
||||
newContent = new CubaHorizontalActionsLayout();
|
||||
|
||||
if (newContent != null) {
|
||||
initContainer(newContent);
|
||||
|
||||
newContent.setMargin(((OrderedActionsLayout) component.getContent()).getMargin());
|
||||
newContent.setSpacing(((OrderedActionsLayout) component.getContent()).isSpacing());
|
||||
newContent.setMargin(((CubaOrderedActionsLayout) component.getContent()).getMargin());
|
||||
newContent.setSpacing(((CubaOrderedActionsLayout) component.getContent()).isSpacing());
|
||||
}
|
||||
|
||||
getComponentContent().addComponent(WebComponentsHelper.getComposition(childComponent));
|
||||
|
@ -10,8 +10,7 @@
|
||||
package com.haulmont.cuba.web.gui.components;
|
||||
|
||||
import com.haulmont.cuba.gui.components.BoxLayout;
|
||||
import com.haulmont.cuba.gui.components.Component;
|
||||
import com.haulmont.cuba.web.toolkit.ui.HorizontalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaHorizontalActionsLayout;
|
||||
//import com.vaadin.terminal.gwt.client.ui.VHorizontalLayout;
|
||||
//import com.vaadin.ui.ClientWidget;
|
||||
|
||||
@ -20,6 +19,6 @@ import com.haulmont.cuba.web.toolkit.ui.HorizontalActionsLayout;
|
||||
public class WebHBoxLayout extends WebAbstractBox implements BoxLayout {
|
||||
|
||||
public WebHBoxLayout() {
|
||||
component = new HorizontalActionsLayout();
|
||||
component = new CubaHorizontalActionsLayout();
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ import com.haulmont.cuba.gui.components.Window;
|
||||
import com.haulmont.cuba.gui.data.impl.DsContextImplementation;
|
||||
import com.haulmont.cuba.gui.settings.Settings;
|
||||
import com.haulmont.cuba.gui.xml.layout.ComponentLoader;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.util.*;
|
||||
@ -202,7 +202,7 @@ public class WebTabSheet
|
||||
ComponentLoader loader) {
|
||||
|
||||
WebVBoxLayout tabContent = new WebVBoxLayout();
|
||||
VerticalLayout vbox = tabContent.getComponent();
|
||||
CubaVerticalActionsLayout vbox = tabContent.getComponent();
|
||||
vbox.setSizeFull();
|
||||
|
||||
final Tab tab = new Tab(name, tabContent);
|
||||
|
@ -9,9 +9,7 @@
|
||||
*/
|
||||
package com.haulmont.cuba.web.gui.components;
|
||||
|
||||
import com.haulmont.cuba.gui.components.BoxLayout;
|
||||
import com.haulmont.cuba.gui.components.Component;
|
||||
import com.haulmont.cuba.web.toolkit.ui.VerticalActionsLayout;
|
||||
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
|
||||
import com.vaadin.server.Sizeable;
|
||||
//import com.vaadin.terminal.gwt.client.ui.VVerticalLayout;
|
||||
//import com.vaadin.ui.ClientWidget;
|
||||
@ -20,7 +18,7 @@ import com.vaadin.server.Sizeable;
|
||||
//@ClientWidget(VVerticalLayout.class)
|
||||
public class WebVBoxLayout extends WebAbstractBox /*implements BoxLayout*/ {
|
||||
public WebVBoxLayout() {
|
||||
component = new VerticalActionsLayout();
|
||||
component = new CubaVerticalActionsLayout();
|
||||
component.setWidth(100, Sizeable.Unit.PERCENTAGE);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||
* @author gorodnov
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CubaGroupTable extends com.vaadin.ui.Table implements GroupTableContainer {
|
||||
public class CubaGroupTable extends CubaTable implements GroupTableContainer {
|
||||
|
||||
private KeyMapper groupIdMap = new KeyMapper();
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
public class CubaHorizontalActionsLayout extends CubaOrderedActionsLayout {
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
import com.vaadin.event.Action;
|
||||
import com.vaadin.event.ActionManager;
|
||||
import com.vaadin.server.PaintException;
|
||||
import com.vaadin.server.PaintTarget;
|
||||
import com.vaadin.ui.AbstractOrderedLayout;
|
||||
import com.vaadin.ui.LegacyComponent;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CubaOrderedActionsLayout extends AbstractOrderedLayout implements Action.Container, LegacyComponent {
|
||||
|
||||
private ActionManager actionManager;
|
||||
|
||||
public void addActionHandler(Action.Handler actionHandler) {
|
||||
getActionManager().addActionHandler(actionHandler);
|
||||
markAsDirty();
|
||||
}
|
||||
|
||||
public void removeActionHandler(Action.Handler actionHandler) {
|
||||
if (actionManager != null) {
|
||||
actionManager.removeActionHandler(actionHandler);
|
||||
markAsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
protected ActionManager getActionManager() {
|
||||
if (actionManager == null) {
|
||||
actionManager = new ActionManager(this);
|
||||
}
|
||||
return actionManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintContent(PaintTarget target) throws PaintException {
|
||||
if (actionManager != null) {
|
||||
actionManager.paintActions(null, target);
|
||||
target.addAttribute("test", "test");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeVariables(Object source, Map<String, Object> variables) {
|
||||
if (actionManager != null) {
|
||||
actionManager.handleActions(variables, this);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,14 @@ package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
import com.haulmont.cuba.web.gui.data.PropertyValueStringify;
|
||||
import com.vaadin.data.Property;
|
||||
import com.vaadin.event.Action;
|
||||
import com.vaadin.event.ActionManager;
|
||||
import com.vaadin.event.ShortcutListener;
|
||||
import com.vaadin.server.PaintException;
|
||||
import com.vaadin.server.PaintTarget;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author artamonov
|
||||
@ -15,6 +23,8 @@ import com.vaadin.data.Property;
|
||||
*/
|
||||
public class CubaTable extends com.vaadin.ui.Table {
|
||||
|
||||
protected ActionManager shortcutsManager = new ActionManager();
|
||||
|
||||
@Override
|
||||
protected String formatPropertyValue(Object rowId, Object colId, Property<?> property) {
|
||||
if (property instanceof PropertyValueStringify)
|
||||
@ -22,4 +32,33 @@ public class CubaTable extends com.vaadin.ui.Table {
|
||||
|
||||
return super.formatPropertyValue(rowId, colId, property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeVariables(Object source, Map<String, Object> variables) {
|
||||
super.changeVariables(source, variables);
|
||||
// Actions
|
||||
if (shortcutsManager != null) {
|
||||
shortcutsManager.handleActions(variables, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintActions(PaintTarget target, Set<Action> actionSet) throws PaintException {
|
||||
super.paintActions(target, actionSet);
|
||||
shortcutsManager.paintActions(null, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addShortcutListener(ShortcutListener listener) {
|
||||
/*if (listener.getKeyCode() != 13 || !(listener.getModifiers() == null || listener.getModifiers().length > 0)) {*/
|
||||
shortcutsManager.addAction(listener);
|
||||
/*} else
|
||||
shortcutListeners.add(listener);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeShortcutListener(ShortcutListener listener){
|
||||
/*shortcutListeners.remove(listener);*/
|
||||
shortcutsManager.removeAction(listener);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
|
||||
* Author: Nikolay Gorodnov
|
||||
* Created: 29.05.2010 14:00:05
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
public class CubaVerticalActionsLayout extends CubaOrderedActionsLayout {
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
//import com.haulmont.cuba.toolkit.gwt.client.ui.VHorizontalActionsLayout;
|
||||
//import com.haulmont.cuba.toolkit.gwt.client.ui.VVerticalActionsLayout;
|
||||
//import com.vaadin.ui.ClientWidget;
|
||||
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
//@ClientWidget(VHorizontalActionsLayout.class)
|
||||
public class HorizontalActionsLayout extends HorizontalLayout {
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
import com.vaadin.ui.AbstractOrderedLayout;
|
||||
|
||||
//import com.vaadin.server.PaintException;
|
||||
//import com.vaadin.server.PaintTarget;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class OrderedActionsLayout extends AbstractOrderedLayout /* implements Action.Container*/ {
|
||||
//
|
||||
// private ActionManager actionManager;
|
||||
//
|
||||
// public void addActionHandler(Action.Handler actionHandler) {
|
||||
// getActionManager().addActionHandler(actionHandler);
|
||||
// }
|
||||
//
|
||||
// public void removeActionHandler(Action.Handler actionHandler) {
|
||||
// if (actionManager != null) {
|
||||
// actionManager.removeActionHandler(actionHandler);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected ActionManager getActionManager() {
|
||||
// if (actionManager == null) {
|
||||
// actionManager = new ActionManager(this);
|
||||
// }
|
||||
// return actionManager;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void paintContent(PaintTarget target) throws PaintException {
|
||||
// super.paintContent(target);
|
||||
// if (actionManager != null) {
|
||||
// actionManager.paintActions(null, target);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeVariables(Object source, Map variables) {
|
||||
// super.changeVariables(source, variables);
|
||||
// if (actionManager != null) {
|
||||
// actionManager.handleActions(variables, this);
|
||||
// }
|
||||
// }
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Haulmont Technology Ltd. All Rights Reserved.
|
||||
* Haulmont Technology proprietary and confidential.
|
||||
* Use is subject to license terms.
|
||||
|
||||
* Author: Nikolay Gorodnov
|
||||
* Created: 29.05.2010 14:00:05
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
package com.haulmont.cuba.web.toolkit.ui;
|
||||
|
||||
//import com.haulmont.cuba.toolkit.gwt.client.ui.VVerticalActionsLayout;
|
||||
//import com.vaadin.ui.ClientWidget;
|
||||
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
//@ClientWidget(VVerticalActionsLayout.class)
|
||||
public class VerticalActionsLayout extends VerticalLayout {
|
||||
}
|
Loading…
Reference in New Issue
Block a user