use of com.haulmont.cuba.gui.components.Component.BelongToFrame in project cuba by cuba-platform.
the class DesktopTableCellEditor method getCellComponent.
protected Component getCellComponent(int row) {
Entity item = desktopAbstractTable.getTableModel().getItem(row);
StopWatch sw = new Slf4JStopWatch("TableColumnGenerator." + desktopAbstractTable.getId());
@SuppressWarnings("unchecked") com.haulmont.cuba.gui.components.Component component = columnGenerator.generateCell(item);
sw.stop();
Component comp;
if (component == null) {
comp = new JLabel("");
} else if (component instanceof Table.PlainTextCell) {
comp = new JLabel(((Table.PlainTextCell) component).getText());
} else {
if (component instanceof BelongToFrame) {
BelongToFrame belongToFrame = (BelongToFrame) component;
if (belongToFrame.getFrame() == null) {
belongToFrame.setFrame(desktopAbstractTable.getFrame());
}
}
component.setParent(desktopAbstractTable);
JComponent jComposition = DesktopComponentsHelper.getComposition(component);
jComposition.putClientProperty(CELL_EDITOR_TABLE, desktopAbstractTable.getComponent());
jComposition.putClientProperty(CELL_COMPONENT, component);
comp = jComposition;
}
cache.put(row, comp);
return comp;
}
use of com.haulmont.cuba.gui.components.Component.BelongToFrame in project cuba by cuba-platform.
the class WebWindowManager method initDebugIds.
@Override
public void initDebugIds(final Frame frame) {
if (ui.isTestMode()) {
ComponentsHelper.walkComponents(frame, (component, name) -> {
if (component.getDebugId() == null) {
Frame componentFrame = null;
if (component instanceof BelongToFrame) {
componentFrame = ((BelongToFrame) component).getFrame();
}
if (componentFrame == null) {
log.warn("Frame for component {} is not assigned", component.getClass());
} else {
if (component instanceof WebAbstractComponent) {
WebAbstractComponent webComponent = (WebAbstractComponent) component;
webComponent.assignAutoDebugId();
}
}
}
});
}
}
Aggregations