Example usage for com.google.gwt.user.client.ui PopupPanel setGlassEnabled

List of usage examples for com.google.gwt.user.client.ui PopupPanel setGlassEnabled

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui PopupPanel setGlassEnabled.

Prototype

public void setGlassEnabled(boolean enabled) 

Source Link

Document

When enabled, the background will be blocked with a semi-transparent pane the next time it is shown.

Usage

From source file:com.l3.CB.client.ui.widgets.ApplicationTextWidget.java

License:Open Source License

/**
 * ABOUT CONFESSION BOX//w  w  w .  ja va 2  s  .  c  om
 */
public static PopupPanel setupAbout() {
    final PopupPanel pPnlAbout = new PopupPanel(true);
    pPnlAbout.setGlassEnabled(true);
    pPnlAbout.setStyleName("infoModalPopupWindow");

    FlowPanel sPnlContent = new FlowPanel();

    PushButton close = new PushButton("Close");
    close.addStyleName("infoModalPopupWindowClose");
    close.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pPnlAbout.hide();
        }
    });
    sPnlContent.add(close);

    sPnlContent.add(new HTML("<b>About Confession Box</b><br/><br/>"
            + "<b>Confession Box</b> is a worldwide online platform for people to <b>write confessions</b> to their friends, family-members, relatives, colleagues etc and <b>request for a Pardon</b> in return.<br/><br/>"
            + "You may get a Pardon from the person to whom you have confessed, if he/she thinks your confession or act should get a pardon. Else you also get <b>public support</b> by people voting <b>'Same Boat', 'Sympathies', 'Should be pardoned'</b> etc making that person to rethink and grant you a pardon by pressing <b>PARDON</b> button.<br/><br/>"
            + "And the best part is, <b>you can also confess anonymously</b>. Your identity can be hidden to the world except to the person you have requested for a pardon.<br/><br/>"
            + "If you do not specifically wish to request for a pardon from someone and want to write an <b>open confession</b>, you can simply <b>confess to the world or god</b>. People from across the globe can express themselves by voting 'Sympathies', 'Same Boat', 'Lame', 'Should be Pardoned', 'Should not be Pardoned', depending upon your confession.<br/><br/>"
            + "For every such <b>humane activity</b> of writing a confession, granting pardon, voting sympathies, same boat, sharing on FB wall etc, you earn <b>Human Points (HP)</b>. You can use your Human Points to get pardon votes, transfer HP to someone needy and lot more."));
    pPnlAbout.add(sPnlContent);

    return pPnlAbout;
}

From source file:com.l3.CB.client.ui.widgets.ApplicationTextWidget.java

License:Open Source License

/**
 * PILLOSPHY CONFESSION BOX//from   w w w.  j a va2 s . c o  m
 */
public static PopupPanel setupPhillosphy() {
    final PopupPanel pPnlAbout = new PopupPanel(true);
    pPnlAbout.setGlassEnabled(true);
    pPnlAbout.setStyleName("infoModalPopupWindow");

    FlowPanel sPnlContent = new FlowPanel();

    PushButton close = new PushButton("Close");
    close.addStyleName("infoModalPopupWindowClose");
    close.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pPnlAbout.hide();
        }
    });
    sPnlContent.add(close);

    sPnlContent.add(new HTML("<b>The Philosophy</b><br/><br/>"
            + "Confession box is an endeavor to provide a platform for the world to express those emotions which are often embedded deep in our conscience and live there for ever. There are many who wish to gather courage to speak up and say the 2 simple words 'I am sorry' for their deeds which brought some discomfort or left a grave mark (good or bad) on someone's life..<br/><br/>"
            + "The world is filled with hearts which want to spread joy, health and smiles.. But the world is equally filled with wounded people who deserve to get a sorry from those who intentionally or unintentionally did that to them..<br/><br/>"
            + "There is a great relief.. An unsettling joy and a pleasant feeling brought upon any soul who gets the most coveted pardon from a friend, a brother, a father, a son, the boss, the uncle, the girl-friend, the wife.. We all just love when pardoned with a smile and patch up those invaluable relationships which were broken for no reasons..<br/><br/>"
            + "Like its said, its never too late to say sorry.. We present our friends with this platform known as Confession Box to say sorry to those to whom your act or words brought any discomfort in past or present. And to feel sympathetic towards those who are going through the same testing time of their life you once did..<br/><br/>"
            + "This platform is also much bigger than just apologies and getting pardons. Its a fun platform too. The tiny naughty day-to-day activities which makes you to show that grin and do annoying or naughty things to people.. Now just get away with that with a simple naughty confession to your friend or brother or colleague or husband or the neighbor..<br/><br/>"
            + "Lets pretend we are sorry.. ;)"));
    pPnlAbout.add(sPnlContent);

    return pPnlAbout;
}

