Example usage for org.apache.wicket.behavior Behavior Behavior

List of usage examples for org.apache.wicket.behavior Behavior Behavior

Introduction

In this page you can find the example usage for org.apache.wicket.behavior Behavior Behavior.

Prototype

public Behavior() 

Source Link

Document

Constructor

Usage

From source file:abid.password.wicket.components.AjaxFallbackLabel.java

License:Apache License

public AjaxFallbackLabel(String id, final String ajaxEnabledText, String ajaxDisabledText) {
    super(id, ajaxDisabledText);

    setOutputMarkupPlaceholderTag(true);

    add(new Behavior() {

        private static final long serialVersionUID = 1L;

        @Override// w w  w.  j a v a  2 s.  c  o  m
        public void renderHead(Component component, IHeaderResponse response) {
            super.renderHead(component, response);
            response.render(OnDomReadyHeaderItem.forScript(String
                    .format("document.getElementById('%s').innerHTML='%s'", getMarkupId(), ajaxEnabledText)));
        }

    });
}

From source file:au.org.theark.lims.web.component.inventory.panel.box.display.GridBoxPanel.java

License:Open Source License

/**
 * Creates the table data that represents the cells of the InvBox in question
 * @param invBox/*  w w  w  .  j  a  v  a  2  s.c o  m*/
 * @param invCellList
 * @return
 */
@SuppressWarnings({ "unchecked" })
private Loop createMainGrid(final InvBox invBox, final List<InvCell> invCellList) {
    String colRowNoType = "";

    if (invBox.getId() != null) {
        colRowNoType = invBox.getRownotype().getName();
    } else {
        // handle for null invBox (eg when backend list of cells corrupted)
        return new Loop("rows", 1) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void populateItem(LoopItem item) {
                item.add(new Loop("cols", 1) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected void populateItem(LoopItem item) {
                        item.add(new EmptyPanel("cell"));
                    }

                }.setVisible(false));
            }

            @Override
            public boolean isVisible() {
                return false;
            }
        };
    }

    final String rowNoType = colRowNoType;
    final int noOfCols = invBox.getNoofcol();

    // Outer Loop instance, using a PropertyModel to bind the Loop iteration to invBox "noofrow" value
    Loop loop = new Loop("rows", new PropertyModel(invBox, "noofrow")) {

        private static final long serialVersionUID = 1L;

        public void populateItem(LoopItem item) {
            final int row = item.getIndex();

            // Create the row number/label
            String label = new String();

            if (rowNoType.equalsIgnoreCase("ALPHABET")) {
                char character = (char) (row + 65);
                label = new Character(character).toString();
            } else {
                label = new Integer(row + 1).toString();
            }

            Label rowLabel = new Label("rowNo", new Model(label));
            rowLabel.add(new Behavior() {
                private static final long serialVersionUID = 1L;

                @Override
                public void onComponentTag(Component component, ComponentTag tag) {
                    super.onComponentTag(component, tag);
                    tag.put("style",
                            "background: none repeat scroll 0 0 #FFFFFF; color: black; font-weight: bold; padding: 1px;");
                };
            });
            rowLabel.setOutputMarkupId(true);
            item.add(rowLabel);

            // We create an inner Loop instance and uses PropertyModel to bind the Loop iteration to invBox "noofcol" value
            item.add(new Loop("cols", new PropertyModel(invBox, "noofcol")) {
                private static final long serialVersionUID = 1L;

                public void populateItem(LoopItem item) {
                    final int col = item.getIndex();
                    final int index = (row * noOfCols) + col;

                    InvCell invCell = invCellList.get(index);
                    GridCellContentPanel gridCellContentPanel;
                    // add the gridCell
                    if (allocating) {
                        gridCellContentPanel = new GridCellContentPanel("cell", limsVo, invCell, modalWindow,
                                true);
                    } else {
                        gridCellContentPanel = new GridCellContentPanel("cell", limsVo, invCell, modalWindow,
                                false);
                    }
                    gridCellContentPanel.setOutputMarkupId(true);
                    gridCellContentPanel.setMarkupId("invCell" + invCell.getId().toString());
                    item.add(gridCellContentPanel);
                }
            });
        }
    };
    return loop;
}

From source file:au.org.theark.study.web.component.address.form.DetailForm.java

License:Open Source License

/**
 * The MarkupContainer for The State DropDown control
 *///from   www .  jav  a2s  .com
