mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
PL-7056 Implement unwrap method for component
This commit is contained in:
parent
b65767dba3
commit
0d3469e16c
@ -35,8 +35,6 @@ import org.slf4j.LoggerFactory;
|
||||
import javax.swing.*;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class DesktopAbstractComponent<C extends JComponent>
|
||||
implements
|
||||
DesktopComponent, Component.Wrapper, Component.HasXmlDescriptor, Component.BelongToFrame {
|
||||
@ -392,4 +390,14 @@ public abstract class DesktopAbstractComponent<C extends JComponent>
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return (X) getComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return (X) getComposition();
|
||||
}
|
||||
}
|
@ -365,6 +365,16 @@ public class DesktopPopupButton extends DesktopAbstractActionsHolderComponent<JB
|
||||
public void setStyleName(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCaption() {
|
||||
return action.getCaption();
|
||||
|
@ -1082,6 +1082,16 @@ public class DesktopWindow implements Window, Component.Disposable,
|
||||
public void setStyleName(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return (X) getComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return (X) getComposition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMargin(boolean enable) {
|
||||
layoutAdapter.setMargin(enable);
|
||||
|
@ -525,6 +525,16 @@ public class AbstractFrame implements Frame, Frame.Wrapper, Component.Wrapper, C
|
||||
this.styleName = styleName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return (X) getComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return (X) getComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpacing(boolean enabled) {
|
||||
frame.setSpacing(enabled);
|
||||
|
@ -111,6 +111,9 @@ public interface Component {
|
||||
/** Set style name. Styles implementation is client-type-specific */
|
||||
void setStyleName(String styleName);
|
||||
|
||||
<X> X unwrap(Class<X> internalComponentClass);
|
||||
<X> X unwrapComposition(Class<X> internalCompositionClass);
|
||||
|
||||
/**
|
||||
* Component which can contain other components
|
||||
*/
|
||||
|
@ -753,5 +753,15 @@ public interface Table<E extends Entity>
|
||||
public void setStyleName(String styleName) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -35,8 +35,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ParamWrapper implements Component.HasValue {
|
||||
|
||||
public static final Pattern LIKE_PATTERN = Pattern.compile("\\slike\\s+" + ParametersHelper.QUERY_PARAMETERS_RE);
|
||||
@ -261,6 +259,16 @@ public class ParamWrapper implements Component.HasValue {
|
||||
public void setStyleName(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Frame getFrame() {
|
||||
return null;
|
||||
|
@ -205,6 +205,16 @@ public class WebWindow implements Window, Component.Wrapper,
|
||||
getContainer().addStyleName("cuba-window-layout");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return (X) getComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return (X) getComposition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpacing(boolean enabled) {
|
||||
if (getContainer() instanceof Layout.SpacingHandler) {
|
||||
|
@ -278,4 +278,14 @@ public abstract class WebAbstractComponent<T extends com.vaadin.ui.Component>
|
||||
public void setXmlDescriptor(Element element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrap(Class<X> internalComponentClass) {
|
||||
return (X) getComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> X unwrapComposition(Class<X> internalCompositionClass) {
|
||||
return (X) getComposition();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user