All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.netbeans.modules.welcome.ui.Links Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) 2008-2012 AgroSense Foundation.
 *
 * AgroSense 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.
 *
 * There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
 * this software, see the FLOSS License Exception
 * .
 *
 * AgroSense 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 AgroSense.  If not, see .
 */
package org.netbeans.modules.welcome.ui;

import java.util.List;
import javax.swing.Action;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import org.netbeans.modules.welcome.content.ActionLink;
import org.netbeans.modules.welcome.content.Constants;
import org.netbeans.modules.welcome.content.WebLink;
import org.openide.loaders.DataObject;
import org.openide.util.NbBundle;

/**
 * Content section for links
 *
 * @author Merijn Zengers
 */
@NbBundle.Messages({"LBL Links online userguide=Userguide",
    "URL Links online userguide=http://help.agrosense.nl",
    "LBL Links online website=Our website",
    "URL Links online website=http://agrosense.nl"})
public final class Links extends JPanel {

    private ActionBuilder builder = new ActionBuilder();
    private static final String ROOT_STRING = "LinkPage";
    
    public Links() {
        super(new MigLayout("wrap"));
        setOpaque(false);
        buildContent();
    }

    private void buildContent() {
        List dataObjects = builder.getDataObjects(ROOT_STRING);
        for (DataObject dataObject : dataObjects) {
            Action action = builder.extractAction(dataObject);
        
            ActionLink link = new ActionLink(action.getValue(Action.NAME).toString(), action, Constants.COLOR_SECTION_HEADER, false); //NOI18N
            add(link);
        }
        WebLink website = new WebLink(Bundle.LBL_Links_online_website(), Bundle.URL_Links_online_website(), Constants.COLOR_SECTION_HEADER, false); //NOI18N
        add(website);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy