Search in sources :

Example 1 with ShockWaveComponent

use of com.gitblit.wicket.panels.ShockWaveComponent in project gitblit by gitblit.

the class TicketPage method createCopyFragment.

protected Fragment createCopyFragment(String wicketId, String text) {
    if (app().settings().getBoolean(Keys.web.allowFlashCopyToClipboard, true)) {
        // clippy: flash-based copy & paste
        Fragment copyFragment = new Fragment(wicketId, "clippyPanel", this);
        String baseUrl = WicketUtils.getGitblitURL(getRequest());
        ShockWaveComponent clippy = new ShockWaveComponent("clippy", baseUrl + "/clippy.swf");
        clippy.setValue("flashVars", "text=" + StringUtils.encodeURL(text));
        copyFragment.add(clippy);
        return copyFragment;
    } else {
        // javascript: manual copy & paste with modal browser prompt dialog
        Fragment copyFragment = new Fragment(wicketId, "jsPanel", this);
        ContextImage img = WicketUtils.newImage("copyIcon", "clippy.png");
        img.add(new JavascriptTextPrompt("onclick", "Copy to Clipboard (Ctrl+C, Enter)", text));
        copyFragment.add(img);
        return copyFragment;
    }
}
Also used : ShockWaveComponent(com.gitblit.wicket.panels.ShockWaveComponent) ContextImage(org.apache.wicket.markup.html.image.ContextImage) JavascriptTextPrompt(com.gitblit.wicket.panels.BasePanel.JavascriptTextPrompt) Fragment(org.apache.wicket.markup.html.panel.Fragment)

Aggregations

JavascriptTextPrompt (com.gitblit.wicket.panels.BasePanel.JavascriptTextPrompt)1 ShockWaveComponent (com.gitblit.wicket.panels.ShockWaveComponent)1 ContextImage (org.apache.wicket.markup.html.image.ContextImage)1 Fragment (org.apache.wicket.markup.html.panel.Fragment)1