fi.racetrace.adminpanel.ui.columngenerator.CustomerLinkGC.java Source code

Java tutorial

Introduction

Here is the source code for fi.racetrace.adminpanel.ui.columngenerator.CustomerLinkGC.java

Source

/*
 *  This file is part of RaceTrace-Adminpanel
 *  Copyright (C) 2012 Vaadin Oy
 *  Copyright (C) 2013 Jonni Nakari <jonni@egarden.fi>
    
 *  RaceTrace-Adminpanel is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
    
 *  RaceTrace-Adminpanel 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 Affero General Public License for more details.
    
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package fi.racetrace.adminpanel.ui.columngenerator;

import com.vaadin.server.ExternalResource;
import com.vaadin.ui.Link;
import com.vaadin.ui.Table;
import com.vaadin.ui.Table.ColumnGenerator;

import fi.racetrace.adminpanel.data.Customer;
import fi.racetrace.adminpanel.ui.CustomerDetails;

public class CustomerLinkGC implements ColumnGenerator {

    @Override
    public Object generateCell(Table source, Object itemId, Object columnId) {

        Link lnk = new Link("Show details",
                new ExternalResource("#!" + CustomerDetails.NAME + "/" + ((Customer) itemId).getId()));
        return lnk;
    }

}