private void initialiseStateSelector() {
    stateSelector = new WebMarkupContainer("stateSelector");
    stateSelector.setOutputMarkupPlaceholderTag(true);
    // Get the value selected in Country
    Country selectedCountry = countryChoice.getModelObject();

    // If there is no country selected, back should default to current country and pull the states
    List<State> stateList = iArkCommonService.getStates(selectedCountry);
    ChoiceRenderer<State> defaultStateChoiceRenderer = new ChoiceRenderer<State>("name", Constants.ID);
    stateChoice = new DropDownChoice<State>("address.state", stateList, defaultStateChoiceRenderer);
    // Add the Country State Dropdown into the WebMarkupContainer - countrySelector
    otherStateInvalidError = new Label("address.otherStateInvalidError", "");
    otherStateInvalidError.setOutputMarkupPlaceholderTag(true);
    otherStateInvalidError.add(new Behavior() {
        private static final long serialVersionUID = -6756543741833275627L;

        @Override
        public void onComponentTag(Component component, ComponentTag tag) {
            super.onComponentTag(component, tag);
            tag.put("class", "fieldErrorMessage");//or something like ("style"; "color-red")
        }
    });

    stateSelector.add(stateChoice);
    stateSelector.add(otherState);
    stateSelector.add(otherStateInvalidError);

    if (stateList.size() > 0) {
        otherState.setVisible(false);
        stateChoice.setVisible(true);
    } else {
        otherState.setVisible(true);
        stateChoice.setVisible(false);
    }
}

From source file:au.org.theark.study.web.component.address.form.SearchForm.java

License:Open Source License

public void updateDetailFormPrerender(Address address) {
    // Ensure we update the CountyStateChoices in DetailsForm
    // like what happens via DetailForm's updateStateChoices(..)
    List<State> stateList = iArkCommonService.getStates(address.getCountry());
    WebMarkupContainer wmcStateSelector = (WebMarkupContainer) arkCrudContainerVO.getDetailPanelFormContainer()
            .get(Constants.STATE_SELECTOR_WMC);
    DropDownChoice<State> detailStateSelector = (DropDownChoice<State>) wmcStateSelector.get("address.state");
    Label otherStateInvalidError = (Label) wmcStateSelector.get("address.otherStateInvalidError");
    TextField<String> otherState = (TextField<String>) wmcStateSelector.get("address.otherState");

    if (stateList != null && stateList.size() > 0) {
        detailStateSelector.getChoices().clear();
        detailStateSelector.setChoices(stateList);
        detailStateSelector.setVisible(true);
        otherState.setVisible(false);//from   ww w  .  ja v a  2s. c  om
        //ARK-748 
        //Ignore the new Address objects from state validation and hide the other state validation label
        if (getModelObject().getAddress().getId() != null && otherState.getModelObject() != null
                && !otherState.getModelObject().isEmpty()) {
            //alert the user
            otherStateInvalidError = new Label("address.otherStateInvalidError",
                    "Previously uploaded value " + otherState.getModelObject() + " was invalid.");
            otherStateInvalidError.add(new Behavior() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 7964297415151363039L;

                @Override
                public void onComponentTag(Component component, ComponentTag tag) {
                    super.onComponentTag(component, tag);
                    tag.put("class", "fieldErrorMessage");//or something like ("style"; "color-red")
                }
            });
            wmcStateSelector.addOrReplace(otherStateInvalidError);
        } else {
            otherStateInvalidError.setVisible(false);
        }
    } else {
        // hide it
        detailStateSelector.setVisible(false);
        otherState.setVisible(true);
        otherStateInvalidError.setVisible(false);
    }
}

From source file:au.org.theark.study.web.component.contact.ContactContainerPanel.java

License:Open Source License

/**
 * //from w w  w .j  a v  a2  s. co  m
 * @param address
 */