From source file:com.l3.CB.client.ui.widgets.ApplicationTextWidget.java

License:Open Source License

/**
 * PILLOSPHY ANONYMOUS CONFESSION BOX/*  w ww . j  a  v  a  2  s.c  o  m*/
 */
public static PopupPanel setupPhillosphyAnynConf() {
    final PopupPanel pPnlAbout = new PopupPanel(true);
    pPnlAbout.setGlassEnabled(true);
    pPnlAbout.setStyleName("infoModalPopupWindow");

    FlowPanel sPnlContent = new FlowPanel();

    PushButton close = new PushButton("Close");
    close.addStyleName("infoModalPopupWindowClose");
    close.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pPnlAbout.hide();
        }
    });
    sPnlContent.add(close);

    sPnlContent.add(new HTML("<b>Thoughts about Anonymous Confession</b><br/><br/>"
            + "Life is simply complex.. Many of us are often confused when it comes to emotions and feelings. Better we are confused as the world of relationships, love, emotions is a portrait of picasso, a poem by Rabindranath Tagore, the music of Beethoven.. Beautiful and intense..<br/><br/>"
            + "Our thought of Anonymity in confession brings a sense of freedom to apologize and bring our true emotions out in open. Let people know what you want to say to your father, your sister, your best friend, your boy friend, brother, uncle.. but anonymously.. and share the thought with the world..<br/><br/>"
            + "The world we know which tends to be violent, intolerant, materialistic will prove you wrong and tell you that what you wrote in your confession, your true feelings towards someone, some event etc...is also shared by almost every soul who reads your anonymous confession..<br/><br/>"
            + "The votes of 'Same Boat', 'Sympathies', 'Should be Pardoned' will boost your morale and make you feel elated since you find yourself not alone and embrace the blessings of so many strange yet known people via your heartfelt confession..<br/><br/>"
            + "So, write your first confession today, to your 6th standard crush, to your dad whom you love the most, to your best friend who is away and not-in-touch for a long time..<br/><br/>"
            + "Confession Box, speak your heart, live free...."));
    pPnlAbout.add(sPnlContent);

    return pPnlAbout;
}

From source file:com.l3.CB.client.ui.widgets.ApplicationTextWidget.java

License:Open Source License

/**
 * /*w w  w  . j  a  va2  s  .co m*/
 */
public static PopupPanel setupPrivacy() {
    final PopupPanel pPnlPrivacy = new PopupPanel(false);
    pPnlPrivacy.setGlassEnabled(true);
    pPnlPrivacy.setStyleName("infoModalPopupWindow");

    FlowPanel sPnlContent = new FlowPanel();

    PushButton close = new PushButton("Close");
    close.addStyleName("infoModalPopupWindowClose");

    close.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pPnlPrivacy.hide();
        }
    });
    sPnlContent.add(close);

    sPnlContent.add(new HTML(
            "<b>PRIVACY POLICY</b>: This Privacy Policy governs the manner in which Confession Box collects, uses, maintains and discloses information collected from users (each, a \"User\") of the http://apps.facebook.com/fbconfess#privacy website (\"Site\"). This privacy policy applies to the Site and all products and services offered by Confession Box.<br/>"
                    + "<b>Personal identification information</b><br/>"
                    + "We may collect personal identification information from Users in a variety of ways, including, but not limited to, when Users visit our site, register on the site, and in connection with other activities, services, features or resources we make available on our Site. Users may be asked for, as appropriate, name. Users may, however, visit our Site anonymously. We will collect personal identification information from Users only if they voluntarily submit such information to us. Users can always refuse to supply personally identification information, except that it may prevent them from engaging in certain Site related activities.<br/>"
                    + "<b>Non-personal identification information</b><br/>"
                    + "We may collect non-personal identification information about Users whenever they interact with our Site. Non-personal identification information may include the browser name, the type of computer and technical information about Users means of connection to our Site, such as the operating system and the Internet service providers utilized and other similar information.<br/>"
                    + "<b>Web browser cookies</b><br/>"
                    + "Our Site may use \"cookies\" to enhance User experience. User's web browser places cookies on their hard drive for record-keeping purposes and sometimes to track information about them. User may choose to set their web browser to refuse cookies, or to alert you when cookies are being sent. If they do so, note that some parts of the Site may not function properly.<br/>"
                    + "<b>How we use collected information</b><br/>"
                    + "Confession Box may collect and use Users personal information for the following purposes:-<br/>"
                    + "<b>To improve customer service</b><br/>"
                    + "Information you provide helps us respond to your customer service requests and support needs more efficiently.<br/>"
                    + "<b>How we protect your information</b><br/>"
                    + "We adopt appropriate data collection, storage and processing practices and security measures to protect against unauthorized access, alteration, disclosure or destruction of your personal information, username, password, transaction information and data stored on our Site.<br/>"
                    + "Sensitive and private data exchange between the Site and its Users happens over a SSL secured communication channel and is encrypted and protected with digital signatures.<br/>"
                    + "<b>Sharing your personal information</b><br/>"
                    + "We do not sell, trade, or rent Users personal identification information to others. We may share generic aggregated demographic information not linked to any personal identification information regarding visitors and users with our business partners, trusted affiliates and advertisers for the purposes outlined above.<br/>"
                    + "<b>Compliance with children's online privacy protection act</b><br/>"
                    + "Protecting the privacy of the very young is especially important. For that reason, we never collect or maintain information at our Site from those we actually know are under 13, and no part of our website is structured to attract anyone under 13.<br/>"
                    + "<b>Changes to this privacy policy</b><br/>"
                    + "Confession Box has the discretion to update this privacy policy at any time. When we do, we will send you an email. We encourage Users to frequently check this page for any changes to stay informed about how we are helping to protect the personal information we collect. You acknowledge and agree that it is your responsibility to review this privacy policy periodically and become aware of modifications.<br/>"
                    + "<b>Your acceptance of these terms</b><br/>"
                    + "By using this Site, you signify your acceptance of this policy. If you do not agree to this policy, please do not use our Site. Your continued use of the Site following the posting of changes to this policy will be deemed your acceptance of those changes.<br/>"
                    + "<b>Contacting us</b><br/>"
                    + "If you have any questions about this Privacy Policy, the practices of this site, or your dealings with this site, please contact us at:<br/>"
                    + "Confession Box http://apps.facebook.com/fbconfess#privacy<br/>"
                    + "This document was last updated on March 03, 2013<br/>"
                    + "Privacy policy created by Generate Privacy Policy"));
    pPnlPrivacy.add(sPnlContent);
    return pPnlPrivacy;
}

