use of com.haulmont.cuba.gui.GuiDevelopmentException in project cuba by cuba-platform.
the class SideMenuLoader method loadSidePanel.
protected void loadSidePanel(SideMenu component, Element element) {
String sidePanelId = element.attributeValue("sidePanel");
if (StringUtils.isNotEmpty(sidePanelId)) {
Component sidePanel = resultComponent.getFrame().getComponent(sidePanelId);
if (sidePanel == null) {
throw new GuiDevelopmentException("Unable to find sidePanel component for SideMenu", context.getFullFrameId(), "sidePanel", sidePanelId);
}
component.setSidePanel(sidePanel);
}
}
use of com.haulmont.cuba.gui.GuiDevelopmentException in project cuba by cuba-platform.
the class SideMenuLoader method loadSidePanelToggleButton.
protected void loadSidePanelToggleButton(SideMenu component, Element element) {
String toggleButtonId = element.attributeValue("sidePanelToggleButton");
if (StringUtils.isNotEmpty(toggleButtonId)) {
Component toggleButton = resultComponent.getFrame().getComponent(toggleButtonId);
if (!(toggleButton instanceof Button)) {
throw new GuiDevelopmentException("Unable to find sidePanelToggleButton for SideMenu", context.getFullFrameId(), "sidePanelToggleButton", toggleButtonId);
}
component.setSidePanelToggleButton((Button) toggleButton);
}
}
use of com.haulmont.cuba.gui.GuiDevelopmentException in project cuba by cuba-platform.
the class TokenListLoader method loadLookup.
protected void loadLookup(TokenList component, Element element) {
Element lookupElement = element.element("lookup");
if (lookupElement == null) {
throw new GuiDevelopmentException("'tokenList' must contain 'lookup' element", context.getFullFrameId(), "TokenList ID", element.attributeValue("id"));
}
String optionsDatasource = lookupElement.attributeValue("optionsDatasource");
if (!StringUtils.isEmpty(optionsDatasource)) {
CollectionDatasource ds = (CollectionDatasource) context.getDsContext().get(optionsDatasource);
component.setOptionsDatasource(ds);
}
String optionsCaptionProperty = lookupElement.attributeValue("captionProperty");
if (!StringUtils.isEmpty(optionsCaptionProperty)) {
component.setOptionsCaptionMode(CaptionMode.PROPERTY);
component.setOptionsCaptionProperty(optionsCaptionProperty);
}
String lookup = lookupElement.attributeValue("lookup");
if (StringUtils.isNotEmpty(lookup)) {
component.setLookup(Boolean.parseBoolean(lookup));
if (component.isLookup()) {
String lookupScreen = lookupElement.attributeValue("lookupScreen");
if (StringUtils.isNotEmpty(lookupScreen)) {
component.setLookupScreen(lookupScreen);
}
String openType = lookupElement.attributeValue("openType");
if (StringUtils.isNotEmpty(openType)) {
component.setLookupOpenMode(OpenType.valueOf(openType));
}
}
}
String multiSelect = lookupElement.attributeValue("multiselect");
if (StringUtils.isNotEmpty(multiSelect)) {
component.setMultiSelect(Boolean.parseBoolean(multiSelect));
}
String inputPrompt = lookupElement.attributeValue("inputPrompt");
if (StringUtils.isNotEmpty(inputPrompt)) {
component.setLookupInputPrompt(loadResourceString(inputPrompt));
}
loadFilterMode(component, lookupElement);
}
use of com.haulmont.cuba.gui.GuiDevelopmentException in project cuba by cuba-platform.
the class TokenListLoader method loadDatasource.
protected void loadDatasource(TokenList component, Element element) {
final String datasource = element.attributeValue("datasource");
if (!StringUtils.isEmpty(datasource)) {
CollectionDatasource ds = (CollectionDatasource) context.getDsContext().get(datasource);
if (ds == null) {
throw new GuiDevelopmentException(String.format("Datasource '%s' is not defined", datasource), context.getFullFrameId());
}
component.setDatasource(ds);
}
}
use of com.haulmont.cuba.gui.GuiDevelopmentException in project cuba by cuba-platform.
the class WindowLoader method addInitTimerMethodTask.
protected void addInitTimerMethodTask(Timer timer, String timerMethodName) {
context.addPostInitTask((windowContext, window) -> {
Method timerMethod;
try {
timerMethod = window.getClass().getMethod(timerMethodName, Timer.class);
} catch (NoSuchMethodException e) {
throw new GuiDevelopmentException("Unable to find invoke method for timer", windowContext.getFullFrameId(), ParamsMap.of("Timer Id", timer.getId(), "Method name", timerMethodName));
}
timer.addActionListener(t -> {
try {
timerMethod.invoke(window, t);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException("Unable to invoke onTimer", e);
}
});
});
}
Aggregations