本文整理汇总了Java中com.haulmont.cuba.gui.components.Component.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Component.setWidth方法的具体用法?Java Component.setWidth怎么用?Java Component.setWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.components.Component
的用法示例。
在下文中一共展示了Component.setWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expand
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void expand(Component component, String height, String width) {
if (expandedComponent != null
&& expandedComponent instanceof DesktopComponent) {
((DesktopComponent) expandedComponent).setExpanded(false);
}
if (layoutAdapter.getFlowDirection() == BoxLayoutAdapter.FlowDirection.Y) {
if (StringUtils.isEmpty(height) || AUTO_SIZE.equals(height) || height.endsWith("%")) {
component.setHeight("100%");
}
} else if (layoutAdapter.getFlowDirection() == BoxLayoutAdapter.FlowDirection.X) {
if (StringUtils.isEmpty(width) || AUTO_SIZE.equals(width) || width.endsWith("%")) {
component.setWidth("100%");
}
}
JComponent expandingChild = DesktopComponentsHelper.getComposition(component);
Pair<JPanel, BoxLayoutAdapter> wrapperInfo = wrappers.get(component);
if (wrapperInfo != null) {
expandingChild = wrapperInfo.getFirst();
}
layoutAdapter.expand(expandingChild, height, width);
if (component instanceof DesktopComponent) {
((DesktopComponent) component).setExpanded(true);
}
expandedComponent = component;
}
示例2: adjustTabSize
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
protected void adjustTabSize(Component tabComponent) {
if (getWidth() >= 0) {
tabComponent.setWidth("100%");
} else {
tabComponent.setWidth(Component.AUTO_SIZE);
}
if (getHeight() >= 0) {
tabComponent.setHeight("100%");
} else {
tabComponent.setHeight(Component.AUTO_SIZE);
}
}
示例3: loadComponent
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void loadComponent() {
assignFrame(resultComponent);
assignXmlDescriptor(resultComponent, element);
loadVisible(resultComponent, element);
loadStyleName(resultComponent, element);
loadAlign(resultComponent, element);
loadScrollBars(resultComponent, element);
loadSpacing(resultComponent, element);
loadMargin(resultComponent, element);
loadHeight(resultComponent, element);
loadWidth(resultComponent, element);
loadIcon(resultComponent, element);
loadCaption(resultComponent, element);
loadDescription(resultComponent, element);
loadSubComponents();
for (Component child : resultComponent.getOwnComponents()) {
if (resultComponent.getOrientation() == ScrollBoxLayout.Orientation.VERTICAL && ComponentsHelper.hasFullHeight(child)) {
child.setHeight("-1px");
log.warn("100% height of " + child.getClass().getSimpleName() + " id=" + child.getId()
+ " inside vertical scrollBox replaced with -1px height");
}
if (resultComponent.getOrientation() == ScrollBoxLayout.Orientation.HORIZONTAL && ComponentsHelper.hasFullWidth(child)) {
child.setWidth("-1px");
log.warn("100% width of " + child.getClass().getSimpleName() + " id=" + child.getId()
+ " inside horizontal scrollBox replaced with -1px width");
}
}
}
示例4: applyFieldDefaults
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
protected void applyFieldDefaults(FieldConfigImpl fci) {
Component fieldComponent = fci.getComponentNN();
if (fieldComponent instanceof Field) {
Field cubaField = (Field) fieldComponent;
if (fci.getTargetCaption() != null) {
cubaField.setCaption(fci.getTargetCaption());
}
if (fci.getTargetDescription() != null) {
cubaField.setDescription(fci.getTargetDescription());
}
if (fci.getTargetRequired() != null) {
cubaField.setRequired(fci.getTargetRequired());
}
if (fci.getTargetRequiredMessage() != null) {
cubaField.setRequiredMessage(fci.getTargetRequiredMessage());
}
if (fci.getTargetContextHelpText() != null) {
cubaField.setContextHelpText(fci.getTargetContextHelpText());
}
if (fci.getTargetContextHelpTextHtmlEnabled() != null) {
cubaField.setContextHelpTextHtmlEnabled(fci.getTargetContextHelpTextHtmlEnabled());
}
if (fci.getTargetContextHelpIconClickHandler() != null) {
cubaField.setContextHelpIconClickHandler(fci.getTargetContextHelpIconClickHandler());
}
if (fci.getTargetEditable() != null) {
cubaField.setEditable(fci.getTargetEditable());
}
if (fci.getTargetVisible() != null) {
cubaField.setVisible(fci.getTargetVisible());
}
if (cubaField instanceof Component.Focusable && fci.getTargetTabIndex() != null) {
((Component.Focusable) cubaField).setTabIndex(fci.getTargetTabIndex());
}
for (Field.Validator validator : fci.getTargetValidators()) {
cubaField.addValidator(validator);
}
if (fci.getTargetWidth() != null) {
fieldComponent.setWidth(fci.getTargetWidth());
} else {
fieldComponent.setWidth(DEFAULT_FIELD_WIDTH);
}
} else {
DesktopAbstractComponent composition = fci.getCompositionNN();
if (fci.getTargetCaption() != null) {
fci.getLabel().setText(fci.getTargetCaption());
}
if (fci.getTargetVisible() != null) {
composition.setVisible(fci.getTargetVisible());
}
if (fci.getTargetWidth() != null) {
composition.setWidth(fci.getTargetWidth());
} else {
composition.setWidth(DEFAULT_FIELD_WIDTH);
}
}
if (fieldComponent instanceof Component.HasFormatter && fci.getTargetFormatter() != null) {
((Component.HasFormatter) fieldComponent).setFormatter(fci.getTargetFormatter());
}
if (StringUtils.isNotEmpty(fci.getTargetStylename())) {
fieldComponent.setStyleName(fci.getTargetStylename());
}
App app = App.getInstance();
if (app != null && app.isTestMode()) {
fci.getCompositionNN().getComposition().setName(fci.getId());
}
}
示例5: initLazyTab
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
protected void initLazyTab(JComponent tab) {
LazyTabInfo lti = null;
for (LazyTabInfo lazyTabInfo : lazyTabs) {
if (lazyTabInfo.getTabComponent() == tab) {
lti = lazyTabInfo;
break;
}
}
if (lti == null) { // already initialized
return;
}
if (!lti.getTab().isEnabled()) {
return;
}
lazyTabs.remove(lti);
lti.loader.createComponent();
Component lazyContent = lti.loader.getResultComponent();
lazyContent.setWidth("100%");
lti.tabContent.add(lazyContent);
lti.tabContent.expand(lazyContent, "", "");
lazyContent.setParent(this);
lti.loader.loadComponent();
if (lazyContent instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) lazyContent).setParentEnabled(false);
}
final Window window = ComponentsHelper.getWindow(DesktopTabSheet.this);
if (window != null) {
ComponentsHelper.walkComponents(
lti.tabContent,
(component, name) -> {
if (component instanceof HasSettings) {
Settings settings = window.getSettings();
if (settings != null) {
Element e = settings.get(name);
((HasSettings) component).applySettings(e);
}
}
}
);
lti.getTab().setLazyInitialized(true);
}
}