From source file:com.l3.CB.client.ui.widgets.ApplicationTextWidget.java

License:Open Source License

/**
 * Terms of service/*from   www .ja v  a 2s  .com*/
 */
public static PopupPanel setupTOS() {
    final PopupPanel pPnlTOS = new PopupPanel(false);
    pPnlTOS.setGlassEnabled(true);
    pPnlTOS.setStyleName("infoModalPopupWindow");

    FlowPanel sPnlContent = new FlowPanel();

    PushButton close = new PushButton("Close");
    close.addStyleName("infoModalPopupWindowClose");
    close.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pPnlTOS.hide();
        }
    });
    sPnlContent.add(close);

    sPnlContent.add(new HTML("<h2>Web Site Terms and Conditions of Use</h2>" + "<h3>1. Terms</h3>"
            + "<p>By accessing this web site, you are agreeing to be bound by these web site Terms and Conditions of Use, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local "
            + "laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this web site are protected by applicable copyright and trade mark law.</p>"
            + "<h3>2. Use License</h3>" + "<ol type='a'>"
            + "<li> Permission is granted to temporarily download one copy of the materials (information or software) on Confession Box's web site for personal, non-commercial transitory viewing only. This is the grant of a license, "
            + "not a transfer of title, and under this license you may not:" + "<ol type='i'>"
            + "<li>modify or copy the materials;</li>"
            + "<li>use the materials for any commercial purpose, or for any public display (commercial or non-commercial);</li>"
            + "<li>attempt to decompile or reverse engineer any software contained on Confession Box's web site;</li>"
            + "<li>remove any copyright or other proprietary notations from the materials; or</li>"
            + "<li>transfer the materials to another person or 'mirror' the materials on any other server.</li>"
            + "</ol>" + "</li>"
            + "<li>This license shall automatically terminate if you violate any of these restrictions and may be terminated by Confession Box at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format.</li>"
            + "</ol>" + "<h3>3. Disclaimer</h3>" + "<ol type='a'>"
            + "<li>The materials on Confession Box's web site are provided \"as is\". Confession Box makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Further, Confession Box does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its Internet web site or otherwise relating to such materials or on any sites linked to this site.</li>"
            + "</ol>" + "<h3>4. Limitations</h3>"
            + "<p>In no event shall Confession Box or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption,) arising out of the use or inability to use the materials on Confession Box's Internet site, even if Confession Box or a Confession Box authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you.</p>"
            + "<h3>5. Revisions and Errata</h3>"
            + "<p>The materials appearing on Confession Box's web site could include technical, typographical, or photographic errors. Confession Box does not warrant that any of the materials on its web site are accurate, complete, or current. Confession Box may make changes to the materials contained on its web site at any time without notice. Confession Box does not, however, make any commitment to update the materials.</p>"
            + "<h3>6. Links</h3>"
            + "<p>Confession Box has not reviewed all of the sites linked to its Internet web site and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by Confession Box of the site. Use of any such linked web site is at the user's own risk.</p>"
            + "<h3>7. Site Terms of Use Modifications</h3>"
            + "<p>Confession Box may revise these terms of use for its web site at any time without notice. By using this web site you are agreeing to be bound by the then current version of these Terms and Conditions of Use.</p>"
            + "<h3>8. Governing Law</h3>"
            + "<p>Any claim relating to Confession Box's web site shall be governed by the laws of the State of New Delhi without regard to its conflict of law provisions.</p>"
            + "<p>General Terms and Conditions applicable to Use of a Web Site.</p>" + "<h2>Privacy Policy</h2>"
            + "<p>Your privacy is very important to us. Accordingly, we have developed this Policy in order for you to understand how we collect, use, communicate and disclose and make use of personal information. The following outlines our privacy policy.</p>"
            + "<ul>"
            + "<li>Before or at the time of collecting personal information, we will identify the purposes for which information is being collected.</li>"
            + "<li>We will collect and use of personal information solely with the objective of fulfilling those purposes specified by us and for other compatible purposes, unless we obtain the consent of the individual concerned or as required by law.</li>"
            + "<li>We will only retain personal information as long as necessary for the fulfillment of those purposes.</li>"
            + "<li>We will collect personal information by lawful and fair means and, where appropriate, with the knowledge or consent of the individual concerned.</li>"
            + "<li>Personal data should be relevant to the purposes for which it is to be used, and, to the extent necessary for those purposes, should be accurate, complete, and up-to-date.</li>"
            + "<li>We will protect personal information by reasonable security safeguards against loss or theft, as well as unauthorized access, disclosure, copying, use or modification.</li>"
            + "<li>We will make readily available to customers information about our policies and practices relating to the management of personal information.</li>"
            + "</ul>"
            + "<p>We are committed to conducting our business in accordance with these principles in order to ensure that the confidentiality of personal information is protected and maintained.</p>"));
    pPnlTOS.add(sPnlContent);

    return pPnlTOS;
}

