use of com.haulmont.cuba.desktop.sys.layout.BoxLayoutAdapter in project cuba by cuba-platform.
the class DesktopGridLayout method updateComponent.
@Override
public void updateComponent(Component child) {
boolean componentReAdded = false;
if (DesktopContainerHelper.mayHaveExternalCaption(child) || DesktopContainerHelper.mayHaveExternalContextHelp(child)) {
if (captions.containsKey(child) && !DesktopContainerHelper.hasExternalCaption(child) && !DesktopContainerHelper.hasExternalContextHelp(child)) {
reAddChild(child);
componentReAdded = true;
} else if (!captions.containsKey(child) && (DesktopContainerHelper.hasExternalCaption(child) || DesktopContainerHelper.hasExternalContextHelp(child))) {
reAddChild(child);
componentReAdded = true;
} else if (captions.containsKey(child)) {
ComponentCaption caption = captions.get(child);
caption.update();
if (!wrappers.containsKey(child)) {
CC c = (CC) layoutAdapter.getConstraints(child);
layoutAdapter.updateConstraints(caption, layoutAdapter.getCaptionConstraints(child, c.getCellX(), c.getCellY(), c.getCellX(), c.getCellY()));
}
}
}
if (!componentReAdded) {
JComponent composition;
if (wrappers.containsKey(child)) {
composition = wrappers.get(child).getFirst();
CC constraints = MigLayoutHelper.getConstraints(child);
if (child.getHeight() == -1.0) {
MigLayoutHelper.applyHeight(constraints, -1, UNITS_PIXELS, false);
} else {
MigLayoutHelper.applyHeight(constraints, 100, UNITS_PERCENTAGE, false);
}
if (child.getWidth() == -1.0) {
MigLayoutHelper.applyWidth(constraints, -1, UNITS_PIXELS, false);
} else {
MigLayoutHelper.applyWidth(constraints, 100, UNITS_PERCENTAGE, false);
}
BoxLayoutAdapter adapter = wrappers.get(child).getSecond();
adapter.updateConstraints(DesktopComponentsHelper.getComposition(child), constraints);
} else {
composition = DesktopComponentsHelper.getComposition(child);
}
layoutAdapter.updateConstraints(composition, layoutAdapter.getConstraints(child));
}
requestRepaint();
requestContainerUpdate();
}
use of com.haulmont.cuba.desktop.sys.layout.BoxLayoutAdapter in project cuba by cuba-platform.
the class DesktopAbstractBox method updateComponentInternal.
protected void updateComponentInternal(Component child) {
boolean componentReAdded = false;
if (DesktopContainerHelper.mayHaveExternalCaption(child) || DesktopContainerHelper.mayHaveExternalContextHelp(child)) {
if (captions.containsKey(child) && !DesktopContainerHelper.hasExternalCaption(child) && !DesktopContainerHelper.hasExternalContextHelp(child)) {
reAddChild(child);
componentReAdded = true;
} else if (!captions.containsKey(child) && (DesktopContainerHelper.hasExternalCaption(child) || DesktopContainerHelper.hasExternalContextHelp(child))) {
reAddChild(child);
componentReAdded = true;
} else if (captions.containsKey(child)) {
ComponentCaption caption = captions.get(child);
caption.update();
BoxLayoutAdapter adapterForCaption = layoutAdapter;
if (wrappers.containsKey(child)) {
adapterForCaption = wrappers.get(child).getSecond();
}
adapterForCaption.updateConstraints(caption, adapterForCaption.getCaptionConstraints(child));
}
}
if (!componentReAdded) {
JComponent composition;
if (wrappers.containsKey(child)) {
composition = wrappers.get(child).getFirst();
CC constraints = MigLayoutHelper.getConstraints(child);
if (child.getHeight() == -1.0) {
MigLayoutHelper.applyHeight(constraints, -1, UNITS_PIXELS, false);
} else {
MigLayoutHelper.applyHeight(constraints, 100, UNITS_PERCENTAGE, false);
}
if (child.getWidth() == -1.0) {
MigLayoutHelper.applyWidth(constraints, -1, UNITS_PIXELS, false);
} else {
MigLayoutHelper.applyWidth(constraints, 100, UNITS_PERCENTAGE, false);
}
BoxLayoutAdapter adapter = wrappers.get(child).getSecond();
adapter.updateConstraints(DesktopComponentsHelper.getComposition(child), constraints);
} else {
composition = DesktopComponentsHelper.getComposition(child);
}
layoutAdapter.updateConstraints(composition, layoutAdapter.getConstraints(child));
}
}
Aggregations