private void updateDetailFormPrerender(Address address) {
    // Ensure we update the CountyStateChoices in DetailsForm
    // like what happens via DetailForm's updateStateChoices(..)
    List<State> stateList = iArkCommonService.getStates(address.getCountry());
    WebMarkupContainer wmcStateSelector = (WebMarkupContainer) arkCrudContainerVO.getDetailPanelFormContainer()
            .get(Constants.STATE_SELECTOR_WMC);
    DropDownChoice<State> detailStateSelector = (DropDownChoice<State>) wmcStateSelector
            .get("addressVo.address.state");
    Label otherStateInvalidError = (Label) wmcStateSelector.get("addressVo.address.otherStateInvalidError");
    TextField<String> otherState = (TextField<String>) wmcStateSelector.get("addressVo.address.otherState");

    if (stateList != null && stateList.size() > 0) {
        detailStateSelector.getChoices().clear();
        detailStateSelector.setChoices(stateList);
        detailStateSelector.setVisible(true);
        otherState.setVisible(false);
        //ARK-748 
        //Ignore the new Address objects from state validation and hide the other state validation label
        if (cpModel.getObject().getAddressVo().getAddress().getId() != null
                && otherState.getModelObject() != null && !otherState.getModelObject().isEmpty()) {
            //alert the user
            otherStateInvalidError = new Label("addressVo.address.otherStateInvalidError",
                    "Previously uploaded value " + otherState.getModelObject() + " was invalid.");
            otherStateInvalidError.add(new Behavior() {
                /**
                 * 
                 */
                private static final long serialVersionUID = 7964297415151363039L;

                @Override
                public void onComponentTag(Component component, ComponentTag tag) {
                    super.onComponentTag(component, tag);
                    tag.put("class", "fieldErrorMessage");//or something like ("style"; "color-red")
                }
            });
            wmcStateSelector.addOrReplace(otherStateInvalidError);
        } else {
            otherStateInvalidError.setVisible(false);
        }
    } else {
        // hide it
        detailStateSelector.setVisible(false);
        otherState.setVisible(true);
        otherStateInvalidError.setVisible(false);
    }
}

From source file:au.org.theark.study.web.component.contact.form.AddressDetailForm.java

License:Open Source License

/**
 * The MarkupContainer for The State DropDown control
 *//*  ww  w .  ja v a 2  s.c  o m*/
private void initialiseStateSelector() {
    stateSelector = new WebMarkupContainer("stateSelector");
    stateSelector.setOutputMarkupPlaceholderTag(true);
    // Get the value selected in Country
    Country selectedCountry = countryChoice.getModelObject();

    // If there is no country selected, back should default to current country and pull the states
    List<State> stateList = iArkCommonService.getStates(selectedCountry);
    ChoiceRenderer<State> defaultStateChoiceRenderer = new ChoiceRenderer<State>("name", Constants.ID);
    stateChoice = new DropDownChoice<State>("addressVo.address.state", stateList, defaultStateChoiceRenderer);
    // Add the Country State Dropdown into the WebMarkupContainer - countrySelector
    otherStateInvalidError = new Label("addressVo.address.otherStateInvalidError", "");
    otherStateInvalidError.setOutputMarkupPlaceholderTag(true);
    otherStateInvalidError.add(new Behavior() {
        private static final long serialVersionUID = -6756543741833275627L;

        @Override
        public void onComponentTag(Component component, ComponentTag tag) {
            super.onComponentTag(component, tag);
            tag.put("class", "fieldErrorMessage");//or something like ("style"; "color-red")
        }
    });

    stateSelector.add(stateChoice);
    stateSelector.add(otherState);
    stateSelector.add(otherStateInvalidError);

    if (stateList.size() > 0) {
        otherState.setVisible(false);
        stateChoice.setVisible(true);
    } else {
        otherState.setVisible(true);
        stateChoice.setVisible(false);
    }
}

From source file:biz.turnonline.ecosystem.origin.frontend.component.SearchPanel.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // GWT source attribute and locale meta tag rendering
    getPage().add(new GwtScriptAppender(GWT_SOURCE));

    // add configuration for rest service profile
    add(new Behavior() {
        @Override/* www  .  ja v  a2s.c  o  m*/
        public void renderHead(Component component, IHeaderResponse response) {
            String script = " var RestServiceProfile = {SEARCH_API_SERVICE_ROOT: '" + searchApiEndpointUrl
                    + "'}";
            response.render(JavaScriptContentHeaderItem.forScript(script, "SearchWidgetRestServiceProfile"));
        }
    });
}

From source file:biz.turnonline.ecosystem.origin.frontend.myaccount.page.MyAccountBasics.java

License:Apache License