From source file:com.l3.CB.client.ui.widgets.ApplicationTextWidget.java

License:Open Source License

/**
 * //from   www  .ja  v a2s  .c  o m
 */
public static PopupPanel setupCBRuleBook() {
    final PopupPanel pPnlRuleBook = new PopupPanel(true);
    pPnlRuleBook.setGlassEnabled(true);
    pPnlRuleBook.setStyleName("infoModalPopupWindow");

    FlowPanel sPnlContent = new FlowPanel();

    PushButton close = new PushButton("Close");
    close.addStyleName("infoModalPopupWindowClose");

    close.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            pPnlRuleBook.hide();
        }
    });
    sPnlContent.add(close);
    sPnlContent.add(new HTML("<b>CB Rule-Book</b><br/><br/>"));

    SafeUri reportAbuseIconSafeUri = new SafeUri() {
        @Override
        public String asString() {
            return Constants.IMAGE_REPORT_ABUSE_ICON;
        }
    };
    SafeUri lameIconSafeUri = new SafeUri() {
        @Override
        public String asString() {
            return Constants.IMAGE_LAME_ICON;
        }
    };
    SafeUri sameBoatIconSafeUri = new SafeUri() {
        @Override
        public String asString() {
            return Constants.IMAGE_SAME_BOAT_ICON;
        }
    };
    SafeUri shouldBePardonedIconSafeUri = new SafeUri() {
        @Override
        public String asString() {
            return Constants.IMAGE_SHOULD_BE_PARDONED_ICON;
        }
    };
    SafeUri shouldNotBePardonedIconSafeUri = new SafeUri() {
        @Override
        public String asString() {
            return Constants.IMAGE_SHOULD_NOT_BE_PARDONED_ICON;
        }
    };
    SafeUri sympathyIconSafeUri = new SafeUri() {
        @Override
        public String asString() {
            return Constants.IMAGE_SYMPATHY_ICON;
        }
    };

    sPnlContent.add(new HTML(
            Templates.TEMPLATES.voteHelp(reportAbuseIconSafeUri, ConfessionBox.cbText.abuseButtonToolTip())));
    sPnlContent.add(
            new HTML(Templates.TEMPLATES.voteHelp(lameIconSafeUri, ConfessionBox.cbText.lameButtonToolTip())));
    sPnlContent.add(new HTML(
            Templates.TEMPLATES.voteHelp(sameBoatIconSafeUri, ConfessionBox.cbText.sameBoatButtonToolTip())));
    sPnlContent.add(new HTML(Templates.TEMPLATES.voteHelp(shouldBePardonedIconSafeUri,
            ConfessionBox.cbText.shouldBePardonedButtonToolTip())));
    sPnlContent.add(new HTML(Templates.TEMPLATES.voteHelp(shouldNotBePardonedIconSafeUri,
            ConfessionBox.cbText.shouldNotBePardonedButtonToolTip())));
    sPnlContent.add(new HTML(
            Templates.TEMPLATES.voteHelp(sympathyIconSafeUri, ConfessionBox.cbText.sympathyButtonToolTip())));

    sPnlContent.add(new HTML(
            "<hr/>1. Confession Box is a secure application and your identity is never disclosed to anyone unless you yourself share your identity to the world.<br/>"
                    + "2. You can read all the confessions on the 'Confession Wall' without logging-in on the CB and without providing any of your informations to CB.<br/>"
                    + "3. If you register a confession with hidden identity, your identity can not be discovered by any one other than you (Unless you write your details in the confession text).<br/>"
                    + "4. You can confess and appeal for pardon from a person in your facebook friend's list. A notification is sent to the person via email if the person is on CB.<br/>"
                    + "5. If you appeal for pardon to someone, the person is informed about the confession along with your identity and a link to confession.<br/>"
                    + "6. If some one has confessed to you, a notofication is sent to you. You can visit and check the confession and pardon for the same if you may.<br/>"
                    + "7. While pardonning, you can set some conditions that should be met for the confession to be pardoned.<br/>"
                    + "8. When all the conditions are met, the confession is pardoned and you and the confessee are notified about the pardon!<br/>"
                    + "9. You can also subscribe a confession by clicking the 'Subscribe' link. You are notified about the confession when it is pardoned.<br/>"
                    + "10. You are provided 'Human Points' for all the activities you do on CB that shall be a count of how good a human you are."));

    pPnlRuleBook.add(sPnlContent);

    return pPnlRuleBook;
}

