com.vaadin.shared.Connector Java Examples

The following examples show how to use com.vaadin.shared.Connector. 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: HawkbitUIErrorHandler.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void error(final ErrorEvent event) {

    // filter upload exceptions
    if (event.getThrowable() instanceof UploadException) {
        return;
    }

    final HawkbitErrorNotificationMessage message = buildNotification(getRootExceptionFrom(event));
    if (event instanceof ConnectorErrorEvent) {
        final Connector connector = ((ConnectorErrorEvent) event).getConnector();
        if (connector instanceof UI) {
            final UI uiInstance = (UI) connector;
            uiInstance.access(() -> message.show(uiInstance.getPage()));
            return;
        }
    }

    final Optional<Page> originError = getPageOriginError(event);
    if (originError.isPresent()) {
        message.show(originError.get());
        return;
    }

    HawkbitErrorNotificationMessage.show(message.getCaption(), message.getDescription(), Type.HUMANIZED_MESSAGE);
}
 
Example #2
Source File: VDDLayoutStateDragImageProvider.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public Element getDragImageElement(Widget w) {
    ComponentConnector component = Util.findConnectorFor(w);
    Connector dragImage = state.referenceImageComponents.get(component);

    if (dragImage != null) {
        return ConnectorMap.get(component.getConnection())
                .getElement(dragImage.getConnectorId());
    }

    return null;
}
 
Example #3
Source File: DDUtil.java    From cuba with Apache License 2.0 5 votes vote down vote up
private static void addNonGrabbedComponents(List<Connector> nonGrabbable, Component component,
                                            DragGrabFilter dragGrabFilter) {
    if (!dragGrabFilter.canBeGrabbed(component)) {
        nonGrabbable.add(component);
    } else if (component instanceof HasComponents
            && !(component instanceof LayoutDragSource)) {
        for (Component child : ((HasComponents) component)) {
            addNonGrabbedComponents(nonGrabbable, child, dragGrabFilter);
        }
    }
}
 
Example #4
Source File: SpringSecurityErrorHandler.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 5 votes vote down vote up
/**
 * Finds the nearest component by traversing upwards in the hierarchy. If
 * connector is a Component, that Component is returned. Otherwise, looks
 * upwards in the hierarchy until it finds a {@link Component}.
 * 
 * @return A Component or null if no component was found
 */
public static Component findComponent(Connector connector) {
    if (connector instanceof Component) {
        return (Component) connector;
    }
    if (connector.getParent() != null) {
        return findComponent(connector.getParent());
    }

    return null;
}
 
Example #5
Source File: Gantt.java    From gantt with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a unmodifiable List of steps.
 *
 * @return List of steps
 */
public List<Step> getSteps() {
    List<Step> steps = new ArrayList<Step>();
    for (Connector sc : getState(false).steps) {
        steps.add(((StepComponent) sc).getState(false).step);
    }
    return Collections.unmodifiableList(steps);
}
 
Example #6
Source File: Gantt.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public Iterator<Component> iterator() {
    List<Component> l = new ArrayList<Component>();
    for (Connector c : getState(false).steps) {
        l.add((Component) c);
    }
    return l.iterator();
}
 
Example #7
Source File: GanttConnector.java    From gantt with Apache License 2.0 5 votes vote down vote up
protected List<StepWidget> getSteps() {
    List<StepWidget> steps = new ArrayList<StepWidget>();
    for (Connector sc : getState().steps) {
        steps.add(((StepConnector) sc).getWidget());
    }
    return steps;
}
 
Example #8
Source File: GanttConnector.java    From gantt with Apache License 2.0 5 votes vote down vote up
protected Map<Step, StepWidget> getStepsMap() {
    Map<Step, StepWidget> steps = new HashMap<Step, StepWidget>();
    StepWidget stepWidget;
    for (Connector sc : getState().steps) {
        stepWidget = ((StepConnector) sc).getWidget();
        steps.put(((StepConnector) sc).getState().step, stepWidget);
    }
    return steps;
}
 
Example #9
Source File: StepComponent.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public Iterator<Component> iterator() {
    List<Component> l = new ArrayList<Component>();
    for (Connector c : getState(false).subSteps) {
        l.add((Component) c);
    }
    return l.iterator();
}
 
Example #10
Source File: GwtUIUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Contract("null -> null")
public static Widget connector2Widget(@Nullable Connector connector) {
  if (connector == null) {
    return null;
  }
  ComponentConnector componentConnector = (ComponentConnector)connector;
  return componentConnector.getWidget();
}
 
Example #11
Source File: WebThreeComponentSplitLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void reset(@Nullable Connector connector) {
  if (connector != null) {
    Component component = (Component)connector;

    component.setParent(null);
  }
}
 
Example #12
Source File: CubaPasswordField.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void setCapsLockIndicator(Connector capsLockIndicator) {
    getState().capsLockIndicator = capsLockIndicator;
}