use of com.haulmont.cuba.web.AppUI in project cuba by cuba-platform.
the class WebFieldGroup method assignDebugId.
protected void assignDebugId(FieldConfig fc, com.vaadin.ui.Field composition) {
AppUI ui = AppUI.getCurrent();
if (ui != null) {
if (ui.isTestMode()) {
String debugId = getDebugId();
if (composition != null) {
if (debugId != null) {
TestIdManager testIdManager = ui.getTestIdManager();
composition.setId(testIdManager.getTestId(debugId + "_" + fc.getId()));
}
composition.setCubaId(fc.getId());
}
}
}
}
use of com.haulmont.cuba.web.AppUI in project cuba by cuba-platform.
the class WebLogoutButton method logout.
protected void logout() {
AppUI ui = ((AppUI) component.getUI());
if (ui == null) {
throw new IllegalStateException("Logout button is not attached to UI");
}
ui.getApp().logout();
}
use of com.haulmont.cuba.web.AppUI in project cuba by cuba-platform.
the class WebUserIndicator method refreshUserSubstitutions.
@Override
public void refreshUserSubstitutions() {
component.removeAllComponents();
UserSessionSource uss = AppBeans.get(UserSessionSource.NAME);
List<UserSubstitution> substitutions = getUserSubstitutions();
User user = uss.getUserSession().getUser();
AppUI ui = AppUI.getCurrent();
String substitutedUserCaption = getSubstitutedUserCaption(user);
if (substitutions.isEmpty()) {
userComboBox = null;
userNameLabel = new Label(substitutedUserCaption);
userNameLabel.setStyleName("c-user-select-label");
userNameLabel.setSizeUndefined();
if (ui.isTestMode()) {
userNameLabel.setCubaId("currentUserLabel");
}
component.addComponent(userNameLabel);
component.setDescription(substitutedUserCaption);
} else {
userNameLabel = null;
userComboBox = new CubaComboBox();
userComboBox.setFilteringMode(FilteringMode.CONTAINS);
userComboBox.setNullSelectionAllowed(false);
userComboBox.setImmediate(true);
if (ui.isTestMode()) {
userComboBox.setCubaId("substitutedUserSelect");
userComboBox.setId(ui.getTestIdManager().getTestId("substitutedUserSelect"));
}
userComboBox.setStyleName("c-user-select-combobox");
userComboBox.addItem(user);
userComboBox.setItemCaption(user, substitutedUserCaption);
for (UserSubstitution substitution : substitutions) {
User substitutedUser = substitution.getSubstitutedUser();
userComboBox.addItem(substitutedUser);
userComboBox.setItemCaption(substitutedUser, getSubstitutedUserCaption(substitutedUser));
}
UserSession session = uss.getUserSession();
userComboBox.select(session.getSubstitutedUser() == null ? session.getUser() : session.getSubstitutedUser());
userComboBox.addValueChangeListener(new SubstitutedUserChangeListener(userComboBox));
component.addComponent(userComboBox);
component.setDescription(null);
}
adjustWidth();
adjustHeight();
}
use of com.haulmont.cuba.web.AppUI in project cuba by cuba-platform.
the class CubaTable method paintAdditionalData.
@Override
protected void paintAdditionalData(PaintTarget target) throws PaintException {
if (reqFirstRowToPaint == -1) {
boolean hasAggregation = items instanceof AggregationContainer && isAggregatable() && !((AggregationContainer) items).getAggregationPropertyIds().isEmpty();
if (hasAggregation && isShowTotalAggregation() && Table.AggregationStyle.TOP.equals(getAggregationStyle())) {
Context context = new Context(getAggregationItemIds());
paintAggregationRow(target, ((AggregationContainer) items).aggregate(context));
}
}
// paint cuba-ids
AppUI current = AppUI.getCurrent();
if (current != null && current.isTestMode()) {
ArrayList<String> visibleColOrder = new ArrayList<>();
for (Object columnId : visibleColumns) {
if (!isColumnCollapsed(columnId)) {
visibleColOrder.add(columnId.toString());
}
}
target.addAttribute("colcubaids", visibleColOrder.toArray());
}
}
use of com.haulmont.cuba.web.AppUI in project cuba by cuba-platform.
the class CubaTable method changeVariables.
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
if (Page.getCurrent().getWebBrowser().isIE() && variables.containsKey("clickEvent")) {
focus();
}
super.changeVariables(source, variables);
if (shortcutActionManager != null) {
shortcutActionManager.handleActions(variables, this);
}
String profilerMarker = (String) variables.get("profilerMarker");
if (StringUtils.isNotEmpty(profilerMarker)) {
AppUI ui = AppUI.getCurrent();
ui.setProfilerMarker(profilerMarker);
}
}
Aggregations