use of com.haulmont.cuba.desktop.App in project cuba by cuba-platform.
the class CustomDatePickerUI method createPopupButton.
@Override
protected JButton createPopupButton() {
JButton b = new JButton();
b.setName("popupButton");
b.setRolloverEnabled(false);
b.setMargin(new Insets(0, 3, 0, 3));
App app = App.getInstance();
if (app != null) {
b.setIcon(app.getResources().getIcon("/components/datefield/open-button.png"));
}
b.setFocusable(false);
b.setPreferredSize(new Dimension(22, DesktopComponentsHelper.BUTTON_HEIGHT));
return b;
}
use of com.haulmont.cuba.desktop.App in project cuba by cuba-platform.
the class CollapsiblePanel method loadIcons.
protected void loadIcons() {
App app = App.getInstance();
if (app != null) {
expandedIcon = app.getResources().getIcon("components/groupbox/item-expanded.png");
collapsedIcon = app.getResources().getIcon("components/groupbox/item-collapsed.png");
} else {
// fallback for unit tests
expandedIcon = readIcon("components/groupbox/item-expanded.png");
collapsedIcon = readIcon("components/groupbox/item-collapsed.png");
}
}
use of com.haulmont.cuba.desktop.App in project cuba by cuba-platform.
the class DesktopFieldGroup method applyFieldDefaults.
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 (cubaField instanceof HasInputPrompt && fci.getTargetInputPrompt() != null) {
((HasInputPrompt) cubaField).setInputPrompt(fci.getTargetInputPrompt());
}
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());
}
}
use of com.haulmont.cuba.desktop.App in project cuba by cuba-platform.
the class DesktopAbstractComponent method assignAutoDebugId.
public void assignAutoDebugId() {
App app = App.getInstance();
if (app != null && app.isTestMode()) {
C impl = getImpl();
// always change name, do not assign auto id for components
if (getId() == null && impl != null) {
String alternativeDebugId = getAlternativeDebugId();
impl.setName(alternativeDebugId);
}
}
}