Example usage for org.apache.wicket Component Component

List of usage examples for org.apache.wicket Component Component

Introduction

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

Prototype

public Component(final String id) 

Source Link

Document

Constructor.

Usage

From source file:com.francetelecom.clara.cloud.presentation.tools.BusinessExceptionHandlerTest.java

License:Apache License

@Before
public void setup() {
    // Create an application without spring init
    PaasTestApplication app = new PaasTestApplication() {
        @Override//from  ww  w. j av  a  2  s.com
        public void init() {
        }
    };

    tester = new PaasWicketTester(new PaasTestApplication(getApplicationContextMock(), false));
    ((PaasTestSession) tester.getSession()).setPaasUser(CreateObjectsWithJava.createPaasUserMock(cuid, role));

    // Dummy Component used for test
    testComponent = new Component("test") {

        @Override
        protected void onRender() {
        }
    };

    // Start component
    tester.startComponentInPage(testComponent);

    // Configure our SUT 
    sut = new BusinessExceptionHandler(testComponent);
}

From source file:nl.ru.cmbi.vase.web.panel.align.StructurePanel.java

License:Apache License

public StructurePanel(String id, final String structurePath, final VASEDataObject data) {

    super(id);// ww  w  .j av a  2 s .  co  m

    String urlString = RequestCycle.get().urlFor(HomePage.class, new PageParameters()).toString();

    //WebMarkupContainer applet = new WebMarkupContainer("applet");
    //applet.add(new AttributeModifier("codebase",urlString));
    //add(applet);

    final boolean oneChain = Character.isLetter(data.getAlignment().getChainID())
            || Character.isDigit(data.getAlignment().getChainID());

    Component script = new Component("init-script") {

        @Override
        protected void onRender() {

            JavaScriptUtils.writeOpenTag(getResponse());

            getResponse().write("var jmolSelectableAtomColor=\"[126, 193, 255]\";\n");

            getResponse().write("var jmolClearColors=\"");

            if (oneChain) {

                getResponse().write("select :" + data.getAlignment().getChainID() + " and Protein;");
                getResponse().write("color \"+ jmolSelectableAtomColor +\";");
            } else {

                for (Object res : data.getTable().getColumnValues(TableData.pdbResidueID)) {

                    String resString = res.toString().trim();
                    if (resString.isEmpty()) {

                        continue;
                    }

                    getResponse().write("select " + resString + "; color \"+ jmolSelectableAtomColor +\";");
                }
            }

            getResponse().write("\";\n");

            getResponse().write("var jmolInit=\"");

            getResponse().write("background white;");
            getResponse().write("load " + structurePath + ";");
            getResponse().write("select *;");
            getResponse().write("color atoms lightgrey structure;");

            getResponse().write("\" + jmolClearColors;\n");

            JavaScriptUtils.writeCloseTag(getResponse());
        }
    };
    add(script);
}