mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 15:12:28 +00:00
Merge branch 'main' of https://github.com/PAMGuard/PAMGuard
This commit is contained in:
commit
1739bd66b2
@ -76,6 +76,9 @@ public class MarkOverlayDraw extends PanelOverlayDraw {
|
|||||||
hoverData.setTransformShape(t);
|
hoverData.setTransformShape(t);
|
||||||
generalProjector.addHoverData(t, pamDataUnit);
|
generalProjector.addHoverData(t, pamDataUnit);
|
||||||
}
|
}
|
||||||
|
if (drawnShape == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return drawnShape.getBounds();
|
return drawnShape.getBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,52 +146,60 @@ public class MarkOverlayDraw extends PanelOverlayDraw {
|
|||||||
* To allow for things like the rotated map which no longer show rectangles as
|
* To allow for things like the rotated map which no longer show rectangles as
|
||||||
* rectangles, we now need to draw rectangles are irregular polygons too !
|
* rectangles, we now need to draw rectangles are irregular polygons too !
|
||||||
*/
|
*/
|
||||||
int[] x = new int[4];
|
try {
|
||||||
int[] y = new int[4];
|
int[] x = new int[4];
|
||||||
PamCoordinate m0 = mark.getCoordinate(0);
|
int[] y = new int[4];
|
||||||
PamCoordinate m1 = mark.getCoordinate(1);
|
PamCoordinate m0 = mark.getCoordinate(0);
|
||||||
Point p;
|
PamCoordinate m1 = mark.getCoordinate(1);
|
||||||
p = generalProjector.getCoord3d(m0.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
if (m0 == null || m1 == null) {
|
||||||
x[0] = p.x;
|
return null;
|
||||||
y[0] = p.y;
|
}
|
||||||
p = generalProjector.getCoord3d(m0.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
Point p;
|
||||||
x[1] = p.x;
|
p = generalProjector.getCoord3d(m0.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
||||||
y[1] = p.y;
|
x[0] = p.x;
|
||||||
p = generalProjector.getCoord3d(m1.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
y[0] = p.y;
|
||||||
x[2] = p.x;
|
p = generalProjector.getCoord3d(m0.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
||||||
y[2] = p.y;
|
x[1] = p.x;
|
||||||
p = generalProjector.getCoord3d(m1.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
y[1] = p.y;
|
||||||
x[3] = p.x;
|
p = generalProjector.getCoord3d(m1.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
||||||
y[3] = p.y;
|
x[2] = p.x;
|
||||||
Polygon pgon = new Polygon(x, y, 4);
|
y[2] = p.y;
|
||||||
Color fillCol = getFillCol();
|
p = generalProjector.getCoord3d(m1.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
||||||
if (fillCol != null) {
|
x[3] = p.x;
|
||||||
g2d.setColor(getFillCol());
|
y[3] = p.y;
|
||||||
g2d.fillPolygon(pgon);
|
Polygon pgon = new Polygon(x, y, 4);
|
||||||
|
Color fillCol = getFillCol();
|
||||||
|
if (fillCol != null) {
|
||||||
|
g2d.setColor(getFillCol());
|
||||||
|
g2d.fillPolygon(pgon);
|
||||||
|
}
|
||||||
|
return pgon;
|
||||||
}
|
}
|
||||||
return pgon;
|
catch (NullPointerException e) {
|
||||||
|
return null;
|
||||||
//
|
}
|
||||||
// Point p0 = generalProjector.getCoord3d(m0).getXYPoint();
|
|
||||||
// Point p1 = generalProjector.getCoord3d(m1).getXYPoint();
|
//
|
||||||
// g2d.setColor(getLineCol());
|
// Point p0 = generalProjector.getCoord3d(m0).getXYPoint();
|
||||||
// g2d.setStroke(getLineStroke());
|
// Point p1 = generalProjector.getCoord3d(m1).getXYPoint();
|
||||||
// g2d.drawLine(p0.x, p0.y, p1.x, p0.y);
|
// g2d.setColor(getLineCol());
|
||||||
// g2d.drawLine(p1.x, p0.y, p1.x, p1.y);
|
// g2d.setStroke(getLineStroke());
|
||||||
// g2d.drawLine(p1.x, p1.y, p0.x, p1.y);
|
// g2d.drawLine(p0.x, p0.y, p1.x, p0.y);
|
||||||
// g2d.drawLine(p0.x, p1.y, p0.x, p0.y);
|
// g2d.drawLine(p1.x, p0.y, p1.x, p1.y);
|
||||||
// int x = Math.min(p0.x, p1.x);
|
// g2d.drawLine(p1.x, p1.y, p0.x, p1.y);
|
||||||
// int y = Math.min(p0.y, p1.y);
|
// g2d.drawLine(p0.x, p1.y, p0.x, p0.y);
|
||||||
// int w = Math.abs(p0.x - p1.x);
|
// int x = Math.min(p0.x, p1.x);
|
||||||
// int h = Math.abs(p0.y - p1.y);
|
// int y = Math.min(p0.y, p1.y);
|
||||||
//
|
// int w = Math.abs(p0.x - p1.x);
|
||||||
// Color fillCol = getFillCol();
|
// int h = Math.abs(p0.y - p1.y);
|
||||||
// if (fillCol != null) {
|
//
|
||||||
// g2d.setColor(getFillCol());
|
// Color fillCol = getFillCol();
|
||||||
// g2d.fillRect(x, y, w, h);
|
// if (fillCol != null) {
|
||||||
// }
|
// g2d.setColor(getFillCol());
|
||||||
// Rectangle r = new Rectangle(x, y, w, h);
|
// g2d.fillRect(x, y, w, h);
|
||||||
// return r;
|
// }
|
||||||
|
// Rectangle r = new Rectangle(x, y, w, h);
|
||||||
|
// return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -223,7 +234,7 @@ public class MarkOverlayDraw extends PanelOverlayDraw {
|
|||||||
public Stroke getLineStroke() {
|
public Stroke getLineStroke() {
|
||||||
return plainStroke ;
|
return plainStroke ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stroke getFinalLineStroke() {
|
public Stroke getFinalLineStroke() {
|
||||||
return dashed;
|
return dashed;
|
||||||
}
|
}
|
||||||
|
@ -232,6 +232,9 @@ public class OverlayMark {
|
|||||||
}
|
}
|
||||||
PamCoordinate c0 = projector.getCoord3d(coordinates.get(0));
|
PamCoordinate c0 = projector.getCoord3d(coordinates.get(0));
|
||||||
PamCoordinate c1 = projector.getCoord3d(coordinates.get(1));
|
PamCoordinate c1 = projector.getCoord3d(coordinates.get(1));
|
||||||
|
if (c0 == null || c1 == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
double x = Math.min(c0.getCoordinate(0), c1.getCoordinate(0));
|
double x = Math.min(c0.getCoordinate(0), c1.getCoordinate(0));
|
||||||
double y = Math.min(c0.getCoordinate(1), c1.getCoordinate(1));
|
double y = Math.min(c0.getCoordinate(1), c1.getCoordinate(1));
|
||||||
double w = Math.abs(c0.getCoordinate(0) - c1.getCoordinate(0));
|
double w = Math.abs(c0.getCoordinate(0) - c1.getCoordinate(0));
|
||||||
|
@ -289,11 +289,11 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
|||||||
|
|
||||||
// System.out.println("No. count: " + count);
|
// System.out.println("No. count: " + count);
|
||||||
currentParams.classifier = new int[count];
|
currentParams.classifier = new int[count];
|
||||||
|
ArrayList<CTClassifier> classifiers = ctDataSelector.getClickControl().getClassifierManager().getCurrentClassifiers();
|
||||||
int used = 0;
|
int used = 0;
|
||||||
ArrayList<CTClassifier> currentClassifiers = ctDataSelector.getClickControl().getClassifierManager().getCurrentClassifiers();
|
|
||||||
for (int i=0; i<classifierCheckBoxes.length; i++) {
|
for (int i=0; i<classifierCheckBoxes.length; i++) {
|
||||||
if (classifierCheckBoxes[i].isSelected()) {
|
if (classifierCheckBoxes[i].isSelected()) {
|
||||||
currentParams.classifier[used++] = currentClassifiers.get(i).getSpeciesID();
|
currentParams.classifier[used++] = classifiers.get(i).getSpeciesID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.swing.JCheckBoxMenuItem;
|
import javax.swing.JCheckBoxMenuItem;
|
||||||
@ -18,14 +19,18 @@ import PamController.PamController;
|
|||||||
import PamController.PamSettingManager;
|
import PamController.PamSettingManager;
|
||||||
import PamController.PamSettings;
|
import PamController.PamSettings;
|
||||||
import PamUtils.PamCalendar;
|
import PamUtils.PamCalendar;
|
||||||
|
import PamView.PamSidePanel;
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
import PamguardMVC.PamProcess;
|
import PamguardMVC.PamProcess;
|
||||||
import PamguardMVC.debug.Debug;
|
import PamguardMVC.debug.Debug;
|
||||||
import effortmonitor.swing.EffortDataMapGraph;
|
import effortmonitor.swing.EffortDataMapGraph;
|
||||||
import effortmonitor.swing.EffortDialog;
|
import effortmonitor.swing.EffortDialog;
|
||||||
import effortmonitor.swing.EffortDisplayProvider;
|
import effortmonitor.swing.EffortDisplayProvider;
|
||||||
|
import effortmonitor.swing.EffortSidePanel;
|
||||||
import pamScrollSystem.AbstractPamScroller;
|
import pamScrollSystem.AbstractPamScroller;
|
||||||
import pamScrollSystem.AbstractScrollManager;
|
import pamScrollSystem.AbstractScrollManager;
|
||||||
|
import pamScrollSystem.PamScroller;
|
||||||
|
import pamScrollSystem.PamScrollerData;
|
||||||
import userDisplay.UserDisplayControl;
|
import userDisplay.UserDisplayControl;
|
||||||
|
|
||||||
public class EffortControl extends PamControlledUnit implements PamSettings{
|
public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||||
@ -42,6 +47,10 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
|
|
||||||
private EffortDataMapGraph dataMapGraph;
|
private EffortDataMapGraph dataMapGraph;
|
||||||
|
|
||||||
|
private HashMap<AbstractPamScroller, PamScrollerData> lastOuterStarts = new HashMap<>();
|
||||||
|
|
||||||
|
private EffortSidePanel effortSidePanel;
|
||||||
|
|
||||||
public EffortControl(String unitName) {
|
public EffortControl(String unitName) {
|
||||||
super("unitType", unitName);
|
super("unitType", unitName);
|
||||||
EffortProcess effortProc = new EffortProcess();
|
EffortProcess effortProc = new EffortProcess();
|
||||||
@ -50,12 +59,22 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
effortProc.addOutputDataBlock(effortDataBlock);
|
effortProc.addOutputDataBlock(effortDataBlock);
|
||||||
effortDataBlock.SetLogging(new EffortLogging(this, effortDataBlock));
|
effortDataBlock.SetLogging(new EffortLogging(this, effortDataBlock));
|
||||||
dataMapGraph = new EffortDataMapGraph(this);
|
dataMapGraph = new EffortDataMapGraph(this);
|
||||||
|
|
||||||
|
// PamScroller
|
||||||
|
|
||||||
UserDisplayControl.addUserDisplayProvider(new EffortDisplayProvider(this));
|
UserDisplayControl.addUserDisplayProvider(new EffortDisplayProvider(this));
|
||||||
|
|
||||||
PamSettingManager.getInstance().registerSettings(this);
|
PamSettingManager.getInstance().registerSettings(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PamSidePanel getSidePanel() {
|
||||||
|
if (effortSidePanel == null) {
|
||||||
|
effortSidePanel = new EffortSidePanel(this);
|
||||||
|
}
|
||||||
|
return effortSidePanel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyModelChanged(int changeType) {
|
public void notifyModelChanged(int changeType) {
|
||||||
super.notifyModelChanged(changeType);
|
super.notifyModelChanged(changeType);
|
||||||
@ -65,6 +84,10 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
break;
|
break;
|
||||||
case PamController.NEW_SCROLL_TIME:
|
case PamController.NEW_SCROLL_TIME:
|
||||||
updateScrollerInfo();
|
updateScrollerInfo();
|
||||||
|
break;
|
||||||
|
case PamController.DATA_LOAD_COMPLETE:
|
||||||
|
updateScrollerInfo();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +125,25 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean newOuter = isNewOuter(scroller);
|
||||||
|
if (effortParams.outserScrollOnly) {
|
||||||
|
if (newOuter) {
|
||||||
|
logOuterScroll(scroller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logInnerScroll(scroller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logOuterScroll(AbstractPamScroller scroller) {
|
||||||
|
EffortDataUnit effortData = new EffortDataUnit(scroller, effortParams.getObserver(), effortParams.getObjective());
|
||||||
|
effortData.setOuterLimits();
|
||||||
|
effortDataBlock.addPamData(effortData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logInnerScroll(AbstractPamScroller scroller) {
|
||||||
// checkObserverName();
|
// checkObserverName();
|
||||||
|
|
||||||
EffortDataUnit effortData = effortDataBlock.findActiveUnit(scroller);
|
EffortDataUnit effortData = effortDataBlock.findActiveUnit(scroller);
|
||||||
@ -129,6 +170,38 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the outer scroll moved.
|
||||||
|
* @param scroller
|
||||||
|
* @return true if the outer has moved.
|
||||||
|
*/
|
||||||
|
private boolean isNewOuter(AbstractPamScroller scroller) {
|
||||||
|
PamScrollerData lastData = lastOuterStarts.get(scroller);
|
||||||
|
PamScrollerData nowVal = scroller.getScrollerData();
|
||||||
|
if (nowVal == null) {
|
||||||
|
return false; // shouldn't happen !
|
||||||
|
}
|
||||||
|
boolean changed = isChanged(lastData, nowVal);
|
||||||
|
if (changed) {
|
||||||
|
lastOuterStarts.put(scroller, nowVal.clone());
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isChanged(PamScrollerData lastData, PamScrollerData nowVal) {
|
||||||
|
if (lastData == null || nowVal == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lastData.getMinimumMillis() != nowVal.getMinimumMillis()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lastData.getMaximumMillis() != nowVal.getMaximumMillis()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick and dirty to get observer name.
|
* Quick and dirty to get observer name.
|
||||||
*/
|
*/
|
||||||
@ -203,9 +276,11 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
existingUnit.setObserver(newParams.getObserver());
|
existingUnit.setObserver(newParams.getObserver());
|
||||||
existingUnit.setObjective(newParams.getObjective());
|
existingUnit.setObjective(newParams.getObjective());
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
if (effortSidePanel != null) {
|
||||||
|
effortSidePanel.updateSettings();
|
||||||
|
}
|
||||||
|
return newParams!=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void goToTime(AbstractPamScroller scroller, long timeInMilliseconds) {
|
public void goToTime(AbstractPamScroller scroller, long timeInMilliseconds) {
|
||||||
@ -235,6 +310,9 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
|||||||
@Override
|
@Override
|
||||||
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
|
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
|
||||||
effortParams = ((EffortParams) pamControlledUnitSettings.getSettings());
|
effortParams = ((EffortParams) pamControlledUnitSettings.getSettings());
|
||||||
|
if (effortSidePanel != null) {
|
||||||
|
effortSidePanel.updateSettings();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public class EffortDataUnit extends PamDataUnit {
|
|||||||
getBasicData().setEndTime(scroller.getValueMillis()+scroller.getVisibleAmount());
|
getBasicData().setEndTime(scroller.getValueMillis()+scroller.getVisibleAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor to use when reloading from database.
|
* Constructor to use when reloading from database.
|
||||||
* @param databaseIndex
|
* @param databaseIndex
|
||||||
@ -210,4 +211,13 @@ public class EffortDataUnit extends PamDataUnit {
|
|||||||
return runMode;
|
return runMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the limits as the outer limits of the scroller.
|
||||||
|
*/
|
||||||
|
public void setOuterLimits() {
|
||||||
|
setTimeMilliseconds(scroller.getMinimumMillis());
|
||||||
|
getBasicData().setEndTime(scroller.getMaximumMillis());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,11 @@ public class EffortParams implements Cloneable, Serializable, ManagedParameters
|
|||||||
|
|
||||||
public transient boolean isSet;
|
public transient boolean isSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only log outer scroll events when paging forwards, not every little movement.
|
||||||
|
*/
|
||||||
|
public boolean outserScrollOnly = false;
|
||||||
|
|
||||||
private static final int MAX_OBSERVERS = 10;
|
private static final int MAX_OBSERVERS = 10;
|
||||||
private static final int MAX_OBJECTIVES = 10;
|
private static final int MAX_OBJECTIVES = 10;
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
import javax.swing.ButtonGroup;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JRadioButton;
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
|
|
||||||
import PamView.DBTextArea;
|
import PamView.DBTextArea;
|
||||||
@ -29,6 +31,7 @@ public class EffortDialog extends PamDialog {
|
|||||||
private JComboBox<String> observer;
|
private JComboBox<String> observer;
|
||||||
private JComboBox<String> oldObjectives;
|
private JComboBox<String> oldObjectives;
|
||||||
private DBTextArea objective;
|
private DBTextArea objective;
|
||||||
|
private JRadioButton outerOnly, allActions;
|
||||||
|
|
||||||
private EffortDialog(Window parentFrame, EffortControl effortControl) {
|
private EffortDialog(Window parentFrame, EffortControl effortControl) {
|
||||||
super(parentFrame, effortControl.getUnitName(), false);
|
super(parentFrame, effortControl.getUnitName(), false);
|
||||||
@ -40,6 +43,18 @@ public class EffortDialog extends PamDialog {
|
|||||||
mainPanel.add(new JLabel("Observer name or initials"), c);
|
mainPanel.add(new JLabel("Observer name or initials"), c);
|
||||||
c.gridx++;
|
c.gridx++;
|
||||||
mainPanel.add(observer = new JComboBox<String>(), c);
|
mainPanel.add(observer = new JComboBox<String>(), c);
|
||||||
|
outerOnly = new JRadioButton("Log uter scroll only");
|
||||||
|
allActions = new JRadioButton("Log all scroll actions");
|
||||||
|
ButtonGroup bg = new ButtonGroup();
|
||||||
|
bg.add(allActions);
|
||||||
|
bg.add(outerOnly);
|
||||||
|
c.gridx = 0;
|
||||||
|
c.gridy++;
|
||||||
|
c.gridwidth = 1;
|
||||||
|
mainPanel.add(allActions, c);
|
||||||
|
c.gridx+=c.gridwidth;
|
||||||
|
mainPanel.add(outerOnly, c);
|
||||||
|
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy++;
|
c.gridy++;
|
||||||
c.gridwidth = 2;
|
c.gridwidth = 2;
|
||||||
@ -80,6 +95,8 @@ public class EffortDialog extends PamDialog {
|
|||||||
for (String obs : oldObs) {
|
for (String obs : oldObs) {
|
||||||
observer.addItem(obs);
|
observer.addItem(obs);
|
||||||
}
|
}
|
||||||
|
allActions.setSelected(effortParams.outserScrollOnly == false);
|
||||||
|
outerOnly.setSelected(effortParams.outserScrollOnly);
|
||||||
oldObjectives.removeAllItems();
|
oldObjectives.removeAllItems();
|
||||||
oldObjectives.addItem("");
|
oldObjectives.addItem("");
|
||||||
for (String obj : effortParams.getRecentObjectives()) {
|
for (String obj : effortParams.getRecentObjectives()) {
|
||||||
@ -100,6 +117,7 @@ public class EffortDialog extends PamDialog {
|
|||||||
if (obs == null || obs.length() == 0) {
|
if (obs == null || obs.length() == 0) {
|
||||||
return showWarning("You must give your name or initials to contine");
|
return showWarning("You must give your name or initials to contine");
|
||||||
}
|
}
|
||||||
|
effortParams.outserScrollOnly = outerOnly.isSelected();
|
||||||
effortParams.setObserver(obs);
|
effortParams.setObserver(obs);
|
||||||
effortParams.setObjective(objective.getText());
|
effortParams.setObjective(objective.getText());
|
||||||
return true;
|
return true;
|
||||||
|
99
src/effortmonitor/swing/EffortSidePanel.java
Normal file
99
src/effortmonitor/swing/EffortSidePanel.java
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
package effortmonitor.swing;
|
||||||
|
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
import javax.swing.border.TitledBorder;
|
||||||
|
|
||||||
|
import PamView.PamSidePanel;
|
||||||
|
import PamView.component.PamSettingsIconButton;
|
||||||
|
import PamView.dialog.PamCheckBox;
|
||||||
|
import PamView.dialog.PamGridBagContraints;
|
||||||
|
import PamView.dialog.PamLabel;
|
||||||
|
import PamView.dialog.PamTextField;
|
||||||
|
import PamView.panel.PamPanel;
|
||||||
|
import effortmonitor.EffortControl;
|
||||||
|
import effortmonitor.EffortObserver;
|
||||||
|
import effortmonitor.EffortParams;
|
||||||
|
|
||||||
|
public class EffortSidePanel implements PamSidePanel, EffortObserver {
|
||||||
|
|
||||||
|
private PamPanel mainPanel;
|
||||||
|
|
||||||
|
private PamTextField person;
|
||||||
|
|
||||||
|
private PamCheckBox logging;
|
||||||
|
|
||||||
|
private PamSettingsIconButton settingsButton;
|
||||||
|
|
||||||
|
private EffortControl effortControl;
|
||||||
|
|
||||||
|
public EffortSidePanel(EffortControl effortControl) {
|
||||||
|
this.effortControl = effortControl;
|
||||||
|
|
||||||
|
mainPanel = new PamPanel(new GridBagLayout());
|
||||||
|
mainPanel.setBorder(new TitledBorder(effortControl.getUnitName()));
|
||||||
|
GridBagConstraints c = new PamGridBagContraints();
|
||||||
|
mainPanel.add(new PamLabel("Person ", JLabel.RIGHT), c);
|
||||||
|
c.gridx++;
|
||||||
|
mainPanel.add(person = new PamTextField(6), c);
|
||||||
|
person.setEditable(false);
|
||||||
|
c.gridx = 0;
|
||||||
|
c.gridy++;
|
||||||
|
c.gridwidth = 1;
|
||||||
|
mainPanel.add(logging = new PamCheckBox("Log effort"), c);
|
||||||
|
c.gridx += c.gridwidth;
|
||||||
|
mainPanel.add(settingsButton = new PamSettingsIconButton(), c);
|
||||||
|
settingsButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
settings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
effortControl.addObserver(this);
|
||||||
|
logging.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
loggingButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updateSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loggingButton() {
|
||||||
|
effortControl.setOnEffort(logging.isSelected());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void settings() {
|
||||||
|
effortControl.showSettingsDialog(effortControl.getGuiFrame(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateSettings() {
|
||||||
|
EffortParams params = effortControl.getEffortParams();
|
||||||
|
person.setText(params.getObserver());
|
||||||
|
logging.setSelected(params.isSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JComponent getPanel() {
|
||||||
|
return mainPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rename(String newName) {
|
||||||
|
mainPanel.setBorder(new TitledBorder(newName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void statusChange() {
|
||||||
|
updateSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -58,7 +58,7 @@ public class PamScrollerData implements Serializable, Cloneable {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PamScrollerData clone() {
|
public PamScrollerData clone() {
|
||||||
try {
|
try {
|
||||||
return (PamScrollerData) super.clone();
|
return (PamScrollerData) super.clone();
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user