From source file:com.ponysdk.ui.terminal.ui.PTPopupPanel.java

License:Apache License

@Override
public void update(final PTInstruction update, final UIService uiService) {
    final PopupPanel popup = cast();

    if (update.containsKey(PROPERTY.ANIMATION)) {
        popup.setAnimationEnabled(update.getBoolean(PROPERTY.ANIMATION));
    } else if (update.containsKey(PROPERTY.POPUP_CENTER)) {
        popup.center();//from  w w w . j  av a 2s .  co  m
    } else if (update.containsKey(PROPERTY.POPUP_SHOW)) {
        popup.show();
    } else if (update.containsKey(PROPERTY.POPUP_HIDE)) {
        popup.hide();
    } else if (update.containsKey(PROPERTY.POPUP_GLASS_ENABLED)) {
        popup.setGlassEnabled(update.getBoolean(PROPERTY.POPUP_GLASS_ENABLED));
    } else if (update.containsKey(PROPERTY.POPUP_MODAL)) {
        popup.setModal(update.getBoolean(PROPERTY.POPUP_MODAL));
    } else if (update.containsKey(PROPERTY.POPUP_POSITION)) {
        final int left = update.getInt(PROPERTY.POPUP_POSITION_LEFT);
        final int top = update.getInt(PROPERTY.POPUP_POSITION_TOP);
        popup.setPopupPosition(left, top);
    } else if (update.containsKey(PROPERTY.POPUP_DRAGGABLE)) {
        final boolean draggable = update.containsKey(PROPERTY.POPUP_DRAGGABLE);
        if (draggable) {
            popup.addDomHandler(this, MouseDownEvent.getType());
            popup.addDomHandler(this, MouseUpEvent.getType());
            popup.addDomHandler(this, MouseMoveEvent.getType());
        }
    } else {
        super.update(update, uiService);
    }
}

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.editor.client.entry.AdvancedEditor.java

License:Apache License

