eu.agrosense.client.agent.impl.NewAgentAction Maven / Gradle / Ivy
The newest version!
/**
* Copyright (C) 2008-2013 LimeTri. All rights reserved.
*
* 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 eu.agrosense.client.agent.impl;
import eu.agrosense.api.session.Connection;
import eu.agrosense.api.session.Connections;
import eu.agrosense.client.model.NewActionHelper;
import eu.agrosense.client.util.javafx.CrudPanel;
import eu.agrosense.shared.model.Agent;
import eu.agrosense.shared.model.AgroURI;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Icon;
import org.opendolphin.core.PresentationModel;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
/**
*
* @author johan
*/
@NbBundle.Messages("new agent action name=New agent")
public class NewAgentAction extends AbstractAction {
private static final Icon ICON = ImageUtilities.loadImageIcon("eu/agrosense/client/agent/agent.png", true);
private final AgroURI farmURI;
public NewAgentAction(AgroURI farmURI) {
super(Bundle.new_agent_action_name(), ICON);
this.farmURI = farmURI;
}
@Override
public void actionPerformed(ActionEvent e) {
Connection service = Connections.get();
PresentationModel model = service.presentationModel(farmURI.toString(),Agent.ITEM_ID_TYPE);
CrudPanel newAgentView = AgentPane.createEmbedded(model);
NewActionHelper.showAndHandleDialog(newAgentView, Bundle.new_agent_action_name(), model, service);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy