r438 - in trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing: action flight
Author: tchemit Date: 2012-08-19 16:47:01 +0200 (Sun, 19 Aug 2012) New Revision: 438 Url: http://forge.codelutin.com/repositories/revision/sammoa/438 Log: remove deprecated class + still remove some not necessary public api :( Removed: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/action/ActionDef.java Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightBarHandler.java trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java Deleted: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/action/ActionDef.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/action/ActionDef.java 2012-08-19 14:44:55 UTC (rev 437) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/action/ActionDef.java 2012-08-19 14:47:01 UTC (rev 438) @@ -1,120 +0,0 @@ -/* - * #%L - * SAMMOA :: UI Swing - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 UMS 3462, Code Lutin - * %% - * 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% - */ -package fr.ulr.sammoa.ui.swing.action; - -import com.google.common.base.Predicate; -import com.google.common.base.Throwables; -import com.google.common.collect.Iterables; -import fr.ulr.sammoa.ui.swing.SammoaUIContext; - -import javax.swing.Action; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; -import java.util.List; - -/** - * Created: 03/07/12 - * - * @author fdesbois <desbois@codelutin.com> - */ -@Deprecated -public enum ActionDef { - - START(StartAction.class, true), - - STOP(StopAction.class, true), - - BEGIN(BeginAction.class, true), - - END(EndAction.class, true), - - NEXT(NextAction.class, true), - - NEXT_TRANSECT(NextTransectAction.class, true), - - ADD(AddAction.class, false), - - LEFT_OBSERVATION(LeftObservationAction.class, false), - - CENTER_OBSERVATION(CenterObservationAction.class, false), - - RIGHT_OBSERVATION(RightObservationAction.class, false), - - CIRCLE_BACK(CircleBackAction.class, false); - - private Class<? extends SammoaAction> actionClass; - - private boolean flyModeOnly; - - ActionDef(Class<? extends SammoaAction> actionClass, - boolean flyModeOnly) { - - this.actionClass = actionClass; - this.flyModeOnly = flyModeOnly; - } - - public boolean isFlyModeOnly() { - return flyModeOnly; - } - - public Class<? extends SammoaAction> getActionClass() { - return actionClass; - } - - public Action newAction(SammoaUIContext context) { - SammoaAction result; - try { - Constructor<? extends SammoaAction> constructor = - actionClass.getConstructor(SammoaUIContext.class); - - result = constructor.newInstance(context); - - } catch (InstantiationException e) { - throw Throwables.propagate(e); - } catch (IllegalAccessException e) { - throw Throwables.propagate(e); - } catch (NoSuchMethodException e) { - throw Throwables.propagate(e); - } catch (InvocationTargetException e) { - throw Throwables.propagate(e); - } - return result; - } - - public static Iterable<ActionDef> values(boolean flyMode) { - List<ActionDef> list = Arrays.asList(values()); - return Iterables.filter(list, isAvailable(flyMode)); - } - - public static Predicate<ActionDef> isAvailable(final boolean flyMode) { - return new Predicate<ActionDef>() { - - @Override - public boolean apply(ActionDef input) { - return !input.isFlyModeOnly() || (input.isFlyModeOnly() && flyMode); - } - }; - } -} Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightBarHandler.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightBarHandler.java 2012-08-19 14:44:55 UTC (rev 437) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightBarHandler.java 2012-08-19 14:47:01 UTC (rev 438) @@ -48,7 +48,7 @@ this.view = view; } - public FlightBarModel getModel() { + protected FlightBarModel getModel() { return view.getModel(); } @@ -57,19 +57,17 @@ return SammoaUIContext.getUIContext().getFlightUIHandler().getModel(); } - @Deprecated - public FlightController getFlightController() { - return SammoaUIContext.getUIContext().getFlightUIHandler().getFlightController(); - } - public void init() { + getFlightUIModel().addPropertyChangeListener(this); - AudioRecorder audioRecorder = getFlightController().getAudioRecorder(); + FlightController flightController = + SammoaUIContext.getUIContext().getFlightUIHandler().getFlightController(); + AudioRecorder audioRecorder = flightController.getAudioRecorder(); view.getAudioLED().setState(audioRecorder.getState()); audioRecorder.addDeviceStateListener(view.getAudioLED()); - GpsHandler gpsHandler = getFlightController().getGpsHandler(); + GpsHandler gpsHandler = flightController.getGpsHandler(); view.getGpsLED().setState(gpsHandler.getState()); gpsHandler.addDeviceStateListener(view.getGpsLED()); gpsHandler.addGpsLocationListener(getModel()); Modified: trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java =================================================================== --- trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java 2012-08-19 14:44:55 UTC (rev 437) +++ trunk/sammoa-ui-swing/src/main/java/fr/ulr/sammoa/ui/swing/flight/FlightUIHandler.java 2012-08-19 14:47:01 UTC (rev 438) @@ -163,8 +163,8 @@ this.ui = ui; ui.setContextValue(context); - flightService = context.newService(FlightService.class); - referentialService = context.newService(ReferentialService.class); + this.flightService = context.newService(FlightService.class); + this.referentialService = context.newService(ReferentialService.class); } public FlightController getFlightController() {
participants (1)
-
tchemit@users.forge.codelutin.com