use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopWindowManager method showFrame.
@Override
protected void showFrame(Component parent, Frame frame) {
// the same as web window manager does
if (parent instanceof Component.Container) {
Component.Container container = (Component.Container) parent;
for (Component c : container.getComponents()) {
if (c instanceof Component.Disposable) {
Component.Disposable disposable = (Component.Disposable) c;
if (!disposable.isDisposed()) {
disposable.dispose();
}
}
container.remove(c);
}
container.add(frame);
} else {
throw new IllegalStateException("Parent component must be com.haulmont.cuba.gui.components.Component.Container");
}
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopScrollBoxLayout method removeAll.
@Override
public void removeAll() {
content.removeAll();
List<Component> innerComponents = new ArrayList<>(components);
components.clear();
for (Component component : innerComponents) {
if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) component).setParentEnabled(true);
}
component.setParent(null);
}
adjustViewPreferredSize();
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopSplitPanel method removeAll.
@Override
public void removeAll() {
impl.removeAll();
componentByIds.clear();
List<Component> components = new ArrayList<>(ownComponents);
ownComponents.clear();
for (Component component : components) {
if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) component).setParentEnabled(true);
}
component.setParent(null);
}
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopSplitPanel method updateEnabled.
@Override
public void updateEnabled() {
super.updateEnabled();
boolean resultEnabled = isEnabledWithParent();
for (Component component : ownComponents) {
if (component instanceof DesktopAbstractComponent) {
((DesktopAbstractComponent) component).setParentEnabled(resultEnabled);
}
}
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopWindow method validateAll.
@Override
public boolean validateAll() {
ValidationErrors errors = new ValidationErrors();
Collection<Component> components = ComponentsHelper.getComponents(this);
for (Component component : components) {
if (component instanceof Validatable) {
Validatable validatable = (Validatable) component;
if (validatable.isValidateOnCommit()) {
try {
validatable.validate();
} catch (ValidationException e) {
if (log.isTraceEnabled())
log.trace("Validation failed", e);
else if (log.isDebugEnabled())
log.debug("Validation failed: " + e);
ComponentsHelper.fillErrorMessages(validatable, e, errors);
}
}
}
}
validateAdditionalRules(errors);
return handleValidationErrors(errors);
}
Aggregations