public MyAccountBasics() {
    add(new FirebaseAppInit(firebaseConfig));

    final MyAccountModel accountModel = new MyAccountModel();
    final IModel<Map<String, Country>> countriesModel = new CountriesModel();

    setModel(accountModel);/*  ww w.jav a2  s .  c  o m*/

    // form
    Form<Account> form = new Form<Account>("form", accountModel) {
        private static final long serialVersionUID = -938924956863034465L;

        @Override
        protected void onSubmit() {
            Account account = getModelObject();
            send(getPage(), Broadcast.BREADTH, new AccountUpdateEvent(account));
        }
    };
    add(form);

    PropertyModel<Boolean> companyModel = new PropertyModel<>(accountModel, "company");
    form.add(new CompanyPersonSwitcher("isCompanyRadioGroup", companyModel));

    // account email fieldset
    form.add(new Label("email", new PropertyModel<>(accountModel, "email")));

    // company basic info
    final CompanyBasicInfo<Account> basicInfo = new CompanyBasicInfo<Account>("companyData", accountModel) {
        private static final long serialVersionUID = -2992960490517951459L;

        @Override
        protected DropDownChoice<LegalForm> provideLegalForm(String componentId) {
            LegalFormListModel choices = new LegalFormListModel();
            return new IndicatingAjaxDropDown<>(componentId,
                    new LegalFormCodeModel(accountModel, "legalForm", choices), choices,
                    new LegalFormRenderer());
        }

        @Override
        protected void onConfigure() {
            super.onConfigure();
            Account account = getModelObject();
            this.setVisible(account.getCompany());
        }
    };
    form.add(basicInfo);

    // company basic info panel behaviors
    basicInfo.addLegalForm(new OnChangeAjaxBehavior() {
        private static final long serialVersionUID = 6948210639258798921L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });

    basicInfo.addVatId(new Behavior() {
        private static final long serialVersionUID = 100053137512632023L;

        @Override
        public void onConfigure(Component component) {
            super.onConfigure(component);
            Account account = basicInfo.getModelObject();
            boolean visible;
            if (account == null || account.getBusiness() == null) {
                visible = true;
            } else {
                Boolean vatPayer = account.getBusiness().getVatPayer();
                visible = vatPayer == null ? Boolean.FALSE : vatPayer;
            }

            component.setVisible(visible);
        }
    });

    final TextField taxId = basicInfo.getTaxId();
    final TextField vatId = basicInfo.getVatId();
    final CheckBox vatPayer = basicInfo.getVatPayer();

    basicInfo.addVatPayer(new AjaxFormSubmitBehavior(OnChangeAjaxBehavior.EVENT_NAME) {
        private static final long serialVersionUID = -1238082494184937003L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            Account account = (Account) basicInfo.getDefaultModelObject();
            String rawTaxIdValue = taxId.getRawInput();
            AccountBusiness business = account.getBusiness();

            if (rawTaxIdValue != null && Strings.isEmpty(business == null ? null : business.getVatId())) {
                // VAT country prefix proposal
                String country = business == null ? "" : business.getDomicile();
                country = country.toUpperCase();
                //noinspection unchecked
                vatId.getModel().setObject(country + rawTaxIdValue);
            }

            // must be set manually as getDefaultProcessing() returns false
            vatPayer.setModelObject(!(business == null ? Boolean.FALSE : business.getVatPayer()));

            if (target != null) {
                target.add(vatId.getParent());
            }
        }

        @Override
        public boolean getDefaultProcessing() {
            return false;
        }
    });

    // personal data panel
    PersonalDataPanel<Account> personalData = new PersonalDataPanel<Account>("personalData", accountModel) {
        private static final long serialVersionUID = -2808922906891760016L;

        @Override
        protected void onConfigure() {
            super.onConfigure();
            Account account = getModelObject();
            this.setVisible(!account.getCompany());
        }
    };
    form.add(personalData);

    // personal address panel
    PersonalAddressPanel<Account> address = new PersonalAddressPanel<Account>("personalAddress", accountModel) {
        private static final long serialVersionUID = 3481146248010938807L;

        @Override
        protected DropDownChoice<Country> provideCountry(String componentId) {
            return new IndicatingAjaxDropDown<>(componentId,
                    new PersonalAddressCountryModel(accountModel, countriesModel), new CountryRenderer(),
                    countriesModel);
        }

        @Override
        protected void onConfigure() {
            super.onConfigure();
            Account account = getModelObject();
            this.setVisible(!account.getCompany());
        }
    };
    form.add(address);

    address.addCountry(new OnChangeAjaxBehavior() {
        private static final long serialVersionUID = -1016447969591778948L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });

    // company address panel
    CompanyAddressPanel<Account> companyAddress;
    companyAddress = new CompanyAddressPanel<Account>("companyAddress", accountModel, false, false) {
        private static final long serialVersionUID = -6760545061622186549L;

        @Override
        protected DropDownChoice<Country> provideCountry(String componentId) {
            return new IndicatingAjaxDropDown<>(componentId,
                    new CompanyDomicileModel(accountModel, countriesModel), new CountryRenderer(),
                    countriesModel);
        }

        @Override
        protected void onConfigure() {
            super.onConfigure();
            Account account = getModelObject();
            this.setVisible(account.getCompany());
        }
    };
    form.add(companyAddress);

    companyAddress.addCountry(new OnChangeAjaxBehavior() {
        private static final long serialVersionUID = -5476413125490349124L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });

    IModel<AccountPostalAddress> postalAddressModel = new PropertyModel<>(accountModel, "postalAddress");
    IModel<Boolean> hasAddress = new PropertyModel<>(accountModel, "hasPostalAddress");
    PostalAddressPanel<AccountPostalAddress> postalAddress;
    postalAddress = new PostalAddressPanel<AccountPostalAddress>("postal-address", postalAddressModel,
            hasAddress) {
        private static final long serialVersionUID = -930960688138308527L;

        @Override
        protected DropDownChoice<Country> provideCountry(String componentId) {
            return new IndicatingAjaxDropDown<>(componentId,
                    new PostalAddressCountryModel(accountModel, countriesModel), new CountryRenderer(),
                    countriesModel);
        }
    };
    form.add(postalAddress);

    postalAddress.addStreet(new OnChangeAjaxBehavior() {
        private static final long serialVersionUID = 4050800366443676166L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });

    PropertyModel<Object> billingContactModel = PropertyModel.of(accountModel, "billingContact");
    form.add(new SimplifiedContactFieldSet<>("contact", billingContactModel));
    // save button
    form.add(new IndicatingAjaxButton("save", new I18NResourceModel("button.save"), form));
}

