PL-7429 Support caption for all components

This commit is contained in:
Daniil Tsarev 2016-11-23 14:19:23 +04:00
parent c5281ac190
commit c5df48bbf5
62 changed files with 683 additions and 33 deletions

View File

@ -45,6 +45,7 @@ public abstract class DesktopAbstractBox
protected Map<Component, Pair<JPanel, BoxLayoutAdapter>> wrappers = new HashMap<>();
protected boolean scheduledRepaint = false;
protected String caption;
public DesktopAbstractBox() {
impl = new JPanel();
@ -427,4 +428,24 @@ public abstract class DesktopAbstractBox
}
}
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
}

View File

@ -152,6 +152,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
protected Datasource.ItemPropertyChangeListener itemPropertyChangeListener;
protected CollectionDsActionsNotifier collectionDsActionsNotifier;
protected String caption;
protected DesktopAbstractTable() {
shortcutsDelegate.setAllowEnterShortcut(false);
@ -2343,6 +2344,26 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
impl.scrollRowToVisible(rowIndex);
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
/**
* Uses delegate renderer to create cell component.
* Then applies desktop styles to cell component.

View File

@ -35,6 +35,7 @@ public class DesktopEmbedded extends DesktopAbstractComponent<JPanel> implements
private Type type; // only IMAGE currently supported, hope object and browser will never needed for desktop
private Image image;
private String caption;
public DesktopEmbedded() {
type = Type.IMAGE;
@ -159,6 +160,26 @@ public class DesktopEmbedded extends DesktopAbstractComponent<JPanel> implements
return type;
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
private class ImagePanel extends JPanel {
@Override
public void paint(Graphics g) {

View File

@ -23,8 +23,8 @@ import com.haulmont.cuba.desktop.sys.layout.BoxLayoutAdapter;
import com.haulmont.cuba.desktop.sys.layout.GridLayoutAdapter;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.GridLayout;
import com.haulmont.cuba.gui.components.Frame;
import com.haulmont.cuba.gui.components.GridLayout;
import net.miginfocom.layout.CC;
import javax.annotation.Nonnull;
@ -42,6 +42,7 @@ public class DesktopGridLayout extends DesktopAbstractComponent<JPanel> implemen
protected Map<Component, Pair<JPanel, BoxLayoutAdapter>> wrappers = new HashMap<>();
protected boolean scheduledRepaint = false;
protected String caption;
public DesktopGridLayout() {
impl = new JPanel();
@ -389,4 +390,24 @@ public class DesktopGridLayout extends DesktopAbstractComponent<JPanel> implemen
}
}
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
}

View File

@ -18,8 +18,8 @@
package com.haulmont.cuba.desktop.gui.components;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.ScrollBoxLayout;
import org.apache.commons.lang.ObjectUtils;
import javax.annotation.Nonnull;
@ -41,6 +41,7 @@ public class DesktopScrollBoxLayout extends DesktopAbstractComponent<JScrollPane
protected DesktopAbstractBox content;
protected boolean scheduledRepaint = false;
protected String caption;
public DesktopScrollBoxLayout() {
impl = new JScrollPane();
@ -358,4 +359,24 @@ public class DesktopScrollBoxLayout extends DesktopAbstractComponent<JScrollPane
}
}
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
}

View File

@ -44,6 +44,7 @@ public class DesktopSplitPanel extends DesktopAbstractComponent<JSplitPane> impl
protected Collection<Component> ownComponents = new LinkedHashSet<>();
protected boolean settingsEnabled = true;
protected boolean locked = false;
protected String caption;
public DesktopSplitPanel() {
impl = new JSplitPane() {
@ -364,4 +365,24 @@ public class DesktopSplitPanel extends DesktopAbstractComponent<JSplitPane> impl
}
}
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
}

View File

@ -62,6 +62,7 @@ public class DesktopTabSheet extends DesktopAbstractComponent<JTabbedPane> imple
// CAUTION do not add ChangeListeners directly to impl
protected List<ChangeListener> implTabSheetChangeListeners = new ArrayList<>();
protected String caption;
public DesktopTabSheet() {
impl = new JTabbedPaneExt();
@ -823,4 +824,24 @@ public class DesktopTabSheet extends DesktopAbstractComponent<JTabbedPane> imple
}
}
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
}

View File

@ -47,7 +47,6 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.List;
public class DesktopTree<E extends Entity> extends DesktopAbstractActionsHolderComponent<JTree> implements Tree<E> {
@ -68,6 +67,8 @@ public class DesktopTree<E extends Entity> extends DesktopAbstractActionsHolderC
protected Action enterPressAction;
protected boolean editable = true;
protected String caption;
protected CollectionDatasource.CollectionChangeListener collectionChangeListener;
protected CollectionDsActionsNotifier collectionDsActionsNotifier;
@ -520,6 +521,27 @@ public class DesktopTree<E extends Entity> extends DesktopAbstractActionsHolderC
this.editable = editable;
}
@Override
public String getCaption() {
return caption;
}
@Override
public void setCaption(String caption) {
this.caption = caption;
}
@Override
public String getDescription() {
return impl.getToolTipText();
}
@Override
public void setDescription(String description) {
impl.setToolTipText(description);
}
@Override
protected void attachAction(Action action) {
if (action instanceof Action.HasTarget) {

View File

@ -182,6 +182,36 @@ public class AbstractFrame implements Frame, Frame.Wrapper, Component.Wrapper, C
frame.setAlignment(alignment);
}
@Override
public String getCaption() {
return frame.getCaption();
}
@Override
public void setCaption(String caption) {
frame.setCaption(caption);
}
@Override
public String getDescription() {
return frame.getDescription();
}
@Override
public void setDescription(String description) {
frame.setDescription(description);
}
@Override
public String getIcon() {
return frame.getIcon();
}
@Override
public void setIcon(String icon) {
frame.setIcon(icon);
}
@Override
public void add(Component component) {
frame.add(component);

View File

@ -22,7 +22,7 @@ import org.dom4j.Element;
import java.util.Collection;
public interface Accordion extends Component.Container, Component.BelongToFrame {
public interface Accordion extends Component.Container, Component.BelongToFrame, Component.HasCaption, Component.HasIcon {
String NAME = "accordion";
/**

View File

@ -16,8 +16,8 @@
*/
package com.haulmont.cuba.gui.components;
public interface BoxLayout extends ExpandingLayout, Component.OrderedContainer,
Component.Spacing, Component.Margin, Component.BelongToFrame {
public interface BoxLayout extends ExpandingLayout, Component.OrderedContainer, Component.Spacing, Component.Margin,
Component.BelongToFrame, Component.HasCaption, Component.HasIcon {
/**
* @deprecated Use {@link VBoxLayout#NAME}
*/

View File

@ -17,7 +17,7 @@
package com.haulmont.cuba.gui.components;
public interface CssLayout extends Component.OrderedContainer, Component.BelongToFrame {
public interface CssLayout extends Component.OrderedContainer, Component.BelongToFrame, Component.HasCaption, Component.HasIcon {
String NAME = "cssLayout";

View File

@ -30,7 +30,7 @@ import java.util.Map;
* Web implementation may require a browser plugin. Only images support is mandatory for all implementations.
*
*/
public interface Embedded extends Component, Component.BelongToFrame {
public interface Embedded extends Component, Component.BelongToFrame, Component.HasCaption, Component.HasIcon {
String NAME = "embedded";

View File

@ -22,8 +22,8 @@ import org.dom4j.Element;
import java.util.Map;
public interface FieldGroup extends Component, Component.BelongToFrame, Component.HasCaption, Component.HasBorder,
Component.Editable, Component.Validatable {
public interface FieldGroup extends Component, Component.BelongToFrame, Component.HasCaption, Component.HasIcon,
Component.HasBorder, Component.Editable, Component.Validatable {
String NAME = "fieldGroup";

View File

@ -24,7 +24,7 @@ import java.util.List;
public interface Filter extends Component.Margin, Component.BelongToFrame, Component.HasNamedComponents,
Component.HasXmlDescriptor, Component.HasSettings, Component.HasCaption,
Component.Collapsable {
Component.HasIcon, Component.Collapsable {
String NAME = "filter";

View File

@ -17,8 +17,8 @@
package com.haulmont.cuba.gui.components;
public interface FlowBoxLayout extends Component.OrderedContainer, Component.BelongToFrame,
Component.Margin, Component.Spacing {
public interface FlowBoxLayout extends Component.OrderedContainer, Component.BelongToFrame, Component.Margin,
Component.Spacing, Component.HasCaption, Component.HasIcon {
String NAME = "flowBox";
}

View File

@ -40,7 +40,9 @@ public interface Frame
Component.BelongToFrame,
Component.Spacing,
Component.Margin,
Component.ActionsHolder {
Component.ActionsHolder,
Component.HasIcon,
Component.HasCaption {
/** XML element name used to show a frame in an enclosing screen. */
String NAME = "frame";

View File

@ -18,7 +18,7 @@
package com.haulmont.cuba.gui.components;
public interface GridLayout
extends Component.Container, Component.Spacing, Component.Margin, Component.BelongToFrame
extends Component.Container, Component.Spacing, Component.Margin, Component.BelongToFrame, Component.HasIcon, Component.HasCaption
{
String NAME = "grid";

View File

@ -19,7 +19,7 @@ package com.haulmont.cuba.gui.components;
public interface GroupBoxLayout
extends ExpandingLayout,
Component.OrderedContainer,
Component.HasCaption, Component.HasBorder, Component.Spacing,
Component.HasIcon, Component.HasCaption, Component.HasBorder, Component.Spacing,
Component.Collapsable, Component.BelongToFrame, Component.HasSettings {
String NAME = "groupBox";

View File

@ -16,7 +16,7 @@
*/
package com.haulmont.cuba.gui.components;
public interface HtmlBoxLayout extends Component.Container, Component.BelongToFrame {
public interface HtmlBoxLayout extends Component.Container, Component.BelongToFrame, Component.HasIcon, Component.HasCaption {
String NAME = "htmlBox";

View File

@ -17,7 +17,8 @@
package com.haulmont.cuba.gui.components;
public interface ScrollBoxLayout
extends Component.OrderedContainer, Component.BelongToFrame, Component.Margin, Component.Spacing {
extends Component.OrderedContainer, Component.BelongToFrame, Component.Margin, Component.Spacing,
Component.HasIcon, Component.HasCaption {
String NAME = "scrollBox";

View File

@ -16,7 +16,7 @@
*/
package com.haulmont.cuba.gui.components;
public interface SplitPanel extends Component.Container, Component.BelongToFrame {
public interface SplitPanel extends Component.Container, Component.BelongToFrame, Component.HasIcon, Component.HasCaption {
String NAME = "split";

View File

@ -24,7 +24,7 @@ import java.util.Collection;
/**
* TabSheet component interface.
*/
public interface TabSheet extends Component.Container, Component.BelongToFrame {
public interface TabSheet extends Component.Container, Component.BelongToFrame, Component.HasIcon, Component.HasCaption {
String NAME = "tabSheet";

View File

@ -30,7 +30,7 @@ import java.util.Map;
public interface Table<E extends Entity>
extends
ListComponent<E>, Component.Editable, Component.HasSettings,
Component.HasButtonsPanel, Component.HasPresentations {
Component.HasButtonsPanel, Component.HasPresentations, Component.HasCaption, Component.HasIcon {
enum ColumnAlignment {
LEFT,

View File

@ -21,7 +21,8 @@ import com.haulmont.cuba.gui.data.HierarchicalDatasource;
import javax.annotation.Nullable;
public interface Tree<E extends Entity> extends ListComponent<E>, Component.Editable, Component.HasButtonsPanel {
public interface Tree<E extends Entity> extends ListComponent<E>, Component.Editable, Component.HasButtonsPanel,
Component.HasCaption, Component.HasIcon {
String NAME = "tree";
void expandTree();

View File

@ -57,6 +57,10 @@ public interface FilterDelegate {
void setCaption(String caption);
String getIcon();
void setIcon(String icon);
void setMaxResults(int maxResults);
int getMaxResults();

View File

@ -1532,6 +1532,16 @@ public class FilterDelegateImpl implements FilterDelegate {
groupBoxLayout.setCaption(caption);
}
@Override
public String getIcon() {
return groupBoxLayout.getIcon();
}
@Override
public void setIcon(String icon) {
groupBoxLayout.setIcon(icon);
}
@Override
public void setManualApplyRequired(Boolean manualApplyRequired) {
this.manualApplyRequired = manualApplyRequired;

View File

@ -460,6 +460,8 @@
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasEditState"/>
<xs:attributeGroup ref="hasAlign"/>
@ -695,6 +697,7 @@
<xs:attributeGroup ref="hasEditable"/>
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasSize"/>
@ -1095,6 +1098,8 @@
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attribute name="src" type="xs:string"/>
<xs:attribute name="type" type="embeddedType"/>
</xs:complexType>
@ -1118,6 +1123,8 @@
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attribute name="multiselect" type="xs:boolean"/>
</xs:complexType>
@ -1206,6 +1213,8 @@
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasExpand"/>
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasEnableProp"/>
@ -1326,7 +1335,8 @@
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="requiresDatasource"/>
<xs:attributeGroup ref="hasCaptionProp"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasEnableProp"/>
@ -1423,6 +1433,8 @@
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasAlign"/>
@ -1542,6 +1554,8 @@
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasEnableProp"/>
@ -1557,6 +1571,8 @@
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="isLayoutComponent"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
</xs:complexType>
<!-- FlowBoxLayout -->
@ -1566,6 +1582,8 @@
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasSpacingMargin"/>
@ -1578,6 +1596,8 @@
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasResponsive"/>
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasVisibility"/>
@ -1596,6 +1616,8 @@
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasSpacingMargin"/>
<xs:attributeGroup ref="hasVisibility"/>
@ -1613,6 +1635,8 @@
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attribute name="orientation" type="orientation"/>
<xs:attribute name="pos" type="xs:string"/>
@ -1647,6 +1671,8 @@
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasStyle"/>
@ -1678,6 +1704,8 @@
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
</xs:complexType>
<!-- GridLayout -->
@ -1718,6 +1746,8 @@
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attributeGroup ref="hasEnableProp"/>
<xs:attributeGroup ref="hasSpacingMargin"/>
@ -1728,7 +1758,8 @@
<xs:group ref="layoutOrComponent" minOccurs="0"/>
<xs:attributeGroup ref="hasId"/>
<xs:attributeGroup ref="hasCaptionProp"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasAlign"/>
@ -1750,6 +1781,8 @@
<xs:attributeGroup ref="hasSize"/>
<xs:attributeGroup ref="hasStyle"/>
<xs:attributeGroup ref="hasAlign"/>
<xs:attributeGroup ref="hasIcon"/>
<xs:attributeGroup ref="hasCaption"/>
<xs:attributeGroup ref="hasVisibility"/>
<xs:attribute name="src" type="xs:string"/>

View File

@ -39,6 +39,10 @@ public abstract class AbstractBoxLoader<T extends BoxLayout> extends ContainerLo
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSubComponentsAndExpand(resultComponent, element);
}
}

View File

@ -75,6 +75,10 @@ public abstract class AbstractTableLoader<T extends Table> extends ActionsHolder
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSortable(resultComponent, element);
loadReorderingAllowed(resultComponent, element);
loadColumnControlVisible(resultComponent, element);

View File

@ -72,6 +72,10 @@ public class AccordionLoader extends ContainerLoader<Accordion> {
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
@SuppressWarnings("unchecked")
List<Element> tabElements = element.elements("tab");
for (Element tabElement : tabElements) {

View File

@ -57,6 +57,10 @@ public class ButtonsPanelLoader extends ContainerLoader<ButtonsPanel> {
loadWidth(resultComponent, element);
loadHeight(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
if (!element.elements().isEmpty()) {
loadSubComponents();
} else {

View File

@ -83,5 +83,9 @@ public class EmbeddedLoader extends AbstractComponentLoader<Embedded> {
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadAlign(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadIcon(resultComponent, element);
}
}

View File

@ -495,7 +495,9 @@ public class FieldGroupLoader extends AbstractComponentLoader<FieldGroup> {
loadStyleName(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadHeight(resultComponent, element);

View File

@ -56,7 +56,9 @@ public class FilterLoader extends AbstractComponentLoader<Filter> {
loadEnable(resultComponent, element);
loadStyleName(resultComponent, element);
loadMargin(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadWidth(resultComponent, element, "100%");
loadCollapsible(resultComponent, element, true);
loadSettingsEnabled(resultComponent, element);

View File

@ -43,6 +43,10 @@ public class FlowBoxLayoutLoader extends ContainerLoader<FlowBoxLayout> {
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSubComponents();
}
}

View File

@ -101,6 +101,10 @@ public class FrameComponentLoader extends ContainerLoader<Frame> {
loadHeight(resultComponent, element, ComponentsHelper.getComponentHeigth(resultComponent));
loadWidth(resultComponent, element, ComponentsHelper.getComponentWidth(resultComponent));
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
if (context.getFrame() != null) {
resultComponent.setFrame(context.getFrame());
}

View File

@ -139,6 +139,10 @@ public class GridLayoutLoader extends ContainerLoader<GridLayout> {
loadAlign(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSubComponents();
}

View File

@ -38,6 +38,7 @@ public class GroupBoxLayoutLoader extends ContainerLoader<GroupBoxLayout> {
loadSettingsEnabled(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);

View File

@ -47,6 +47,10 @@ public class HtmlBoxLayoutLoader extends ContainerLoader<HtmlBoxLayout> {
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSubComponents();
}

View File

@ -86,6 +86,10 @@ public class ScrollBoxLayoutLoader extends ContainerLoader<ScrollBoxLayout> {
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSubComponents();
for (Component child : resultComponent.getOwnComponents()) {

View File

@ -52,6 +52,10 @@ public class SplitPanelLoader extends ContainerLoader<SplitPanel> {
loadVisible(resultComponent, element);
loadStyleName(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
String pos = element.attributeValue("pos");
if (!StringUtils.isEmpty(pos)) {
boolean reversePosition = false;

View File

@ -72,6 +72,10 @@ public class TabSheetLoader extends ContainerLoader<TabSheet> {
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
@SuppressWarnings("unchecked")
List<Element> tabElements = element.elements("tab");
for (Element tabElement : tabElements) {

View File

@ -74,6 +74,10 @@ public class TreeLoader extends ActionsHolderLoader<Tree> {
resultComponent.setCaptionMode(CaptionMode.PROPERTY);
}
}
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
}
protected void createButtonsPanel(Tree resultComponent, Element element) {

View File

@ -23,6 +23,7 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HasEnabled;
import com.haulmont.cuba.web.toolkit.ui.client.Tools;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.ui.VPanel;
public class CubaGroupBoxWidget extends VPanel implements HasEnabled {
@ -185,4 +186,15 @@ public class CubaGroupBoxWidget extends VPanel implements HasEnabled {
void collapse();
}
@Override
public void setIconUri(String iconUri, ApplicationConnection client) {
if (icon != null) {
captionNode.removeChild(icon.getElement());
}
icon = client.getIcon(iconUri);
if (icon != null) {
DOM.insertChild(captionNode, icon.getElement(), 1);
}
}
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2008-2016 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.haulmont.cuba.web.toolkit.ui.client.panel;
import com.haulmont.cuba.web.toolkit.ui.CubaScrollBoxPanel;
import com.vaadin.client.ui.panel.PanelConnector;
import com.vaadin.shared.ui.Connect;
@Connect(value = CubaScrollBoxPanel.class)
public class CubaScrollBoxPanelConnector extends PanelConnector {
@Override
public boolean delegateCaptionHandling() {
return true;
}
}

View File

@ -21,6 +21,7 @@ import com.haulmont.cuba.gui.components.BoxLayout;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.Frame;
import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.AbstractOrderedLayout;
import javax.annotation.Nonnull;
@ -203,4 +204,26 @@ public abstract class WebAbstractBox extends WebAbstractComponent<AbstractOrdere
public void setSpacing(boolean enabled) {
component.setSpacing(enabled);
}
@Override
public String getCaption() {
return getComposition().getCaption();
}
@Override
public void setCaption(String caption) {
getComposition().setCaption(caption);
}
@Override
public String getDescription() {
return getComposition().getDescription();
}
@Override
public void setDescription(String description) {
if (getComposition() instanceof AbstractComponent) {
((AbstractComponent) getComposition()).setDescription(description);
}
}
}

View File

@ -20,6 +20,7 @@ package com.haulmont.cuba.web.gui.components;
import com.haulmont.cuba.gui.ComponentsHelper;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.Frame;
import com.vaadin.ui.AbstractComponent;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -27,7 +28,7 @@ import java.util.*;
public class WebAbstractOrderedLayout<T extends com.vaadin.ui.CssLayout>
extends WebAbstractComponent<T>
implements Component.OrderedContainer, Component.BelongToFrame {
implements Component.OrderedContainer, Component.BelongToFrame, Component.HasCaption, Component.HasIcon {
protected Collection<Component> ownComponents = new LinkedHashSet<>();
protected Map<String, Component> componentByIds = new HashMap<>();
@ -155,4 +156,27 @@ public class WebAbstractOrderedLayout<T extends com.vaadin.ui.CssLayout>
public Collection<Component> getComponents() {
return ComponentsHelper.getComponents(this);
}
@Override
public String getCaption() {
return getComposition().getCaption();
}
@Override
public void setCaption(String caption) {
getComposition().setCaption(caption);
}
@Override
public String getDescription() {
return getComposition().getDescription();
}
@Override
public void setDescription(String description) {
if (getComposition() instanceof AbstractComponent) {
((AbstractComponent) getComposition()).setDescription(description);
}
}
}

View File

@ -26,7 +26,6 @@ import com.haulmont.chile.core.model.MetaProperty;
import com.haulmont.chile.core.model.MetaPropertyPath;
import com.haulmont.cuba.client.ClientConfig;
import com.haulmont.cuba.core.app.dynamicattributes.DynamicAttributesUtils;
import com.haulmont.cuba.core.entity.CategoryAttribute;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.entity.SoftDelete;
import com.haulmont.cuba.core.global.*;
@ -84,7 +83,6 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.lang.reflect.Method;
import java.util.*;
import java.util.stream.Collectors;
import static com.haulmont.bali.util.Preconditions.checkNotNullArgument;
@ -1452,11 +1450,11 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table & CubaEnhan
}
public String getCaption() {
return component.getCaption();
return getComposition().getCaption();
}
public void setCaption(String caption) {
component.setCaption(caption);
getComposition().setCaption(caption);
}
@Override
@ -2835,4 +2833,14 @@ public abstract class WebAbstractTable<T extends com.vaadin.ui.Table & CubaEnhan
component.setCurrentPageFirstItemId(item.getId());
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
}

View File

@ -23,13 +23,13 @@ import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.data.HierarchicalDatasource;
import com.haulmont.cuba.web.toolkit.ui.CubaTree;
import com.vaadin.event.ShortcutListener;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.VerticalLayout;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
@ -90,6 +90,40 @@ public abstract class WebAbstractTree<T extends CubaTree, E extends Entity>
component.setReadOnly(!editable);
}
@Override
public String getIcon() {
return icon;
}
@Override
public void setIcon(String icon) {
this.icon = icon;
getComposition().setIcon(WebComponentsHelper.getIcon(icon));
}
@Override
public String getCaption() {
return getComposition().getCaption();
}
@Override
public void setCaption(String caption) {
getComposition().setCaption(caption);
}
@Override
public String getDescription() {
return getComposition().getDescription();
}
@Override
public void setDescription(String description) {
if (getComposition() instanceof AbstractComponent) {
((AbstractComponent) getComposition()).setDescription(description);
}
}
@Override
public ButtonsPanel getButtonsPanel() {
return buttonsPanel;

View File

@ -29,6 +29,7 @@ import com.haulmont.cuba.gui.xml.layout.ComponentLoader;
import com.haulmont.cuba.web.AppUI;
import com.haulmont.cuba.web.WebWindowManager;
import com.haulmont.cuba.web.toolkit.ui.CubaAccordion;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Layout;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Element;
@ -110,6 +111,28 @@ public class WebAccordion extends WebAbstractComponent<CubaAccordion> implements
return ComponentsHelper.getComponents(this);
}
@Override
public String getCaption() {
return getComposition().getCaption();
}
@Override
public void setCaption(String caption) {
getComposition().setCaption(caption);
}
@Override
public String getDescription() {
return getComposition().getDescription();
}
@Override
public void setDescription(String description) {
if (getComposition() instanceof AbstractComponent) {
((AbstractComponent) getComposition()).setDescription(description);
}
}
protected class Tab implements Accordion.Tab {
private String name;
private Component tabComponent;

View File

@ -220,6 +220,26 @@ public class WebEmbedded extends WebAbstractComponent<com.vaadin.ui.Embedded> im
}
}
@Override
public String getCaption() {
return component.getCaption();
}
@Override
public void setCaption(String caption) {
component.setCaption(caption);
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
protected static class EmptyStreamSource implements StreamResource.StreamSource {
public static final String EMPTY_IMAGE_PATH = "/com/haulmont/cuba/web/gui/components/resources/empty.png";

View File

@ -320,4 +320,13 @@ public class WebFilter extends WebAbstractComponent<CubaVerticalActionsLayout> i
delegate.switchFilterMode(filterMode);
}
@Override
public String getIcon() {
return delegate.getIcon();
}
@Override
public void setIcon(String icon) {
delegate.setIcon(icon);
}
}

View File

@ -230,4 +230,24 @@ public class WebGridLayout extends WebAbstractComponent<CubaGridLayout> implemen
public void setSpacing(boolean enabled) {
component.setSpacing(enabled);
}
@Override
public String getCaption() {
return component.getCaption();
}
@Override
public void setCaption(String caption) {
component.setCaption(caption);
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
}

View File

@ -145,4 +145,24 @@ public class WebHtmlBoxLayout extends WebAbstractComponent<CustomLayout> impleme
public Collection<Component> getComponents() {
return ComponentsHelper.getComponents(this);
}
@Override
public String getCaption() {
return component.getCaption();
}
@Override
public void setCaption(String caption) {
component.setCaption(caption);
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
}

View File

@ -21,10 +21,11 @@ import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.Frame;
import com.haulmont.cuba.gui.components.ScrollBoxLayout;
import com.haulmont.cuba.web.toolkit.ui.CubaHorizontalActionsLayout;
import com.haulmont.cuba.web.toolkit.ui.CubaScrollBoxPanel;
import com.haulmont.cuba.web.toolkit.ui.CubaVerticalActionsLayout;
import com.vaadin.server.Sizeable;
import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.*;
import com.vaadin.ui.AbstractOrderedLayout;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
@ -34,7 +35,7 @@ import java.util.*;
import static com.haulmont.cuba.web.gui.components.WebComponentsHelper.convertAlignment;
public class WebScrollBoxLayout extends WebAbstractComponent<Panel> implements ScrollBoxLayout {
public class WebScrollBoxLayout extends WebAbstractComponent<CubaScrollBoxPanel> implements ScrollBoxLayout {
public static final String CUBA_SCROLLBOX_CONTENT_STYLE = "c-scrollbox-content";
@ -47,7 +48,7 @@ public class WebScrollBoxLayout extends WebAbstractComponent<Panel> implements S
protected String styleName;
public WebScrollBoxLayout() {
component = new Panel();
component = new CubaScrollBoxPanel();
component.setStyleName("c-scrollbox");
CubaVerticalActionsLayout content = new CubaVerticalActionsLayout();
@ -295,4 +296,24 @@ public class WebScrollBoxLayout extends WebAbstractComponent<Panel> implements S
public void setSpacing(boolean enabled) {
getContent().setSpacing(enabled);
}
@Override
public String getCaption() {
return component.getCaption();
}
@Override
public void setCaption(String caption) {
component.setCaption(caption);
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
}

View File

@ -353,4 +353,24 @@ public class WebSplitPanel extends WebAbstractComponent<AbstractSplitPanel> impl
return Sizeable.Unit.PIXELS;
}
}
@Override
public String getCaption() {
return component.getCaption();
}
@Override
public void setCaption(String caption) {
component.setCaption(caption);
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
}

View File

@ -479,6 +479,26 @@ public class WebTabSheet extends WebAbstractComponent<CubaTabSheet> implements T
}
}
@Override
public String getCaption() {
return component.getCaption();
}
@Override
public void setCaption(String caption) {
component.setCaption(caption);
}
@Override
public String getDescription() {
return component.getDescription();
}
@Override
public void setDescription(String description) {
component.setDescription(description);
}
protected class LazyTabChangeListener implements com.vaadin.ui.TabSheet.SelectedTabChangeListener {
protected BoxLayout tabContent;
protected Element descriptor;

View File

@ -0,0 +1,22 @@
/*
* Copyright (c) 2008-2016 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.haulmont.cuba.web.toolkit.ui;
import com.vaadin.ui.Panel;
public class CubaScrollBoxPanel extends Panel {
}

View File

@ -21,6 +21,10 @@
background: transparent;
}
.#{$primary-stylename} > .v-panel-captionwrap {
display: none;
}
.#{$primary-stylename} > .v-panel-content {
border: 0;
}

View File

@ -0,0 +1,31 @@
/*!
* Copyright (c) 2008-2016 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@mixin havana-scrollbox($primary-stylename: c-scrollbox) {
.#{$primary-stylename} {
.#{$primary-stylename} > .v-panel-captionwrap {
display: none;
}
.#{$primary-stylename}-content {
border: 0;
}
.#{$primary-stylename}-deco {
display: none;
}
}
}

View File

@ -75,6 +75,7 @@
@import "components/richtextarea/richtextarea";
@import "components/draganddrop/draganddrop";
@import "components/fileuploadwrapper/fileuploadwrapper";
@import "components/scrollbox/scrollbox";
// Application specific
@import "app/app-window";
@ -135,6 +136,7 @@
@include havana-progressindicator;
@include havana-contextmenu-addon;
@include havana-draganddrop;
@include havana-scrollbox;
@include havana-cuba-groupbox;
@include havana-cuba-tokenlist;