io.ucoin.ucoinj.web.pages.registry.CurrencyPage.java Source code

Java tutorial

Introduction

Here is the source code for io.ucoin.ucoinj.web.pages.registry.CurrencyPage.java

Source

package io.ucoin.ucoinj.web.pages.registry;

/*
 * #%L
 * UCoin Java Client :: Web
 * %%
 * Copyright (C) 2014 - 2015 EIS
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 * #L%
 */

import io.ucoin.ucoinj.core.client.model.elasticsearch.Currency;
import io.ucoin.ucoinj.elasticsearch.service.ServiceLocator;
import io.ucoin.ucoinj.web.pages.BasePage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.StringValue;

public class CurrencyPage extends BasePage {

    public final static String CURRENCY_PARAMETER = "currencyName";

    public CurrencyPage(final PageParameters parameters) {
        super(parameters);

        StringValue parameCurrencyName = parameters.get(CURRENCY_PARAMETER);
        final String currencyName = parameCurrencyName.toString();

        setDefaultModel(new CompoundPropertyModel<Currency>(new LoadableDetachableModel<Currency>() {
            @Override
            protected Currency load() {
                return ServiceLocator.instance().getCurrencyIndexerService().getCurrencyById(currencyName);
            }
        }));

        add(new Label("currencyName"));

        //add(new Label("memberCount"));
    }
}