Example usage for com.google.gwt.event.logical.shared InitializeHandler InitializeHandler

List of usage examples for com.google.gwt.event.logical.shared InitializeHandler InitializeHandler

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared InitializeHandler InitializeHandler.

Prototype

InitializeHandler

Source Link

Usage

From source file:cc.alcina.framework.gwt.client.gwittir.widget.RichTextArea.java

License:Apache License

@SuppressWarnings("unchecked")
public RichTextArea(boolean withToolbar, String defaultFontSize) {
    this.defaultFontSize = defaultFontSize;
    old = base.getHTML();//w  w  w. j  a  v a  2s . co  m
    this.setComparator(SimpleComparator.INSTANCE);
    this.base.addBlurHandler(new BlurHandler() {
        public void onBlur(BlurEvent event) {
            EventTarget eventTarget = event.getNativeEvent().getEventTarget();
            if (Node.is(eventTarget)) {
                Node elt = Node.as(eventTarget);
                if (DomUtils.isAncestorOf(toolbar.getElement(), elt)) {
                    return;
                }
            }
            changes.firePropertyChange("value", old, getValue());
        }
    });
    this.base.addKeyUpHandler(new KeyUpHandler() {
        public void onKeyUp(KeyUpEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == 'M' && event.isControlKeyDown()) {
                if (maximised) {
                    RichTextArea.this.removeStyleName("max");
                    WidgetUtils.restoreFromMaximise();
                } else {
                    WidgetUtils.maximiseWidget(RichTextArea.this);
                    RichTextArea.this.addStyleName("max");
                }
                maximised = !maximised;
            }
        }
    });
    this.base.addInitializeHandler(new InitializeHandler() {
        @Override
        public void onInitialize(InitializeEvent event) {
            styleBody(base.getElement(), "12px");
        }
    });
    FlowPanel fp = new FlowPanel();
    if (withToolbar) {
        FlowPanel tbHolder = new FlowPanel();
        tbHolder.setStyleName("alcina-richTextToolbarBkg");
        tbHolder.add(toolbar);
        fp.add(tbHolder);
    }
    fp.add(base);
    super.initWidget(fp);
}

From source file:com.dianaui.universal.core.client.ui.RichTextToolbar.java

License:Apache License

/**
 * Creates a new toolbar that drives the given rich text area.
 *
 * @param richText the rich text area to be controlled
 *//*  w  w w. j a  v a  2 s .c  om*/
public RichTextToolbar(final RichTextArea richText) {
    initWidget(binder.createAndBindUi(this));

    richText.addInitializeHandler(new InitializeHandler() {
        @Override
        public void onInitialize(InitializeEvent event) {
            IFrameElement iframe = IFrameElement.as(richText.getElement());

            iframe.getContentDocument().getBody().getStyle().setMargin(0, Style.Unit.PX);
            iframe.getContentDocument().getBody().getStyle().setPadding(0, Style.Unit.PX);
        }
    });

    this.richText = richText;

    richText.setHTML("<div></div>");

    EventHandler handler = new EventHandler();

    boldButton.addClickHandler(handler);
    italicButton.addClickHandler(handler);
    underlineButton.addClickHandler(handler);
    subscriptButton.addClickHandler(handler);
    superscriptButton.addClickHandler(handler);
    justifyLeftButton.addClickHandler(handler);
    justifyCenterButton.addClickHandler(handler);
    justifyRightButton.addClickHandler(handler);
    strikethroughButton.addClickHandler(handler);
    indentButton.addClickHandler(handler);
    outdentButton.addClickHandler(handler);
    hrButton.addClickHandler(handler);
    olButton.addClickHandler(handler);
    ulButton.addClickHandler(handler);
    imageButton.addClickHandler(handler);
    linkButton.addClickHandler(handler);
    unlinkButton.addClickHandler(handler);
    removeFormatButton.addClickHandler(handler);
    undoButton.addClickHandler(handler);
    redoButton.addClickHandler(handler);

    // We only use these handlers for updating status, so don't hook them up
    // unless at least basic editing is supported.
    richText.addKeyUpHandler(handler);
    richText.addClickHandler(handler);
}

From source file:com.google.code.p.gwtchismes.client.editor.GWTCEditor.java

License:Apache License

public GWTCEditor(ToolbarConstants constants) {
    area.ensureDebugId("GWTCEditor");
    area.setSize("100%", "234px");

    Toolbar toolbar = new Toolbar(area, constants);
    toolbar.ensureDebugId("GWTCToolbar");

    super.setStyleName("GWTCEditor");
    super.add(toolbar);
    super.add(area);
    super.setWidth("100%");

    // Note: rich-area is created in an iframe, so Hupa's style sheets 
    // are not available, unless we inject them to the generated iframe
    ////from w  w w . j a  va 2  s  .co m
    // When body is available, we put the default style for messages:
    area.addInitializeHandler(new InitializeHandler() {
        public void onInitialize(InitializeEvent event) {
            setBodyStyleAttribute("fontFamily", "arial");
            setBodyStyleAttribute("fontSize", "80%");
        }
    });

}

From source file:cz.filmtit.client.subgestbox.PosteditBox.java

License:Open Source License

public PosteditBox(TimedChunk chunk, TranslationWorkspace workspace, int tabIndex) {
    this.chunk = chunk;
    this.workspace = workspace;
    if (this.workspace == null) {
        Gui.log("workspace for subgestbox is null!!!");
    }//from   w ww .  j  a v  a 2  s.  c  o m

    this.subgestBox = null;

    this.setHeight("36px");
    this.setHTML(posteditBoxHTML(""));

    this.addFocusHandler(this.workspace.posteditHandler);
    this.addKeyDownHandler(this.workspace.posteditHandler);
    this.addKeyUpHandler(this.workspace.posteditHandler);
    this.setTabIndex(tabIndex);

    this.addStyleName("posteditwidth");

    final RichTextArea richtext = this;
    richtext.addInitializeHandler(new InitializeHandler() {
        public void onInitialize(InitializeEvent ie) {
            IFrameElement fe = (IFrameElement) richtext.getElement().cast();
            Style s = fe.getContentDocument().getBody().getStyle();
            s.setProperty("fontFamily", "Arial Unicode MS,Arial,sans-serif");
            s.setProperty("fontSize", "small");
            s.setColor("#333");
        }
    });
}

From source file:cz.filmtit.client.subgestbox.SubgestBox.java

License:Open Source License

/**
 * Primary constructor for the SubgestBox.
 *
 * @param chunk - the source chunk of the underlying TranslationResult
 * @param workspace - the TranslationWorkspace in which this SubgestBox
 * operates//  ww w  . j  av a 2 s  . com
 * @param tabIndex - intended tabIndex within the workspace
 */
public SubgestBox(TimedChunk chunk, TranslationWorkspace workspace, int tabIndex) {
    this.chunk = chunk;
    this.translationResult = new TranslationResult(chunk);
    this.workspace = workspace;
    if (this.workspace == null) {
        Gui.log("workspace for subgestbox is null!!!");
    }

    this.posteditBox = null;

    this.setHeight("36px");
    this.setHTML(subgestBoxHTML(""));

    this.addFocusHandler(this.workspace.subgestHandler);
    this.addKeyDownHandler(this.workspace.subgestHandler);
    this.addKeyUpHandler(this.workspace.subgestHandler);
    this.setTabIndex(tabIndex);

    if (workspace.isPosteditOn()) {
        this.addStyleName("posteditwidth");
    } else {
        this.addStyleName("subgest_fullwidth");
    }

    final RichTextArea richtext = this;
    richtext.addInitializeHandler(new InitializeHandler() {
        public void onInitialize(InitializeEvent ie) {
            IFrameElement fe = (IFrameElement) richtext.getElement().cast();
            Style s = fe.getContentDocument().getBody().getStyle();
            s.setProperty("fontFamily", "Arial Unicode MS,Arial,sans-serif");
            s.setProperty("fontSize", "small");
            s.setColor("#333");
        }
    });

}

From source file:org.apache.hupa.widgets.editor.Editor.java

License:Apache License

public Editor(ToolbarConstants constants) {
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef69ca86e_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef69ca86e0x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef69ca86e0x1");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff60x20x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff60x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff6_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff60x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff60x20x00x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff60x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ee6f35ff60x20x0");

    //      Block insertion:
    ////from   w  w  w . j a v a2 s  . c  o  m
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x60x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x60x1");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f4_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x2");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef0a2ebb70x10x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef0a2ebb70x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef0a2ebb70x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef0a2ebb70x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2ef0a2ebb7");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e702d758c0x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e702d758c_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e702d758c0x0");
    InstrumentationLoggerProvider.get().instrument("org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2e");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x00x0");
    area.ensureDebugId("hupa-editor-area");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x10x0");
    area.setHeight("100%");

    //        Toolbar toolbar = new Toolbar(area, constants);
    //        toolbar.ensureDebugId("hupa-editor-toolbar");

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x20x0");
    //        super.add(toolbar);
    super.add(area);
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x3_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x30x0");
    setWidth("100%");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x40x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x4");
    setHeight("100%");

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x5_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1");
    /*
       * Note: rich-area is created in an iframe, so Hupa's style sheets are
       * not available, unless we inject them to the generated iframe
       *
       * When body is available, we put the default style for messages:
       */
    area.addInitializeHandler(new InitializeHandler() {
        public void onInitialize(InitializeEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x1_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x20x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x2_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x3");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x30x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x30x00x0");
            setBodyStyleAttribute("fontFamily", "arial");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x30x10x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x50x00x00x1d74fdfd10x30x1");
            setBodyStyleAttribute("fontSize", "12px");
        }
    });

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x6_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x60x00x0_____org_apache_hupa_widgets_editor_Editor_java0x0c7e9fb2eb99c08f40x20x60x0");
    /*
       * When the users writes in-line comments in replies, the text has to be
       * leftIdented. Right now, I've implemented this feature only in gecko
       * browsers, for other browsers the user has to push the leftIdent
       * button.
       */
    if (getUA().equals("ff"))
        addNewlineHandlersForFireFox();

}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.share.email.CollectionEmailShareView.java

License:Open Source License

public CollectionEmailShareView(String mailSubject, String mailDescription) {
    setWidget(uiBinder.createAndBindUi(this));

    PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected();
    this.getElement().getStyle().setZIndex(999999);
    this.setGlassEnabled(true);
    fromValidation.setText(i18n.GL0215());
    fromValidation.getElement().setId("lblFromValidation");
    fromValidation.getElement().setAttribute("alt", i18n.GL0215());
    fromValidation.getElement().setAttribute("title", i18n.GL0215());

    toValidation.setText(i18n.GL0216());
    toValidation.getElement().setId("lblToValidation");
    toValidation.getElement().setAttribute("alt", i18n.GL0216());
    toValidation.getElement().setAttribute("title", i18n.GL0216());

    lblEmailFriend.setText(i18n.GL0222());
    lblEmailFriend.getElement().setId("lblEmailFriend");
    lblEmailFriend.getElement().setAttribute("alt", i18n.GL0222());
    lblEmailFriend.getElement().setAttribute("title", i18n.GL0222());

    lblFrom.setText(i18n.GL0223() + i18n.GL_SPL_SEMICOLON() + " ");
    lblFrom.getElement().setId("lblFrom");
    lblFrom.getElement().setAttribute("alt", i18n.GL0223());
    lblFrom.getElement().setAttribute("title", i18n.GL0223());

    lblTo.setText(i18n.GL0224() + i18n.GL_SPL_SEMICOLON() + " ");
    lblTo.getElement().setId("lblTo");
    lblTo.getElement().setAttribute("alt", i18n.GL0224());
    lblTo.getElement().setAttribute("title", i18n.GL0224());

    lblSendMeCopy.setText(i18n.GL0225());
    lblSendMeCopy.getElement().setId("lblSendMeCopy");
    lblSendMeCopy.getElement().setAttribute("alt", i18n.GL0225());
    lblSendMeCopy.getElement().setAttribute("title", i18n.GL0225());

    lblSubject.setText(i18n.GL0226() + i18n.GL_SPL_SEMICOLON() + " ");
    lblSubject.getElement().setId("lblSubject");
    lblSubject.getElement().setAttribute("alt", i18n.GL0226());
    lblSubject.getElement().setAttribute("title", i18n.GL0226());

    lblMessage.setText(i18n.GL0227() + i18n.GL_SPL_SEMICOLON() + " ");
    lblMessage.getElement().setId("lblMessage");
    lblMessage.getElement().setAttribute("alt", i18n.GL0227());
    lblMessage.getElement().setAttribute("title", i18n.GL0227());

    btnSend.setText(i18n.GL0228());//  w ww . j ava  2s .c  o m
    btnSend.getElement().setId("btnSend");
    btnSend.getElement().setAttribute("alt", i18n.GL0228());
    btnSend.getElement().setAttribute("title", i18n.GL0228());

    cancelLbl.setText(i18n.GL0142());
    cancelLbl.getElement().setId("btnCancelLbl");
    cancelLbl.getElement().setAttribute("alt", i18n.GL0142());
    cancelLbl.getElement().setAttribute("title", i18n.GL0142());

    noteTxt.setText(i18n.GL1636());
    noteTxt.getElement().setId("lblNoteTxt");
    noteTxt.getElement().setAttribute("alt", i18n.GL1636());
    noteTxt.getElement().setAttribute("title", i18n.GL1636());

    lblPii.setText(i18n.GL1892());
    lblPii.getElement().setId("spnLblPii");
    lblPii.getElement().setAttribute("alt", i18n.GL1892());
    lblPii.getElement().setAttribute("title", i18n.GL1892());

    ancprivacy.setText(i18n.GL1893());
    ancprivacy.getElement().setId("lnkAncprivacy");
    ancprivacy.getElement().setAttribute("alt", i18n.GL1893());
    ancprivacy.getElement().setAttribute("title", i18n.GL1893());

    toUsText.setText(i18n.GL1894());
    toUsText.getElement().setId("spnToUsText");
    toUsText.getElement().setAttribute("alt", i18n.GL1894());
    toUsText.getElement().setAttribute("title", i18n.GL1894());

    //   lblPii.getElement().getStyle().setMarginLeft(99, Unit.PX);
    /*ancprivacy.getElement().getStyle().setMarginLeft(101, Unit.PX);*/

    mandatoryErrorLbl.setVisible(false);
    mandatoryErrorRichTextArea.setVisible(false);
    fromLbl.setVisible(false);
    fromValidation.setVisible(false);
    toValidation.setVisible(false);
    toTxt.getElement().setId("tbTo");
    subTxt.getElement().setId("tbSubject");
    StringUtil.setAttributes(subTxt, true);
    subTxt.setText(StringUtil.generateMessage(i18n.GL1997(), i18n.GL2000()));
    subTxt.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL1997(), i18n.GL2000()));
    subTxt.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL1997(), i18n.GL2000()));
    fromTxt.getElement().setId("tbFrom");
    msgTxa.getElement().setId("taMessage");
    StringUtil.setAttributes(msgTxa, true);
    fromLbl.getElement().setId("lblFromLbl");
    checkCopyEmail.getElement().setId("chkCheckCopyEmail");
    mandatoryErrorLbl.getElement().setId("errlblMandatoryErrorLbl");
    mandatoryErrorRichTextArea.getElement().setId("errlblMandatoryErrorRichTextArea");

    fromTxt.setMaxLength(50);
    if (AppClientFactory.isAnonymous()) {
        fromTxt.setVisible(true);
        fromTxt.setPlaceholder(i18n.GL1442_1());
    } else {
        if (AppClientFactory.getLoggedInUser().getFirstName() != null
                && AppClientFactory.getLoggedInUser().getLastName() != null) {
            fromTxt.setVisible(true);
            fromTxt.setText(AppClientFactory.getLoggedInUser().getFirstName() + " "
                    + AppClientFactory.getLoggedInUser().getLastName());
            fromTxt.getElement().setAttribute("alt", AppClientFactory.getLoggedInUser().getFirstName() + " "
                    + AppClientFactory.getLoggedInUser().getLastName());
            fromTxt.getElement().setAttribute("title", AppClientFactory.getLoggedInUser().getFirstName() + " "
                    + AppClientFactory.getLoggedInUser().getLastName());
        } else {
            fromTxt.setVisible(true);
            fromTxt.setPlaceholder(i18n.GL1442_1());
        }
    }
    toTxt.setPlaceholder(i18n.GL1184_1());
    msgTxa.setHTML(mailDescription);
    msgTxa.getElement().setAttribute("alt", i18n.GL1184_1());
    msgTxa.getElement().setAttribute("title", i18n.GL1184_1());

    isvalid = true;
    this.setGlassEnabled(true);
    this.center();
    this.getGlassElement().getStyle().setZIndex(99999);

    msgTxa.addInitializeHandler(new InitializeHandler() {
        @Override
        public void onInitialize(InitializeEvent event) {
            Document document = IFrameElement.as(msgTxa.getElement()).getContentDocument();
            BodyElement body = document.getBody();
            body.setAttribute("style", "font-family: Arial;font-size:12px;");
        }
    });
    fromTxt.addBlurHandler(new CheckProfanityInOnBlur(fromTxt, null, fromValidation));
    subTxt.addBlurHandler(new CheckProfanityInOnBlur(subTxt, null, mandatoryErrorLbl));
    msgTxa.addBlurHandler(new CheckProfanityInOnBlur(null, msgTxa, mandatoryErrorRichTextArea));
    ScrollPopupShareUtil.ScrollPopupUtilWidget(mainShareContainer);
}