public static PopupPanel openEditor(final LexEntry entry, final LemmaVersion lv,
        final AsyncCallback<LexEntry> afterClose, final EditorConstants constants,
        final EditorMessages messages) {

    final PopupPanel popup = new PopupPanel(false, false);
    final AsyncCallback<LexEntry> callback = new AsyncCallback<LexEntry>() {

        @Override//from w  ww . j a va2  s . c o  m
        public void onFailure(Throwable caught) {
            afterClose.onFailure(caught);
        }

        @Override
        public void onSuccess(LexEntry result) {
            popup.hide();
            afterClose.onSuccess(result);
        }
    };
    popup.setStyleName("editor-modal");
    popup.setGlassEnabled(true);
    popup.setGlassStyleName("editor-modal-glass");
    final VerticalPanel content = new VerticalPanel();
    popup.add(content);
    popup.setPopupPosition(50, 50);
    popup.setPixelSize(Window.getClientWidth() - 100, Window.getClientHeight() - 100);
    final LemmaEditorWidget editorWidget = new LemmaEditorWidget(AsyncLemmaDescriptionLoader.getDescription(),
            UseCase.FIELDS_FOR_ADVANCED_EDITOR, true, 2, true, null);
    editorWidget.setData(lv);
    content.add(editorWidget);
    final boolean withComment = true;
    final boolean withEmail = true;
    Fieldset overlayPanel = new Fieldset();
    overlayPanel.getElement().getStyle().setMarginLeft(10, Unit.PX);
    overlayPanel.getElement().getStyle().setMarginRight(10, Unit.PX);
    overlayPanel.setStyleName("form-horizontal");
    content.add(overlayPanel);
    final ControlGroup left = new ControlGroup();
    final ControlGroup right = new ControlGroup();
    overlayPanel.add(left);
    overlayPanel.add(right);

    LocalizedStrings.afterLoad(new AsyncCallback<TranslationMap>() {

        @Override
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(final TranslationMap localizedStrings) {

            service.getOverlayTypes(true, new AsyncCallback<ArrayList<String>>() {

                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(ArrayList<String> result) {
                    if (result.size() == 0) {
                        return;
                    }
                    FlowPanel group = new FlowPanel();
                    langAOverlay = new ListBox(false);
                    langAOverlay.addItem(constants.none(), (String) null);
                    for (final String type : result) {
                        langAOverlay.addItem(type, type);
                    }
                    group.add(langAOverlay);
                    final Button edit = new Button(constants.edit());
                    langAOverlay.addChangeHandler(new ChangeHandler() {

                        @Override
                        public void onChange(ChangeEvent event) {
                            edit.setEnabled(langAOverlay.getSelectedIndex() != 0);
                        }
                    });

                    edit.getElement().getStyle().setMarginLeft(10, Unit.PX);
                    edit.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            showOverlayEditor(lv, langAOverlay.getValue(), localizedStrings, constants,
                                    messages);
                        }
                    });
                    group.add(edit);
                    //                        left.add(new ControlLabel(messages.controlLabelOverlay(AsyncLemmaDescriptionLoader.getDescription().getLanguageName(true))));
                    left.add(new ControlLabel(messages.controlLabelOverlay()));
                    Controls controls = new Controls();
                    controls.add(group);
                    left.add(controls);
                    edit.setEnabled(false);
                    String overlay = lv.getEntryValue(LemmaVersion.OVERLAY_LANG1);
                    for (int i = 0; i < result.size(); i++) {
                        if (result.get(i).equals(overlay)) {
                            langAOverlay.setItemSelected(i + 1, true);
                            edit.setEnabled(true);
                            break;
                        }
                    }
                }
            });
            service.getOverlayTypes(false, new AsyncCallback<ArrayList<String>>() {

                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(ArrayList<String> result) {
                    if (result.size() == 0) {
                        return;
                    }
                    FlowPanel group = new FlowPanel();
                    langBOverlay = new ListBox(false);
                    langBOverlay.addItem(constants.none(), (String) null);
                    for (final String type : result) {
                        langBOverlay.addItem(type, type);
                    }
                    group.add(langBOverlay);
                    final Button edit = new Button(constants.edit());
                    langBOverlay.addChangeHandler(new ChangeHandler() {

                        @Override
                        public void onChange(ChangeEvent event) {
                            edit.setEnabled(langBOverlay.getSelectedIndex() != 0);
                        }
                    });
                    edit.getElement().getStyle().setMarginLeft(10, Unit.PX);
                    edit.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            showOverlayEditor(lv, langBOverlay.getValue(), localizedStrings, constants,
                                    messages);
                        }
                    });
                    group.add(edit);
                    //                        right.add(new ControlLabel(messages.controlLabelOverlay(AsyncLemmaDescriptionLoader.getDescription().getLanguageName(false))));
                    right.add(new ControlLabel(messages.controlLabelOverlay()));
                    Controls controls = new Controls();
                    controls.add(group);
                    right.add(controls);
                    edit.setEnabled(false);
                    String overlay = lv.getEntryValue(LemmaVersion.OVERLAY_LANG2);
                    for (int i = 0; i < result.size(); i++) {
                        if (result.get(i).equals(overlay)) {
                            langBOverlay.setItemSelected(i + 1, true);
                            edit.setEnabled(true);
                            break;
                        }
                    }
                }
            });

            Fieldset set = null;
            if (withComment) {
                set = new Fieldset();
                ControlGroup commentGroup = new ControlGroup();
                commentGroup.add(new ControlLabel(localizedStrings.get("dialog.comment.header")));
                comment = new TextArea();
                comment.getElement().getStyle().setWidth(100, Unit.PCT);
                comment.getElement().getStyle().setProperty("resize", "none");
                comment.setVisibleLines(8);
                commentGroup.add(comment);
                set.add(commentGroup);
                comment.setText(lv.getEntryValue(LemmaVersion.COMMENT));
            }
            if (withEmail) {
                set = set == null ? new Fieldset() : set;
                ControlGroup group = new ControlGroup();
                group.add(new ControlLabel(localizedStrings.get("dialog.email.header")));
                HorizontalPanel hp = new HorizontalPanel();
                group.add(hp);
                email = new TextBox();
                email.getElement().getStyle().setWidth(350, Unit.PX);
                email.setText(lv.getEntryValue(LemmaVersion.EMAIL));
                hp.add(email);

                Button sendButton = new Button(constants.reply());
                sendButton.getElement().getStyle().setMarginLeft(10, Unit.PX);
                sendButton.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        AsyncLemmaDescriptionLoader
                                .afterLemmaDescriptionLoaded(new AsyncCallback<LemmaDescription>() {

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        // TODO Auto-generated method stub
                                    }

                                    @Override
                                    public void onSuccess(LemmaDescription ld) {
                                        String firstLanguageId = ld.getLanguage(true).getId();
                                        String secondLanguageId = ld.getLanguage(false).getId();
                                        String first = localizedStrings.get(firstLanguageId);
                                        String second = localizedStrings.get(secondLanguageId);
                                        String lemma1st = ld.toUnescapedString(lv, UseCase.RESULT_LIST, true);
                                        String lemma2nd = ld.toUnescapedString(lv, UseCase.RESULT_LIST, false);
                                        String german = first + "%20%3D%20" + lemma1st;
                                        String romansh = second + "%20%3D%20" + lemma2nd;
                                        String remartg = localizedStrings.get("mail.comment") + "%0A"
                                                + URL.encode(comment.getText());

                                        String subject = "?subject="
                                                + URL.encode(localizedStrings.get("mail.subject"));
                                        String body = "&body=" + german + "%0A" + romansh + "%0A%0A" + remartg;
                                        String cc = "";
                                        if (localizedStrings.get("mail.cc") != null) {
                                            cc = "&cc=" + localizedStrings.get("mail.cc");
                                        }
                                        Window.Location
                                                .assign("mailto:" + email.getText() + subject + cc + body);
                                    }
                                });

                    }
                });
                hp.add(sendButton);
                set.add(group);

            }
            if (set != null) {
                set.getElement().getStyle().setPaddingLeft(15, Unit.PC);
                set.getElement().getStyle().setPaddingRight(15, Unit.PC);
                HTML html = new HTML(new SafeHtmlBuilder().appendHtmlConstant("<hr/>").toSafeHtml());
                html.getElement().getStyle().setMarginLeft(20, Unit.PX);
                html.getElement().getStyle().setMarginRight(20, Unit.PX);
                content.add(html);
                content.add(set);
            }
        }
    });

    Button cancel = new Button(constants.cancel());
    cancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    });
    Button reset = new Button(constants.reset());
    reset.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editorWidget.setData(lv);
        }
    });
    Button ok = new Button(constants.ok());
    ok.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (entry == null) {
                LemmaVersion fromEditor = new LemmaVersion();
                fromEditor.getEntryValues().putAll(lv.getEntryValues());
                fromEditor.getMaalrValues().putAll(lv.getMaalrValues());
                transferSpecialValues(lv, fromEditor);
                editorWidget.updateFromEditor(fromEditor);
                if (editorWidget.isValid(true, true)) {
                    LexEntry entry = new LexEntry(fromEditor);
                    service.insert(entry, callback);
                }
            } else {
                LemmaVersion fromEditor = new LemmaVersion();
                fromEditor.getEntryValues().putAll(lv.getEntryValues());
                fromEditor.getMaalrValues().putAll(lv.getMaalrValues());
                transferSpecialValues(lv, fromEditor);
                editorWidget.updateFromEditor(fromEditor);
                if (editorWidget.isValid(true, true)) {
                    service.acceptAfterUpdate(entry, lv, fromEditor, callback);
                }
            }
            editorWidget.updateFromEditor(lv);
        }

        private void transferSpecialValues(final LemmaVersion lv, LemmaVersion fromEditor) {

            if (langAOverlay != null) {
                int index = langAOverlay.getSelectedIndex();
                String value = index <= 0 ? null : langAOverlay.getValue(index);
                fromEditor.setValue(LemmaVersion.OVERLAY_LANG1, value);
                lv.setValue(LemmaVersion.OVERLAY_LANG1, value);
            }
            if (langBOverlay != null) {
                int index = langBOverlay.getSelectedIndex();
                String value = index <= 0 ? null : langBOverlay.getValue(index);
                fromEditor.setValue(LemmaVersion.OVERLAY_LANG2, value);
                lv.setValue(LemmaVersion.OVERLAY_LANG2, value);
            }
            if (email != null) {
                fromEditor.setValue(LemmaVersion.EMAIL, email.getText());
                lv.setValue(LemmaVersion.EMAIL, email.getText());
            }
            if (comment != null) {
                fromEditor.setValue(LemmaVersion.COMMENT, comment.getText());
                lv.setValue(LemmaVersion.COMMENT, comment.getText());
            }
        }
    });
    ok.setType(ButtonType.PRIMARY);
    content.add(new ModalFooter(cancel, reset, ok));
    popup.show();
    final HandlerRegistration handler = Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            popup.setSize(Window.getClientWidth() - 100 + "px", Window.getClientHeight() - 100 + "px");
        }
    });
    popup.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            handler.removeHandler();
        }
    });
    return popup;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static PopupPanel popup(boolean autoHide, String title, IsWidget widget) {
    BuilderPanel bp = new BuilderPanel();
    if (title != null) {
        Label titleLabel = textTitleInverted(title);
        titleLabel.getElement().getStyle().setPadding(Widgets.defaultSpacing, Unit.PX);
        bp.add(titleLabel);/*from   w  w w. j ava2s .c om*/
    }
    bp.add(widget);

    PopupPanel dialog = new PopupPanel(autoHide, true);
    dialog.getElement().getStyle().setProperty("maxWidth", "90%");
    dialog.setWidget(bp);
    dialog.setGlassEnabled(true);
    Style style = dialog.getElement().getStyle();
    style.setPadding(0, Unit.PX);
    dialog.center();

    return dialog;
}