From source file:biz.turnonline.ecosystem.origin.frontend.page.DecoratedPage.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // container for firebase javascripts - must be located in html at the bottom
    add(new HeaderResponseContainer("html-bottom-container", HTML_BOTTOM_FILTER_NAME));

    add(new Behavior() {
        @Override// ww w. ja v a 2s. c o  m
        public void renderHead(Component component, IHeaderResponse response) {
            response.render(CssHeaderItem.forUrl("https://fonts.googleapis.com/icon?family=Material+Icons"));
            response.render(CssHeaderItem.forUrl("/styles/turnonline.css"));
        }
    });
}

From source file:com.axway.ats.testexplorer.pages.model.ColumnsDialog.java

License:Apache License

@SuppressWarnings({ "rawtypes" })
public ColumnsDialog(String id, final DataGrid grid, List<TableColumn> columnDefinitions) {

    super(id);//from   w ww.j  av  a  2  s .  c  o m
    setOutputMarkupId(true);

    this.dbColumnDefinitions = columnDefinitions;

    DataView<TableColumn> table = new DataView<TableColumn>("headers",
            new ListDataProvider<TableColumn>(dbColumnDefinitions), 100) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final Item<TableColumn> item) {

            final TableColumn column = item.getModelObject();

            item.add(new CheckBox("visible", new PropertyModel<Boolean>(column, "visible")));
            item.add(new Label("columnName", new PropertyModel<String>(column, "columnName")));

            item.add(new AjaxEventBehavior("click") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onEvent(AjaxRequestTarget target) {

                    TableColumn tableColumn = (TableColumn) this.getComponent().getDefaultModelObject();
                    tableColumn.setVisible(!tableColumn.isVisible());

                    if (tableColumn.isVisible()) {
                        item.add(AttributeModifier.replace("class", "selected"));
                    } else {
                        item.add(AttributeModifier.replace("class", "notSelected"));
                    }
                    grid.getColumnState().setColumnVisibility(tableColumn.getColumnId(),
                            tableColumn.isVisible());
                    target.add(grid);
                    target.add(this.getComponent());

                    open(target);
                }
            });
            item.setOutputMarkupId(true);

            if (column.isVisible()) {
                item.add(AttributeModifier.replace("class", "selected"));
            } else {
                item.add(AttributeModifier.replace("class", "notSelected"));
            }
        }
    };
    add(table);

    final Form<Void> columnDefinitionsForm = new Form<Void>("columnDefinitionsForm");
    add(columnDefinitionsForm);

    AjaxSubmitLink saveButton = new AjaxSubmitLink("saveButton", columnDefinitionsForm) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {

            super.updateAjaxAttributes(attributes);
            AjaxCallListener ajaxCallListener = new AjaxCallListener();
            ajaxCallListener.onPrecondition("getTableColumnDefinitions(); ");
            attributes.getAjaxCallListeners().add(ajaxCallListener);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {

            String columnDefinitionsString = form.getRequest().getPostParameters()
                    .getParameterValue("columnDefinitions").toString();

            List<TableColumn> jsColDefinitions = asList(columnDefinitionsString);
            orderTableColumns(dbColumnDefinitions, jsColDefinitions);

            try {
                saveColumnDefinitionsToDb(jsColDefinitions);

                modifyDBColumnDefinitionList(jsColDefinitions);

            } catch (DatabaseAccessException dae) {
                throw new RuntimeException("Unable to save table Column definitions in db: "
                        + ((TestExplorerSession) Session.get()).getDbName(), dae);
            } catch (SQLException sqle) {
                throw new RuntimeException("Unable to save table Column definitions in db: "
                        + ((TestExplorerSession) Session.get()).getDbName(), sqle);
            }

            close(target);
        }
    };
    add(AttributeModifier.append("class", "runsTableColDialogDivWrapper"));
    columnDefinitionsForm.add(saveButton);

    add(new Behavior() {

        private static final long serialVersionUID = 1L;

        @Override
        public void renderHead(Component component, IHeaderResponse response) {

            if (autoAddToHeader()) {

                String script = "jQuery.fn.center=function(){" + "this.css(\"position\",\"absolute\");"
                        + "this.css(\"top\",(jQuery(window).height()-this.height())/2+jQuery(window).scrollTop()+\"px\");"
                        + "this.css(\"left\",(jQuery(window).width()-this.width())/2+jQuery(window).scrollLeft()+\"px\");"
                        + "return this};";

                String css = "#settingsoverlay,.settingsoverlay,#settingsoverlay_high,"
                        + ".settingsoverlay_high{filter:Alpha(Opacity=40);"
                        + "-moz-opacity:.4;opacity:.4;background-color:#444;display:none;position:absolute;"
                        + "left:0;top:0;width:100%;height:100%;text-align:center;z-index:5000;}"
                        + "#settingsoverlay_high,.settingsoverlay_high{z-index:6000;}"
                        + "#settingsoverlaycontent,#settingsoverlaycontent_high{display:none;z-index:5500;"
                        + "text-align:center;}.settingsoverlaycontent,"
                        + ".settingsoverlaycontent_high{display:none;z-index:5500;text-align:left;}"
                        + "#settingsoverlaycontent_high,.settingsoverlaycontent_high{z-index:6500;}"
                        + "#settingsoverlaycontent .modalborder,"
                        + "#settingsoverlaycontent_high .modalborder{padding:15px;width:300px;"
                        + "border:1px solid #444;background-color:white;"
                        + "-webkit-box-shadow:0 0 10px rgba(0,0,0,0.8);-moz-box-shadow:0 0 10px rgba(0,0,0,0.8);"
                        + "box-shadow:0 0 10px rgba(0,0,0,0.8);"
                        + "filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5,OffY=5,Color='gray');"
                        + "-ms-filter:\"progid:DXImageTransform.Microsoft.dropshadow(OffX=5,OffY=5,Color='gray')\";}";

                response.render(JavaScriptHeaderItem.forScript(script, null));
                response.render(CssHeaderItem.forCSS(css, null));
                if (isSupportIE6()) {
                    response.render(JavaScriptHeaderItem
                            .forReference(new PackageResourceReference(getClass(), "jquery.bgiframe.js")));
                }
            }

            response.render(OnDomReadyHeaderItem.forScript(getJS()));
        }

        private String getJS() {

            StringBuilder sb = new StringBuilder();
            sb.append("if (jQuery('#").append(getDivId())
                    .append("').length == 0) { jQuery(document.body).append('")
                    .append(getDiv().replace("'", "\\'")).append("'); }");
            return sb.toString();
        }

        private String getDivId() {

            return getMarkupId() + "_ovl";
        }

        private String getDiv() {

            if (isClickBkgToClose()) {
                return ("<div id=\"" + getDivId() + "\" class=\"settingsoverlayCD\" onclick=\""
                        + getCloseString() + "\"></div>");
            } else {
                return ("<div id=\"" + getDivId() + "\" class=\"settingsoverlayCD\"></div>");
            }
        }
    });

}