From source file:org.ednovo.gooru.client.mvp.play.collection.share.email.CollectionEmailShareView.java

License:Open Source License

public CollectionEmailShareView(String mailSubject, String mailDescription) {
    setWidget(uiBinder.createAndBindUi(this));

    PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected();
    this.getElement().getStyle().setZIndex(999999);
    this.setGlassEnabled(true);
    fromValidation.setText(GL0215);/*from  w  ww .  j  a  v  a2s.c  o  m*/
    toValidation.setText(GL0216);
    lblEmailFriend.setText(GL0222);
    lblFrom.setText(GL0223 + GL_SPL_SEMICOLON);
    lblTo.setText(GL0224 + GL_SPL_SEMICOLON);
    lblSendMeCopy.setText(GL0225);
    lblSubject.setText(GL0226 + GL_SPL_SEMICOLON);
    lblMessage.setText(GL0227 + GL_SPL_SEMICOLON);
    btnSend.setText(GL0228);
    cancelLbl.setText(GL0142);

    noteTxt.setText(GL1636);

    mandatoryErrorLbl.setVisible(false);
    mandatoryErrorRichTextArea.setVisible(false);
    fromLbl.setVisible(false);
    fromValidation.setVisible(false);
    toValidation.setVisible(false);
    toTxt.getElement().setId("tbTo");
    subTxt.getElement().setId("tbSubject");
    subTxt.setText(mailSubject);
    fromTxt.getElement().setId("tbFrom");
    msgTxa.getElement().setId("taMessage");
    btnSend.getElement().setId("btnSend");
    fromTxt.setMaxLength(50);
    if (AppClientFactory.isAnonymous()) {
        //         fromLbl.setVisible(false);
        fromTxt.setVisible(true);
        //         fromTxt.getElement().setAttribute("placeholder",GL1442);
        fromTxt.setPlaceholder(GL1442_1);
    } else {
        //         fromTxt.setText(AppClientFactory.getLoggedInUser().getEmailId());
        if (AppClientFactory.getLoggedInUser().getFirstName() != null
                && AppClientFactory.getLoggedInUser().getLastName() != null) {
            //            fromLbl.setVisible(true);
            fromTxt.setVisible(true);
            fromTxt.setText(AppClientFactory.getLoggedInUser().getFirstName() + " "
                    + AppClientFactory.getLoggedInUser().getLastName());
        } else {
            //            fromLbl.setVisible(false);
            fromTxt.setVisible(true);
            fromTxt.setPlaceholder(GL1442_1);
        }
    }
    //      toTxt.getElement().setAttribute("placeholder",GL1184_1);
    toTxt.setPlaceholder(GL1184_1);
    msgTxa.setHTML(mailDescription);
    isvalid = true;
    this.setGlassEnabled(true);
    this.center();
    this.getGlassElement().getStyle().setZIndex(99999);

    //this.setGlassStyleName(PlayerBundle.INSTANCE.getPlayerStyle().setGlassPanelStyle());
    msgTxa.addInitializeHandler(new InitializeHandler() {
        @Override
        public void onInitialize(InitializeEvent event) {
            Document document = IFrameElement.as(msgTxa.getElement()).getContentDocument();
            BodyElement body = document.getBody();
            body.setAttribute("style", "font-family: Arial;font-size:12px;");
        }
    });
    fromTxt.addBlurHandler(new CheckProfanityInOnBlur(fromTxt, null, fromValidation));
    subTxt.addBlurHandler(new CheckProfanityInOnBlur(subTxt, null, mandatoryErrorLbl));
    msgTxa.addBlurHandler(new CheckProfanityInOnBlur(null, msgTxa, mandatoryErrorRichTextArea));
}