From source file:nl.mpi.tg.eg.experiment.client.view.ColourPickerCanvasView.java

License:Open Source License

public void setInstructions(final String instructions, final String infoButtonChar,
        final String closeButtonLabel) {
    final HTML instructionsLabel = new HTML(instructions);
    final PopupPanel popupPanel = new PopupPanel(false); // the close action to this panel causes background buttons to be clicked
    popupPanel.setGlassEnabled(true);
    popupPanel.setStylePrimaryName("stimulusHelpPanel");
    instructionsLabel.setStylePrimaryName("stimulusHelpText");
    instructionsScrollPanel = new ScrollPanel(instructionsLabel);
    instructionsScrollPanel.getElement().getStyle().setPropertyPx("maxHeight", Window.getClientHeight() - 150);
    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.add(instructionsScrollPanel);
    final Button closeButton = new Button(closeButtonLabel);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel.add(closeButton);//  w ww . jav a 2 s .c  om
    popupPanel.setWidget(verticalPanel);
    infoButton.setText(infoButtonChar);
    final SingleShotEventListner infoSingleShotEventListner = new SingleShotEventListner() {

        @Override
        protected void singleShotFired() {
            if (infoButton.isEnabled()) {
                //                    outerGrid.clear(); // users found that hiding the picker screen made it hard to understand the instruction text
                popupPanel.center();
                infoButton.setEnabled(false);
                resetSingleShot();
            }
        }
    };
    infoButton.addClickHandler(infoSingleShotEventListner);
    infoButton.addTouchStartHandler(infoSingleShotEventListner);
    infoButton.addTouchMoveHandler(infoSingleShotEventListner);
    infoButton.addTouchEndHandler(infoSingleShotEventListner);
    final SingleShotEventListner instructionsSingleShotEventListner1 = new SingleShotEventListner() {

        @Override
        protected void singleShotFired() {
            popupPanel.hide();
            resizeView();
            infoButton.setEnabled(true);
            resetSingleShot();
        }
    };
    closeButton.addClickHandler(instructionsSingleShotEventListner1);
    closeButton.addTouchStartHandler(instructionsSingleShotEventListner1);
    closeButton.addTouchMoveHandler(instructionsSingleShotEventListner1);
    closeButton.addTouchEndHandler(instructionsSingleShotEventListner1);
    popupPanel.addCloseHandler(new CloseHandler<PopupPanel>() {

        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            instructionsScrollPanel = null;
            //                instructionsSingleShotEventListner1.eventFired();
            //                infoButton.setEnabled(true);
            //                resizeView();
        }
    });
    popupPanel.center();
}