com.vaadin.client.ApplicationConnection Java Examples

The following examples show how to use com.vaadin.client.ApplicationConnection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CalendarConnector.java    From calendar-component with Apache License 2.0 6 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    Iterator<Object> childIterator = uidl.getChildIterator();
    while (childIterator.hasNext()) {
        UIDL child = (UIDL) childIterator.next();
        if (DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG.equals(child.getTag())) {
            if (getWidget().getDropHandler() == null) {
                getWidget().setDropHandler(showingMonthView()
                        ? new CalendarMonthDropHandler(this)
                        : new CalendarWeekDropHandler(this));
            }
            getWidget().getDropHandler().updateAcceptRules(child);
        } else {
            getWidget().setDropHandler(null);
        }
    }
}
 
Example #2
Source File: CubaComboBoxConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    // We may have actions attached to this text field
    if (uidl.getChildCount() > 0) {
        final int cnt = uidl.getChildCount();
        for (int i = 0; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("actions")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
                }
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}
 
Example #3
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the visible row in the popup as a HTML string. The string
 * contains an image tag with the rows icon (if an icon has been
 * specified) and the caption of the item
 */

@Override
public String getDisplayString() {
	final StringBuilder sb = new StringBuilder();
	ApplicationConnection client = VComboBoxMultiselect.this.connector.getConnection();
	final Icon icon = client.getIcon(client.translateVaadinUri(this.untranslatedIconUri));
	if (icon != null) {
		sb.append(icon.getElement()
			.getString());
	}
	String content;
	if ("".equals(this.caption)) {
		// Ensure that empty options use the same height as other
		// options and are not collapsed (#7506)
		content = "&nbsp;";
	} else {
		content = WidgetUtil.escapeHTML(this.caption);
	}
	sb.append("<span>" + content + "</span>");
	return sb.toString();
}
 
Example #4
Source File: CubaGroupTableConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    if (uidl.hasVariable("groupColumns")) {
        getWidget().updateGroupColumns(uidl.getStringArrayVariableAsSet("groupColumns"));
    } else {
        getWidget().updateGroupColumns(null);
    }

    VScrollTable.VScrollTableBody.VScrollTableRow row = getWidget().focusedRow;

    super.updateFromUIDL(uidl, client);

    if (row instanceof CubaGroupTableWidget.CubaGroupTableBody.CubaGroupTableGroupRow) {
        getWidget().setRowFocus(
                getWidget().getRenderedGroupRowByKey(
                        ((CubaGroupTableWidget.CubaGroupTableBody.CubaGroupTableGroupRow) row).getGroupKey()
                )
        );
    }
}
 
Example #5
Source File: CubaMaskedFieldConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    // We may have actions attached to this text field
    if (uidl.getChildCount() > 0) {
        final int cnt = uidl.getChildCount();
        for (int i = 0; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("actions")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
                }
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}
 
Example #6
Source File: CubaTextFieldConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    // We may have actions attached to this text field
    if (uidl.getChildCount() > 0) {
        final int cnt = uidl.getChildCount();
        for (int i = 0; i < cnt; i++) {
            UIDL childUidl = uidl.getChildUIDL(i);
            if (childUidl.getTag().equals("actions")) {
                if (getWidget().getShortcutActionHandler() == null) {
                    getWidget().setShortcutActionHandler(new ShortcutActionHandler(uidl.getId(), client));
                }
                getWidget().getShortcutActionHandler().updateActionMap(childUidl);
            }
        }
    }
}
 
Example #7
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the visible row in the popup as a HTML string. The string
 * contains an image tag with the rows icon (if an icon has been
 * specified) and the caption of the item
 */

@Override
public String getDisplayString() {
	final StringBuilder sb = new StringBuilder();
	ApplicationConnection client = VComboBoxMultiselect.this.connector.getConnection();
	final Icon icon = client.getIcon(client.translateVaadinUri(this.untranslatedIconUri));
	if (icon != null) {
		sb.append(icon.getElement()
			.getString());
	}
	String content;
	if ("".equals(this.caption)) {
		// Ensure that empty options use the same height as other
		// options and are not collapsed (#7506)
		content = "&nbsp;";
	} else {
		content = WidgetUtil.escapeHTML(this.caption);
	}
	sb.append("<span>" + content + "</span>");
	return sb.toString();
}
 
Example #8
Source File: DDVerticalLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDVerticalLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDVerticalLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #9
Source File: DDHorizontalSplitPanelConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDHorizontalSplitPanelDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDHorizontalSplitPanelDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #10
Source File: CriterionTestHelper.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
static VDragEvent createMockedVDragEvent(String dragSourceId, Widget widget, String theme) {
    VDragEvent dragEvent = createMockedVDragEvent(dragSourceId, widget);
    ApplicationConnection connection = Mockito.mock(ApplicationConnection.class);
    when(dragEvent.getTransferable().getDragSource().getConnection()).thenReturn(connection);
    UIConnector uiConnector = Mockito.mock(UIConnector.class);
    when(connection.getUIConnector()).thenReturn(uiConnector);
    when(uiConnector.getActiveTheme()).thenReturn(theme);

    return dragEvent;
}
 
