use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class DatePickerLoader method loadRangeStart.
protected void loadRangeStart(DatePicker resultComponent, Element element) {
String rangeStart = element.attributeValue("rangeStart");
if (StringUtils.isNotEmpty(rangeStart)) {
try {
Date date = parseDate(rangeStart);
resultComponent.setRangeStart(getDateTimeTransformations().transformToType(date, getJavaType(resultComponent), null));
} catch (ParseException e) {
throw new GuiDevelopmentException("'rangeStart' parsing error for date picker: " + rangeStart, context, "DatePicker ID", resultComponent.getId());
}
}
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class DatePickerLoader method loadRangeEnd.
protected void loadRangeEnd(DatePicker resultComponent, Element element) {
String rangeEnd = element.attributeValue("rangeEnd");
if (StringUtils.isNotEmpty(rangeEnd)) {
try {
Date date = parseDate(rangeEnd);
resultComponent.setRangeEnd(getDateTimeTransformations().transformToType(date, getJavaType(resultComponent), null));
} catch (ParseException e) {
throw new GuiDevelopmentException("'rangeEnd' parsing error for date picker: " + rangeEnd, context, "DatePicker ID", resultComponent.getId());
}
}
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class FileUploadFieldLoader method loadDropZone.
protected void loadDropZone(UploadField uploadField, Element element) {
String dropZoneId = element.attributeValue("dropZone");
if (StringUtils.isNotEmpty(dropZoneId)) {
Component dropZone = findComponent(dropZoneId);
if (dropZone instanceof BoxLayout) {
uploadField.setDropZone(new UploadField.DropZone((BoxLayout) dropZone));
} else if (dropZone != null) {
throw new GuiDevelopmentException("Unsupported dropZone class " + dropZone.getClass().getName(), context);
} else {
throw new GuiDevelopmentException("Unable to find dropZone component with id: " + dropZoneId, context);
}
}
String dropZonePrompt = element.attributeValue("dropZonePrompt");
if (StringUtils.isNotEmpty(dropZonePrompt)) {
uploadField.setDropZonePrompt(loadResourceString(dropZonePrompt));
}
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class GroupTableLoader method loadColumns.
@Override
protected List<Table.Column> loadColumns(Table component, Element columnsElement, MetaClass metaClass, FetchPlan fetchPlan) {
List<Table.Column> columns = super.loadColumns(component, columnsElement, metaClass, fetchPlan);
Element groupElement = columnsElement.element("group");
if (groupElement != null) {
final List<Object> groupProperties = new ArrayList<>(columns.size());
List<Element> columnElements = groupElement.elements("column");
for (Element columnElement : columnElements) {
String visible = columnElement.attributeValue("visible");
if (StringUtils.isEmpty(visible) || Boolean.parseBoolean(visible)) {
Object id = loadColumnId(columnElement, metaClass);
Table.Column column = component.getColumn(id.toString());
if (column == null) {
column = loadColumn(component, columnElement, metaClass);
}
if (column.isCollapsed()) {
String msg = String.format("Can't group by collapsed column: %s", column.getId());
throw new GuiDevelopmentException(msg, context);
}
if (column instanceof GroupTable.GroupColumn && ((GroupTable.GroupColumn<?>) column).isGroupAllowed()) {
groupProperties.add(column.getId());
}
}
}
getComponentContext().addPostInitTask((context1, window) -> {
// enable grouping columns from descriptor if columnReorderingAllowed = false
boolean reorderDisabled = !component.getColumnReorderingAllowed();
component.setColumnReorderingAllowed(true);
((GroupTable) component).groupBy(groupProperties.toArray());
if (reorderDisabled) {
component.setColumnReorderingAllowed(false);
}
});
}
return columns;
}
use of io.jmix.ui.GuiDevelopmentException in project jmix by jmix-framework.
the class JpqlFilterLoader method loadCondition.
protected void loadCondition(JpqlFilter<?> component, Element element) {
List<Element> conditions = element.elements("condition");
if (conditions.size() != 1) {
throw new GuiDevelopmentException("JPQL filter element must have exactly one 'condition' nested element", context);
}
Element jpqlElement = conditions.get(0).element("jpql");
if (jpqlElement == null) {
throw new GuiDevelopmentException("'condition' element must have exactly one 'jpql' nested element", context);
}
Element whereElement = jpqlElement.element("where");
if (whereElement == null) {
throw new GuiDevelopmentException("'jpql' element must have exactly one 'where' nested element", context);
}
Element joinElement = jpqlElement.element("join");
component.setCondition(whereElement.getText(), joinElement != null ? joinElement.getText() : null);
}
Aggregations