Directory

← Back

Jcrop-Wrapper

Vaadin Wrapper for the jQuery image cropping plugin Jcrop

Author

Contributors

Rating

The Jcrop-Component allows to easily provide an image cropper within Vaadin. Mainly it's a JavaScriptComponent that wrapps the jQuery plugin Jcrop.

Features:

  • listener for selection changes
  • setting of min/max size of the crop area
  • forcing an aspect ratio on the crop area
  • selecting in the true size coordinate system of scaled images
  • fitting the image within the provided layout size of component
  • added support for ConnectorResource by a RequestHandler

Sample code

package org.vaadin.jcrop;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import org.vaadin.jcrop.selection.JcropSelection;
import org.vaadin.jcrop.selection.JcropSelectionChanged;


public class JCropSampleUI extends UI {
    private Jcrop jcrop;

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        jcrop = new Jcrop();
        jcrop.setWidth(750, Unit.PIXELS);
        jcrop.setHeight(500, Unit.PIXELS);
        jcrop.setImageUrl("url to your image");
        jcrop.addListener(new JcropSelectionChanged() {
            @Override
            public void selectionChanged(JcropSelection selection) {
                System.out.println(selection.toString());
            }
        });

        final VerticalLayout layout = new VerticalLayout();
        layout.addComponent(jcrop);
        setContent(layout);
    }
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

fixed maven problems

Released
2015-03-27
Maturity
STABLE
License
MIT License

Compatibility

Framework
Vaadin 7.0+
Vaadin 8.0+ in 1.2.0
Browser
Internet Explorer
Internet Explorer
Firefox
Opera
Safari
Google Chrome
Internet Explorer
Internet Explorer
Internet Explorer

Vaadin Add-on Directory

Find open-source widgets, add-ons, themes, and integrations for your Vaadin application. Vaadin Add-on Directory
Online