From source file:org.ednovo.gooru.client.mvp.play.collection.share.email.SummaryPageEmailShareUc.java

License:Open Source License

public SummaryPageEmailShareUc(String fromEmailAddress, String pdfUrl) {
    setWidget(uiBinder.createAndBindUi(this));
    this.getElement().getStyle().setZIndex(999999);
    String[] fileName = pdfUrl.split("/");
    cpAttachmentContainer.setText(fileName[fileName.length - 1]);
    this.pdfUrl = pdfUrl;
    fromValidation.setText(GL0215);/*from  w ww.j ava2  s  .c  o m*/
    toValidation.setText(GL0216);
    lblEmailFriend.setText(GL1449);
    lblFrom.setText(GL0223 + GL_SPL_SEMICOLON);
    lblTo.setText(GL0224 + GL_SPL_SEMICOLON);
    lblSendMeCopy.setText(GL0225);
    lblSubject.setText(GL0226 + GL_SPL_SEMICOLON);
    lblMessage.setText(GL0227 + GL_SPL_SEMICOLON);
    btnSend.setText(GL0228);
    cancelLbl.setText(GL0142);

    mandatoryErrorLbl.setVisible(false);
    mandatoryErrorRichTextArea.setVisible(false);

    fromValidation.setVisible(false);
    toValidation.setVisible(false);
    toTxt.getElement().setId("tbTo");
    subTxt.getElement().setId("tbSubject");
    subTxt.setText(GL1443);
    fromTxt.getElement().setId("tbFrom");
    msgTxa.getElement().setId("taMessage");
    btnSend.getElement().setId("btnSend");
    if (fromEmailAddress == null || fromEmailAddress.isEmpty()) {
        fromLbl.setVisible(false);
        fromTxt.setVisible(true);
        fromTxt.getElement().setAttribute("placeholder", GL1442);
    } else {
        fromLbl.setText(fromEmailAddress);
        fromLbl.setVisible(true);
        fromTxt.setVisible(false);
    }
    toTxt.getElement().setAttribute("placeholder", GL0217);
    msgTxa.setHTML(GL1444);
    isCheckedValue = false;
    isvalid = true;
    this.setGlassStyleName(PlayerBundle.INSTANCE.getPlayerStyle().setGlassPanelStyle());
    this.setGlassEnabled(true);
    this.center();

    msgTxa.addInitializeHandler(new InitializeHandler() {
        @Override
        public void onInitialize(InitializeEvent event) {
            Document document = IFrameElement.as(msgTxa.getElement()).getContentDocument();
            BodyElement body = document.getBody();
            body.setAttribute("style", "font-family: Arial;font-size:12px;");
        }
    });
    subTxt.addBlurHandler(new CheckProfanityInOnBlur(subTxt, null, mandatoryErrorLbl));
    msgTxa.addBlurHandler(new CheckProfanityInOnBlur(null, msgTxa, mandatoryErrorRichTextArea));
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.item.ShelfCollectionResourceChildView.java

License:Open Source License

/**
 * Class constructor// w  w w  .  j  a v a  2  s  .  com
 * 
 * @param collectionResourceTabView
 * @param collectionItem
 *            instance of {@link CollectionItemDo}
 */
public ShelfCollectionResourceChildView(IsCollectionResourceTabView collectionResourceTabView,
        CollectionItemDo collectionItem) {
    this.collectionResourceTabView = collectionResourceTabView;
    res = CollectionEditResourceCBundle.INSTANCE;
    CollectionEditResourceCBundle.INSTANCE.css().ensureInjected();
    initWidget(uiBinder.createAndBindUi(this));
    this.collectionItemDo = collectionItem;

    editFloPanel.setVisible(false);
    imgNotFriendly.setUrl("images/mos/ipadFriendly.png");
    startStopTimeDisplayText.setText(GL0957);
    minsText.getElement().setInnerHTML(GL0958);
    secondsText.getElement().setInnerHTML(GL0959);
    endMinsText.getElement().setInnerHTML(GL0958);
    endSecondsText.getElement().setInnerHTML(GL0959);
    editSartPageText.setText(GL0960);
    StartPageLbl.setText(GL0961);
    EditBtn.setText(GL0140);
    updateResourceBtn.setText(GL0962);
    editInfoLbl.setText(GL0963);
    editVideoTimeLbl.setText(GL0964);
    editStartPageLbl.setText(GL0960);
    copyResource.setText(GL0965);
    confirmDeleteLbl.setText(GL0237);
    UpdateTextMessage.setText(GL0966);
    updateNarrationBtn.setText(GL0240);
    cancelNarrationBtn.setText(GL0142);
    updateVideoTimeBtn.setText(GL0240);
    cancelVideoTimeBtn.setText(GL0142);
    updatePdfBtn.setText(GL0240);
    cancelpdfBtn.setText(GL0142);
    setData(collectionItem);

    onResourceNarrationOut();
    addDomHandler(new ActionPanelHover(), MouseOverEvent.getType());
    addDomHandler(new ActionPanelOut(), MouseOutEvent.getType());
    setPresenter(new ShelfCollectionResourceChildPresenter(this));
    //For 5.9 
    narrationAlertMessageLbl.setText(GL0143);
    actionVerPanel.setVisible(false);
    actionVerPanelForUpdateTime.setVisible(false);
    UpdateTextMessage.setVisible(false);
    ResourceEditButtonContainer.getElement().getStyle().setVisibility(Visibility.HIDDEN);
    EditBtn.setVisible(false);
    editPdfFlowPanel.setVisible(false);
    actionVerPanelForUpdatePDF.setVisible(false);
    fromTxt.setFocus(true);
    toTxt.setFocus(true);
    EndTimeTxt1.setFocus(true);
    EndTimeTxt2.setFocus(true);
    startpdfPageNumber.setFocus(true);
    fromTxt.getElement().setAttribute("maxlength", "4");
    toTxt.getElement().setAttribute("maxlength", "4");
    EndTimeTxt1.getElement().setAttribute("maxlength", "4");
    EndTimeTxt2.getElement().setAttribute("maxlength", "4");
    startpdfPageNumber.getElement().setAttribute("maxlength", "4");
    EditBtn.getElement().setId("btnEdit");
    updateResourceBtn.getElement().setId("lblUpdateResoure");
    copyResource.getElement().setId("lblCopyResource");
    editInfoLbl.getElement().setId("lblEditInfo");
    editStartPageLbl.getElement().setId("lblEditStartPage");
    confirmDeleteLbl.getElement().setId("lblConfirmDelete");
    updateNarrationBtn.getElement().setId("btnUpdateNarration");
    cancelNarrationBtn.getElement().setId("btnCancelNarration");
    updatePdfBtn.getElement().setId("btnUpdatePdf");
    cancelpdfBtn.getElement().setId("btnCancelPdf");
    editVideoTimeLbl.getElement().setId("lblEditVideoTime");
    updateVideoTimeBtn.getElement().setId("btnUpdateVideoTime");
    cancelVideoTimeBtn.getElement().setId("btnCancelVideoTime");
    fromTxt.addKeyPressHandler(new NumbersOnly());
    toTxt.addKeyPressHandler(new NumbersOnly());
    EndTimeTxt1.addKeyPressHandler(new NumbersOnly());
    EndTimeTxt2.addKeyPressHandler(new NumbersOnly());
    startpdfPageNumber.addKeyPressHandler(new NumbersOnly());
    // resourceNarrationHtml.addMouseOverHandler(new showNarationPencil());
    // resourceNarrationHtml.addMouseOutHandler(new hideNarationPencil());
    narrationTxtArea.getElement().setAttribute("maxlength", "600");
    //   narrationTxtArea.addKeyUpHandler(new narationValidation());
    fromTxt.addKeyUpHandler(new fromTxtKeyUpHandler());
    toTxt.addKeyUpHandler(new toTxtKeyUpHandler());
    editFieldsFloPanel.setVisible(false);
    // To check whether resource is public and is created by logged in user
    String resourceShare = collectionItemDo.getResource().getSharing();
    String resourceCategory = collectionItemDo.getResource().getCategory();

    if (resourceShare.equalsIgnoreCase("public") && !resourceCategory.equalsIgnoreCase("question")) {
        editInfoLbl.setVisible(false);
    } else if (resourceShare.equalsIgnoreCase("public") && resourceCategory.equalsIgnoreCase("question")
            && checkLoggedInUser()) {
        editInfoLbl.setVisible(true);
    } else if (resourceShare.equalsIgnoreCase("private") && !resourceCategory.equalsIgnoreCase("question")
            && checkLoggedInUser()) {
        editInfoLbl.setVisible(true);
    } else if (!checkLoggedInUser()) {
        editInfoLbl.setVisible(false);
    }
    narrationTxtArea.addInitializeHandler(new InitializeHandler() {
        @Override
        public void onInitialize(InitializeEvent event) {
            Document document = IFrameElement.as(narrationTxtArea.getElement()).getContentDocument();
            BodyElement body = document.getBody();
            body.setAttribute("style",
                    "font-family: Arial;font-size:13px;color:#515151;line-height:1.2;margin:0px;");
        }
    });

    /*      narrationTxtArea.addBlurHandler(new BlurHandler() {
                     
             @Override
             public void onBlur(BlurEvent event) {
    updateNarrationBtn.setEnabled(false);
    updateNarrationBtn.getElement().addClassName("disabled");
    if (trim(narrationTxtArea.getHTML()).length() > 0){
            
       updateNarrationBtn.setEnabled(false);
       updateNarrationBtn.getElement().addClassName("disabled");
               
    }
             }
          });*/

    narrationTxtArea.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            narrationTxtArea.getElement().getStyle().clearBackgroundColor();
            narrationTxtArea.getElement().getStyle().setBorderColor("#ccc");
            if (narrationTxtArea.getText().toString().trim().length() >= 600) {
                narrationAlertMessageLbl.removeStyleName("titleAlertMessageDeActive");
                narrationAlertMessageLbl.addStyleName("titleAlertMessageActive");
                updateNarrationBtn.setEnabled(false);
                updateNarrationBtn.getElement().addClassName("disabled");
                event.preventDefault();
            } else {
                updateNarrationBtn.setEnabled(true);
                updateNarrationBtn.getElement().removeClassName("disabled");
                narrationAlertMessageLbl.addStyleName("titleAlertMessageDeActive");
                narrationAlertMessageLbl.removeStyleName("titleAlertMessageActive");
            }

        }
    });
    narrationTxtArea.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            narrationAlertMessageLbl.setVisible(false);
            if (narrationTxtArea.getText().toString().trim().length() >= 600) {
                narrationAlertMessageLbl.removeStyleName("titleAlertMessageDeActive");
                narrationAlertMessageLbl.addStyleName("titleAlertMessageActive");
                updateNarrationBtn.setEnabled(false);
                updateNarrationBtn.getElement().addClassName("disabled");
                if (event.getNativeEvent().getCtrlKey() && event.getNativeEvent().getKeyCode() == 86) {
                    event.getNativeEvent().preventDefault();
                    ((RichTextArea) event.getSource()).setFocus(false);
                    narrationAlertMessageLbl.setVisible(true);
                    return;
                }
            } else {
                narrationAlertMessageLbl.addStyleName("titleAlertMessageDeActive");
                narrationAlertMessageLbl.removeStyleName("titleAlertMessageActive");
                updateNarrationBtn.setEnabled(true);
                updateNarrationBtn.getElement().removeClassName("disabled");
                narrationAlertMessageLbl.setVisible(false);
            }
        }
    });

    imgNotFriendly.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            toolTip = new ToolTip(GL0454 + ""
                    + "<img src='/images/mos/ipadFriendly.png' style='margin-top:0px;'/>" + " " + GL04431);

            toolTip.getElement().getStyle().setBackgroundColor("transparent");
            toolTip.getElement().getStyle().setPosition(Position.ABSOLUTE);
            toolTip.setPopupPosition(imgNotFriendly.getAbsoluteLeft() - (50 + 22),
                    imgNotFriendly.getAbsoluteTop() + 22);
            toolTip.show();
        }
    });
    imgNotFriendly.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {

            EventTarget target = event.getRelatedTarget();
            if (Element.is(target)) {
                if (!toolTip.getElement().isOrHasChild(Element.as(target))) {
                    toolTip.hide();
                }
            }
        }
    });
}