Example #11
Source File: DDCssLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDCssLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDCssLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #12
Source File: DDVerticalSplitPanelConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDVerticalSplitPanelDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDVerticalSplitPanelDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #13
Source File: DDHorizontalLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDHorizontalLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDHorizontalLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #14
Source File: DDVerticalLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDVerticalLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDVerticalLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #15
Source File: DDAccordionConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * TODO Remove this when drag &amp; drop is done properly in core
 */
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDAccordionDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDAccordionDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #16
Source File: DDFormLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDFormLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDFormLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #17
Source File: DDAbsoluteLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * TODO Remove this when drag &amp; drop is done properly in core
 */
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDAbsoluteLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDAbsoluteLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #18
Source File: ClientActionSerializer.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public ClientAction deserialize(Type type, JsonValue jsonValue, ApplicationConnection connection) {
    ClientAction clientAction = new ClientAction();
    JsonObject clientActionObject = (JsonObject) jsonValue;
    clientAction.setCaption(clientActionObject.get("caption").asString());
    clientAction.setActionId(clientActionObject.get("actionId").asString());
    return clientAction;
}
 
Example #19
Source File: DDPanelConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    super.updateFromUIDL(uidl, client);
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDPanelDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDPanelDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #20
Source File: DDGridLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDGridLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDGridLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #21
Source File: DDHorizontalLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDHorizontalLayoutDropHandler(this));
    if (html5Support != null) {
        html5Support.disable();
        html5Support = null;
    }
    VDDHorizontalLayoutDropHandler dropHandler = getWidget().getDropHandler();
    if (dropHandler != null) {
        html5Support = HTML5Support.enable(this, dropHandler);
    }
}
 
Example #22
Source File: CubaGroupBoxWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void setIconUri(String iconUri, ApplicationConnection client) {
    if (icon != null) {
        captionNode.removeChild(icon.getElement());
    }
    icon = client.getIcon(iconUri);
    if (icon != null) {
        DOM.insertChild(captionNode, icon.getElement(), 1);
    }
}
 
Example #23
Source File: Bootstrapper.java    From flow with Apache License 2.0 5 votes vote down vote up
private static void doStartApplication(final String applicationId) {
    Profiler.enter("Bootstrapper.startApplication");
    ApplicationConfiguration appConf = getConfigFromDOM(applicationId);
    ApplicationConnection applicationConnection = new ApplicationConnection(
            appConf);
    runningApplications.push(applicationConnection);
    Profiler.leave("Bootstrapper.startApplication");

    ValueMap initialUidl = getJsoConfiguration(applicationId).getUIDL();
    applicationConnection.start(initialUidl);
}
 
Example #24
Source File: CubaOrderedActionsLayoutConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    final int cnt = uidl.getChildCount();
    for (int i = 0; i < cnt; i++) {
        UIDL childUidl = uidl.getChildUIDL(i);
        if (childUidl.getTag().equals("actions")) {
            if (getWidget().getShortcutHandler() == null) {
                getWidget().setShortcutHandler(new ShortcutActionHandler(uidl.getId(), client));
            }
            getWidget().getShortcutHandler().updateActionMap(childUidl);
        }
    }
}
 
Example #25
Source File: CubaMainTabSheetConnector.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
    VDragDropUtil.updateDropHandlerFromUIDL(uidl, this, new VDDTabsheetDropHandler(this));
    if (getState().ddHtmlEnable) {
        enableDDHtml5();
    }
}
 
Example #26
Source File: WidgetComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Getter for property 'listPanel'.
 *
 * @return Value for property 'listPanel'.
 */
protected ListPopupPanel2 getListPanel() {
  if (listPanel == null) {
    listPanel = new ListPopupPanel2(this) {
      @Override
      protected ApplicationConnection getApplicationConnection() {
        return myConnection;
      }
    };
  }
  return listPanel;
}
 
Example #27
Source File: SockJSPushConnection.java    From vertx-vaadin with MIT License 5 votes vote down vote up
@Override
public void init(ApplicationConnection connection, UIState.PushConfigurationState pushConfiguration) {
    this.connection = connection;

    connection.addHandler(ApplicationConnection.ApplicationStoppedEvent.TYPE,
        event -> {
            if (state == State.CLOSING
                || state == State.CLOSED) {
                return;
            }

            disconnect(() -> {
            });
        });

    config = createConfig();
    String debugParameter = Window.Location.getParameter("debug");
    if ("push".equals(debugParameter)) {
        config.setStringValue("logLevel", "debug");
    }
    for (String param : pushConfiguration.parameters.keySet()) {
        String value = pushConfiguration.parameters.get(param);
        if (value.equalsIgnoreCase("true")
            || value.equalsIgnoreCase("false")) {
            config.setBooleanValue(param, value.equalsIgnoreCase("true"));
        } else {
            config.setStringValue(param, value);
        }
    }
    config.mapTransports();
    if (pushConfiguration.pushUrl != null) {
        url = pushConfiguration.pushUrl;
    } else {
        url = ApplicationConstants.APP_PROTOCOL_PREFIX
            + ApplicationConstants.PUSH_PATH;
    }
    runWhenSockJSLoaded(
        () -> Scheduler.get().scheduleDeferred(this::connect));

}
 
Example #28
Source File: WidgetComboBox.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ApplicationConnection getConnection() {
  return myConnection;
}
 
Example #29
Source File: MyVOverlay.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void setApplicationConnection(ApplicationConnection ac) {
    // this.ac = ac;
    ac_static = ac;
}
 
Example #30
Source File: MyVOverlay.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected ApplicationConnection getApplicationConnection() {
    return ac_static;
}