|
From: <de...@us...> - 2013-03-15 19:00:09
|
Revision: 8330
http://fudaa.svn.sourceforge.net/fudaa/?rev=8330&view=rev
Author: deniger
Date: 2013-03-15 18:59:58 +0000 (Fri, 15 Mar 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2013-03-14 15:57:13 UTC (rev 8329)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbe.java 2013-03-15 18:59:58 UTC (rev 8330)
@@ -626,13 +626,13 @@
ype = yie;
ypeVal = yi;
}
+ _g.setClip(oldClip);
for (Map.Entry<Point, StringBuilder> entry : labels.entrySet()) {
Point point = entry.getKey();
StringBuilder stringBuilder = entry.getValue();
paintLabelBox(_g, point.x, point.y, stringBuilder.toString(), _t, view);
}
- _g.setClip(oldClip);
traceMarks(_g, _t);
traceTitle(_g, _t, rangeDisplayed);
@@ -806,9 +806,9 @@
if (listeMarqueurs_ == null) {
// -- init avec 3 marqueurs --//
listeMarqueurs_ = new ArrayList<EGCourbeMarqueur>(3);
- addMarqueur();
- addMarqueur();
- addMarqueur();
+ listeMarqueurs_.add(createMarqueur());
+ listeMarqueurs_.add(createMarqueur());
+ listeMarqueurs_.add(createMarqueur());
}
return listeMarqueurs_;
@@ -1229,7 +1229,7 @@
* @return
*/
public boolean addMarqueur() {
- EGCourbeMarqueur marqueur = new EGCourbeMarqueur(0, false, new TraceLigneModel(), true);
+ EGCourbeMarqueur marqueur = createMarqueur();
return addMarqueur(marqueur);
}
@@ -1384,4 +1384,9 @@
protected void paintLabelBox(final Graphics2D _g, int xBox, int yBox, String pLabel, final EGRepere _t, Rectangle view) {
tboxLabels_.paintBox(_g, xBox, yBox, pLabel, view);
}
+
+ public EGCourbeMarqueur createMarqueur() {
+ EGCourbeMarqueur marqueur = new EGCourbeMarqueur(0, false, new TraceLigneModel(), true);
+ return marqueur;
+ }
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2013-03-14 15:57:13 UTC (rev 8329)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2013-03-15 18:59:58 UTC (rev 8330)
@@ -125,7 +125,6 @@
return iconeModelSpecific;
}
-
public void setIconeModel(TraceIconModel iconeModel) {
this.iconeModel = iconeModel;
}
@@ -134,7 +133,6 @@
this.iconeModelSpecific = iconeModelSpecific;
}
-
public List<EGCourbeMarqueur> getListeMarqueurs() {
return listeMarqueurs_;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-04-02 15:27:33
|
Revision: 8368
http://fudaa.svn.sourceforge.net/fudaa/?rev=8368&view=rev
Author: deniger
Date: 2013-04-02 15:27:26 +0000 (Tue, 02 Apr 2013)
Log Message:
-----------
Support donn?\195?\169es issues de GGCrue
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2013-04-02 15:26:47 UTC (rev 8367)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2013-04-02 15:27:26 UTC (rev 8368)
@@ -56,7 +56,7 @@
*/
public class EGFillePanel extends BuPanel implements PropertyChangeListener, ActionListener, CtuluSelectionInterface,
CtuluImageProducer {
-
+
protected final EGVue vue_;
JLabel lbTools_;
EbliActionInterface[] personnalAction_;
@@ -69,7 +69,7 @@
public EGFillePanel(final EGGraphe _a) {
this(_a, null);
}
-
+
public EGFillePanel duplicate() {
return new EGFillePanel(vue_.getGraphe().duplicate());
}
@@ -81,12 +81,12 @@
EbliLib.cleanListener(personnalAction_);
EbliLib.cleanListener(specificTools_);
}
-
+
public void addSelectionListener(final CtuluListSelectionListener _l) {
selection_.addSelectionListener(_l);
-
+
}
-
+
public EGFillePanel(final EGGraphe _a, final EbliActionInterface[] _userAction) {
setLayout(new BuBorderLayout(5, 0));
personnalAction_ = _userAction;
@@ -101,7 +101,7 @@
lbTools_.setPreferredSize(new Dimension(200, 20));
lbTools_.setSize(new Dimension(100, 20));
lbTools_.setOpaque(false);
-
+
add(lbTools_, BuBorderLayout.SOUTH);
vue_ = new EGVue(_a);
add(vue_, BuBorderLayout.CENTER);
@@ -110,7 +110,7 @@
// suiviInfos_ = new EGInteractionSuiviAllOrdonnees(vue_.getGraphe());
}
-
+
protected void addListenerCourbePoint(final CtuluListSelectionListener _l) {
selection_.getSelection().addListeSelectionListener(_l);
}
@@ -131,7 +131,7 @@
r.add(a);
selection_.addPropertyChangeListener(this);
actionForGroup.add(a);
-
+
EbliActionAbstract s = new EbliActionSimple(EbliResource.EBLI.getString("Restaurer"), EbliResource.EBLI
.getIcon("restore"), "RESTORE") {
@Override
@@ -166,7 +166,7 @@
r.add(a);
actionForGroup.add(a);
zoom.addPropertyChangeListener(this);
-
+
final EGInteractionMove move = new EGInteractionMove(vue_.graphe_);
move.setDefaultInteractiveComponent(selection_);
vue_.addInteractiveCmp(move);
@@ -175,14 +175,14 @@
a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('m'));
r.add(a);
actionForGroup.add(a);
-
+
final EGInteractionInfoOnCourbe infoOnCourbe = new EGInteractionInfoOnCourbe(vue_.graphe_);
vue_.addInteractiveCmp(infoOnCourbe);
a = new EGActionInteraction(EbliLib.getS("Afficher le nom de la courbe sous la souris"), EbliResource.EBLI.getIcon("tooltip"), "INFO", infoOnCourbe);
a.putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Afficher le nom de la courbe sous la souris"));
a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('n'));
r.add(a);
-
+
final EGInteractionSuivi suivi = new EGInteractionSuivi(vue_.getGraphe());
vue_.addInteractiveCmp(suivi);
a = new EGActionInteraction(EbliLib.getS("suivi"), EbliResource.EBLI.getIcon("pointeur"), "SUIVI", suivi);
@@ -193,7 +193,7 @@
actionForGroup.add(a);
EbliActionSimple actionpal = new EGActionPaletteAllCoordonnees(this);
r.add(actionpal);
-
+
if (getModel().isContentModifiable()) {
r.add(null);
final EGInteractionAddPoint addPt = new EGInteractionAddPoint(this);
@@ -212,7 +212,7 @@
r.add(a);
pt.addPropertyChangeListener(this);
actionForGroup.add(a);
-
+
EbliActionSimple act = new EGSimplificationAction(vue_.graphe_);
r.add(act);
r.add(null);
@@ -225,18 +225,18 @@
@Override
public void actionPerformed(ActionEvent _e) {
EGPaletteLegendeGraphe palette = new EGPaletteLegendeGraphe(getGraphe());
- palette.setPreferredSize(new Dimension(500, 600));
+ palette.setBtRefreshTitleVisible(showRefreshButtonInConfigurePanel);
+ palette.setPreferredSize(new Dimension(500, 800));
palette.afficheModale(CtuluLibSwing.getFrameAncestor(EGFillePanel.this));
-
}
});
-
+
final BPaletteInfoAbstractAction info = new BPaletteInfoAbstractAction() {
@Override
public JComponent buildContentPane() {
return new EGPaletteInfo(EGFillePanel.this, null);
}
-
+
@Override
protected boolean mustBeUpdated() {
return getModel().getNbSelectedObjects() >= 0;
@@ -244,9 +244,9 @@
};
r.add(info);
r.add(new EGTableAction(getGraphe()));
-
+
new EbliActionGroup(actionForGroup);
-
+
if (personnalAction_ != null) {
r.add(null);
final int nb = personnalAction_.length;
@@ -271,43 +271,43 @@
| InputEvent.SHIFT_DOWN_MASK));
r.add(addAction);
}
-
+
final EbliActionInterface[] rf = new EbliActionInterface[r.size()];
r.toArray(rf);
EbliLib.updateMapKeyStroke(this, rf);
-
+
return rf;
}
-
+
protected EGCourbe getCourbeSelected() {
return vue_.graphe_.getSelectedComponent();
}
-
+
public EGGraphe getGraphe() {
return vue_.graphe_;
}
-
+
protected EGGrapheModel getModel() {
return vue_.graphe_.getModel();
}
-
+
public CtuluListSelection getSelection() {
return selection_.getSelection();
}
-
+
public void majSelectionListener(final EGTableGraphePanel _tablePanel) {
if ((selection_ != null) && (_tablePanel != null)) {
_tablePanel.setListenerToSelection(selection_);
}
}
-
+
protected void majLabelInfo(final String _s) {
lbTools_.setText(_s);
}
-
+
protected void fillPopupMenu(final BuPopupMenu _menu) {
}
-
+
public void popupMenu(final int _x, final int _y) {
final BuPopupMenu m = new BuPopupMenu();
m.setInvoker(this);
@@ -317,7 +317,7 @@
fillSpecificMenu(m);
m.show(this, _x, _y);
}
-
+
@Override
public void actionPerformed(final ActionEvent _evt) {
if (FuLog.isTrace()) {
@@ -389,7 +389,7 @@
}
}
}
-
+
@Override
public void find() {
}
@@ -401,23 +401,32 @@
public Dimension getDefaultImageDimension() {
return vue_.getDefaultImageDimension();
}
-
+
public EGVue getView() {
return vue_;
}
-
+
public EbliActionInterface[] getSpecificActions() {
if (specificTools_ == null) {
specificTools_ = buildActions();
}
return specificTools_;
}
-
+ private boolean showRefreshButtonInConfigurePanel = true;
+
+ public boolean isShowRefreshButtonInConfigurePanel() {
+ return showRefreshButtonInConfigurePanel;
+ }
+
+ public void setShowRefreshButtonInConfigurePanel(boolean showRefreshButtonInConfigurePanel) {
+ this.showRefreshButtonInConfigurePanel = showRefreshButtonInConfigurePanel;
+ }
+
@Override
public void clearSelection() {
selection_.clearSelection();
}
-
+
@Override
public void inverseSelection() {
selection_.inverseSelection();
@@ -428,15 +437,15 @@
*/
@Override
public BufferedImage produceImage(final Map _params) {
-
+
return vue_.produceImage(_params);
}
-
+
@Override
public BufferedImage produceImage(final int _w, final int _h, final Map _params) {
return vue_.produceImage(_w, _h, _params);
}
-
+
@Override
public void propertyChange(final PropertyChangeEvent _evt) {
if (_evt.getSource() instanceof EGInteractiveComponent) {
@@ -448,11 +457,11 @@
}
}
}
-
+
@Override
public void replace() {
}
-
+
@Override
public void select() {
selection_.selectAll();
@@ -473,65 +482,65 @@
BuMenuItem alignPointMenuItem;
BuMenuItem refinePointMenuItem;
BuMenuItem removePointMenuItem;
-
+
public void fillMenuWithActions(final BuPopupMenu m) {
modifiyPointsMenuItem = addModifiyPointsMenuItem(m);
alignPointMenuItem = addAlignPointMenuItem(m);
refinePointMenuItem = addRefinePointMenuItem(m);
removePointMenuItem = addRemovePointMenuItem(m);
}
-
+
public boolean isSelectedCourbeModifiable() {
final EGCourbe c = vue_.graphe_.getSelectedComponent();
return (c != null) && (c.getModel().isModifiable()) && (getSelection() != null)
&& (!getSelection().isEmpty());
}
-
+
public boolean isSelectionAlignable() {
return isSelectedCourbeModifiable() && (getSelection().getNbSelectedIndex() >= 2);
}
-
+
public boolean isSelectionRefinable() {
return isSelectedCourbeModifiable()
&& (getSelection().getNbSelectedIndex() >= 2);
}
-
+
public boolean isSelectionRemovable() {
return isSelectedCourbeModifiable();
}
-
+
public BuMenuItem addModifiyPointsMenuItem(final BuPopupMenu m) {
return m.addMenuItem(EbliLib.getS("Modifier les points s\xE9lectionn\xE9s"), "MODIFY_POINTS", EbliResource.EBLI
.getToolIcon("node-edit"), isSelectedCourbeModifiable());
}
-
+
public BuMenuItem addModifiyPointsMenuItem(final CtuluPopupMenu m) {
return m.addMenuItem(EbliLib.getS("Modifier les points s\xE9lectionn\xE9s"), "MODIFY_POINTS", EbliResource.EBLI
.getToolIcon("node-edit"), isSelectedCourbeModifiable());
}
-
+
public BuMenuItem addAlignPointMenuItem(final CtuluPopupMenu m) {
return m.addMenuItem(EbliLib.getS("Aligner les points"), "ALIGN_POINTS", EbliResource.EBLI.getToolIcon("node-corner"), isSelectionAlignable());
}
-
+
public BuMenuItem addAlignPointMenuItem(final BuPopupMenu m) {
return m.addMenuItem(EbliLib.getS("Aligner les points"), "ALIGN_POINTS", EbliResource.EBLI.getToolIcon("node-corner"), isSelectionAlignable());
}
-
+
public BuMenuItem addRefinePointMenuItem(final CtuluPopupMenu m) {
return m.addMenuItem(EbliLib.getS("Raffiner"), "ADD_POINTS", EbliResource.EBLI.getToolIcon("node-add"), isSelectionRefinable());
}
-
+
public BuMenuItem addRefinePointMenuItem(final BuPopupMenu m) {
return m.addMenuItem(EbliLib.getS("Raffiner"), "ADD_POINTS", EbliResource.EBLI.getToolIcon("node-add"), isSelectionRefinable());
}
-
+
public BuMenuItem addRemovePointMenuItem(final CtuluPopupMenu m) {
final BuMenuItem addMenuItem = m.addMenuItem(EbliLib.getS("Supprimer un point"), "REMOVE_POINTS", EbliResource.EBLI.getToolIcon("node-delete"), isSelectionRemovable());
addMenuItem.setAccelerator(EGTableGraphePanel.getDeleteKeyStroke());
return addMenuItem;
}
-
+
public BuMenuItem addRemovePointMenuItem(final BuPopupMenu m) {
final BuMenuItem addMenuItem = m.addMenuItem(EbliLib.getS("Supprimer un point"), "REMOVE_POINTS", EbliResource.EBLI.getToolIcon("node-delete"), isSelectionRemovable());
addMenuItem.setAccelerator(EGTableGraphePanel.getDeleteKeyStroke());
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2013-04-02 15:26:47 UTC (rev 8367)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2013-04-02 15:27:26 UTC (rev 8368)
@@ -44,44 +44,44 @@
*/
public class EGPaletteLegendeGraphe extends CtuluDialogPanel implements ActionListener, ListSelectionListener,
BuBorders {
-
+
private final class EGGrapheModelListenerImplementation implements EGGrapheModelListener {
-
+
@Override
public void structureChanged() {
}
-
+
@Override
public void courbeContentChanged(final EGObject c, final boolean mustRestore) {
}
-
+
@Override
public void courbeAspectChanged(final EGObject c, final boolean visibil) {
model_.fireContentsChanged(this, 0, model_.getSize() - 1);
-
+
}
-
+
@Override
public void axeContentChanged(final EGAxe c) {
}
-
+
@Override
public void axeAspectChanged(final EGAxe c) {
}
}
-
+
class CustomDefaultListModel extends DefaultListModel {
-
+
@Override
public void fireContentsChanged(Object source, int index0, int index1) {
super.fireContentsChanged(source, index0, index1);
}
-
+
@Override
public void fireIntervalAdded(Object source, int index0, int index1) {
super.fireIntervalAdded(source, index0, index1);
}
-
+
@Override
public void fireIntervalRemoved(Object source, int index0, int index1) {
super.fireIntervalRemoved(source, index0, index1);
@@ -112,13 +112,13 @@
private JList list_;
CustomDefaultListModel model_;
private EGGrapheModelListenerImplementation modelListener;
-
+
public EGPaletteLegendeGraphe(final EGGraphe graphe) {
super(false);
graphe_ = graphe;
buildContent();
}
-
+
@Override
public boolean cancel() {
graphe_.removeModelListener(modelListener);
@@ -138,13 +138,13 @@
}
return super.cancel();
}
-
+
@Override
public boolean ok() {
graphe_.removeModelListener(modelListener);
return super.ok();
}
-
+
@Override
public void closeDialog() {
graphe_.removeModelListener(modelListener);
@@ -156,7 +156,7 @@
*/
private void actionApply() {
}
-
+
private void actionFormat() {
final CtuluNumberFormatI ctuluNumberFormatI = format_;
/*
@@ -177,7 +177,7 @@
tf.setText(separatorFormat_);
pnSep.add(tf);
pn.add(pnSep);
-
+
if (ctuluNumberFormatI == null || ctuluNumberFormatI.isDecimal()) {
fmtSelect.setBorder(BorderFactory.createTitledBorder(EbliLib.getS("Format d\xE9cimal")));
pn.add(fmtSelect);
@@ -186,13 +186,13 @@
format_ = fmtSelect.getCurrentFmt();
separatorFormat_ = tf.getText();
ajusteAllLegendes();
-
+
}
}
-
+
@Override
public void actionPerformed(final ActionEvent _e) {
-
+
final Object s = _e.getSource();
if (s == btApply_) {
actionApply();
@@ -201,7 +201,7 @@
} else if (btFormat_ == _e.getSource()) {
actionFormat();
}
-
+
}
/**
@@ -209,7 +209,7 @@
*/
protected void ajusteAllLegendes() {
}
-
+
public int getLine(EGCourbe c) {
int nb = model_.getSize();
for (int i = 0; i < nb; i++) {
@@ -219,7 +219,7 @@
}
return -1;
}
-
+
public void selectCourbe(EGCourbe c) {
int idx = getLine(c);
if (idx >= 0) {
@@ -229,7 +229,7 @@
Map<EGCourbe, EGCourbePersist> initCourbeConfig = new HashMap<EGCourbe, EGCourbePersist>();
Map<EGAxeVertical, EGAxeVerticalPersist> initAxeConfig = new HashMap<EGAxeVertical, EGAxeVerticalPersist>();
EGAxeHorizontalPersist initAxeHorizontal;
-
+
private void buildContent() {
final EGCourbe[] cs = graphe_.getModel().getCourbes();
for (EGCourbe eGCourbe : cs) {
@@ -241,7 +241,7 @@
initAxeConfig.put(axe, new EGAxeVerticalPersist(axe));
}
initAxeHorizontal = new EGAxeHorizontalPersist(graphe_.getTransformer().getXAxe());
-
+
final BuBorderLayout lay = new BuBorderLayout(2, 2);
setLayout(lay);
@@ -262,12 +262,12 @@
list_.setCellRenderer(new EGCourbeCellRenderer());
list_.getSelectionModel().addListSelectionListener(this);
list_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-
+
final BuScrollPane sp = new BuScrollPane(list_);
sp.setPreferredSize(new Dimension(600, 100));
sp.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Liste des courbes")));
add(sp, BuBorderLayout.NORTH);
-
+
final BuPanel pnColor = new BuPanel();
pnColor.setLayout(new BuButtonLayout(1, SwingConstants.LEFT));
@@ -275,9 +275,10 @@
paletteAction = new EGConfigureActionPalette();
final JComponent paletteComp = paletteAction.getPaletteContent();
+ paletteComp.setPreferredSize(new Dimension(550, 550));
updatePanelData();
paletteComp.setBorder(BorderFactory.createTitledBorder(EbliResource.EBLI.getString("Param\xE9trage")));
-
+
add(paletteComp, BorderLayout.CENTER);
if (selection.size() > 0) {
list_.setSelectedIndices(selection.toNativeArray());
@@ -288,20 +289,28 @@
btApply_.addActionListener(this);
btRefresh_ = new BuButton(BuResource.BU.getIcon("rafraichir"));
btRefresh_.setText(EbliLib.getS("R\xE9initialiser les titres"));
- btRefresh_.setToolTipText(EbliLib.getS("Initialiser les plages des couleurs"));
+ btRefresh_.setToolTipText(EbliLib.getS("R\xE9initialiser les titres"));
btRefresh_.addActionListener(this);
+ btRefresh_.setVisible(btRefreshVisible);
btRefresh_.setEnabled(true);
final BuPanel btpn = new BuPanel();
btpn.setLayout(new BuButtonLayout(1, SwingConstants.RIGHT));
-
+
btpn.add(btRefresh_);
add(btpn, BuBorderLayout.SOUTH);
-
- this.setPreferredSize(new Dimension(550, 750));
- this.setMinimumSize(new Dimension(550, 750));
-
+
+ this.setPreferredSize(new Dimension(550, 850));
+ this.setMinimumSize(new Dimension(550, 850));
}
-
+ private boolean btRefreshVisible = true;
+
+ public void setBtRefreshTitleVisible(boolean visible) {
+ btRefreshVisible = visible;
+ if (btRefresh_ != null) {
+ btRefresh_.setVisible(visible);
+ }
+ }
+
private EGCourbe[] getSelectedCourbes() {
final int[] select = this.list_.getSelectedIndices();
if (select == null) {
@@ -328,7 +337,7 @@
private void updatePanelData() {
paletteAction.setPaletteTarget(getSelectedCourbes());
}
-
+
@Override
public void valueChanged(final ListSelectionEvent e) {
updatePanelData();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-04-03 12:47:17
|
Revision: 8374
http://fudaa.svn.sourceforge.net/fudaa/?rev=8374&view=rev
Author: deniger
Date: 2013-04-03 12:47:10 +0000 (Wed, 03 Apr 2013)
Log Message:
-----------
sauvegarde de la visibilit?\195?\169 d'une courbe
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2013-04-03 09:45:41 UTC (rev 8373)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2013-04-03 12:47:10 UTC (rev 8374)
@@ -214,17 +214,16 @@
int nbSousGraduations_ = 3;
final TickIterator buildUpToDateMainTickIterator() {
-
- if (modeGraduations_ == LOGARITHMIQUE) {
+ if (userIterator != null) {
+ axisIterator_ = userIterator;
+ } else if (modeGraduations_ == LOGARITHMIQUE) {
axisIterator_ = new LogarithmicNumberIterator();
+ ((NumberIterator) axisIterator_).setMaxFractionDigits(2);
} else {
axisIterator_ = new NumberIterator();
+ ((NumberIterator) axisIterator_).setMaxFractionDigits(2);
}
- ((NumberIterator) axisIterator_).setMaxFractionDigits(2);
- final double min = getMinimum();
- final double max = getMaximum();
- final int mode = modeGraduations_;
if (modeGraduations_ == MANUEL_GRADUATIONS) {
axisIterator_.initExact(getMinimum(), getMaximum(), nbPas_, nbSousGraduations_ + 1);
@@ -507,8 +506,10 @@
public boolean isVisible() {
return visible_;
}
+ private TickIterator userIterator;
public final void setAxisIterator(final TickIterator _axisIterator) {
+ this.userIterator = _axisIterator;
axisIterator_ = _axisIterator;
isIteratorUptodate_ = false;
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2013-04-03 09:45:41 UTC (rev 8373)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersist.java 2013-04-03 12:47:10 UTC (rev 8374)
@@ -15,7 +15,7 @@
*/
@XStreamAlias("Curve")
public class EGCourbePersist extends EGPersist {
-
+
@XStreamAlias("Title")
String title_;
@XStreamAlias("IdGroup")
@@ -77,122 +77,137 @@
boolean displayTitle = false;
@XStreamAlias("VerticalLabels")
boolean verticalLabels = false;
-
+ @XStreamAlias("Visible")
+ private Boolean visible = true;
+
public EGCourbePersist() {
}
+ /**
+ *
+ * @return
+ */
+ public boolean isVisible() {
+ //test bizarre pour le compatibilit\xE9 descendante: anciennes versions ne contenants pas cette valeur visible.
+ return visible == null || Boolean.TRUE.equals(visible);
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
public TraceLigneModel getLineModel_() {
return lineModel_;
}
-
+
public String getTitle_() {
return title_;
}
-
+
public void setTitle_(String title_) {
this.title_ = title_;
}
-
+
public boolean isNuagePoints() {
return nuagePoints;
}
-
+
public void setNuagePoints(boolean nuagePoints) {
this.nuagePoints = nuagePoints;
}
-
+
public TraceBox getTracebox() {
return tracebox;
}
-
+
public void setTracebox(TraceBox tracebox) {
this.tracebox = tracebox;
}
-
+
public TraceLigneModel gettLigneMarqueur() {
return tLigneMarqueur_;
}
-
+
public void settLigneMarqueur(TraceLigneModel tLigneMarqueur_) {
this.tLigneMarqueur_ = tLigneMarqueur_;
}
-
+
public TraceIconModel getIconeModel() {
return iconeModel;
}
-
+
public TraceIconModel getIconeModelSpecific() {
return iconeModelSpecific;
}
-
+
public void setIconeModel(TraceIconModel iconeModel) {
this.iconeModel = iconeModel;
}
-
+
public void setIconeModelSpecific(TraceIconModel iconeModelSpecific) {
this.iconeModelSpecific = iconeModelSpecific;
}
-
+
public List<EGCourbeMarqueur> getListeMarqueurs() {
return listeMarqueurs_;
}
-
+
public void setListeMarqueurs(List<EGCourbeMarqueur> listeMarqueurs_) {
this.listeMarqueurs_ = listeMarqueurs_;
}
-
+
public EGCourbeSurfacePersist getSurfacePainter() {
return surfacePainter;
}
-
+
public void setSurfacePainter(EGCourbeSurfacePersist surfacePainter) {
this.surfacePainter = surfacePainter;
}
-
+
public void setLineModel(TraceLigneModel lineModel_) {
this.lineModel_ = lineModel_;
}
-
+
public boolean isDisplayLabels() {
return displayLabels;
}
-
+
public void setDisplayLabels(boolean displayLabels) {
this.displayLabels = displayLabels;
}
-
+
public boolean isVerticalLabels() {
return verticalLabels;
}
-
+
public void setVerticalLabels(boolean verticalLabels) {
this.verticalLabels = verticalLabels;
}
-
+
public boolean isDisplayTitle() {
return displayTitle;
}
-
+
public void setDisplayTitle(boolean displayTitle) {
this.displayTitle = displayTitle;
}
-
+
public String getTitle() {
return title_;
}
-
+
public void setTitle(String _title) {
this.title_ = _title;
}
-
+
public int getIdgroup() {
return Idgroup;
}
-
+
public void setIdgroup(int _idgroup) {
Idgroup = _idgroup;
}
-
+
public int getSpecificIntValue(String string, int defaultValue) {
Object o = getSpecificValue(string);
if (o == null) {
@@ -200,7 +215,7 @@
}
return ((Integer) o).intValue();
}
-
+
public boolean getSpecificBooleanValue(String string) {
Object o = getSpecificValue(string);
return Boolean.TRUE.equals(o);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2013-04-03 09:45:41 UTC (rev 8373)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCourbePersistBuilder.java 2013-04-03 12:47:10 UTC (rev 8374)
@@ -131,6 +131,7 @@
courbeToModify.setDisplayPointLabels(persist.displayLabels);
courbeToModify.setVerticalLabels(persist.verticalLabels);
courbeToModify.setDisplayTitleOnCurve(persist.displayTitle);
+ courbeToModify.setVisible(persist.isVisible());
}
public final static String X_KEY = "X";
@@ -197,6 +198,7 @@
res.displayLabels = courbe.displayPointLabels_;
res.verticalLabels = courbe.isVerticalLabels();
res.displayTitle = courbe.displayTitleOnCurve_;
+ res.setVisible(courbe.isVisible_);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-04-06 02:12:25
|
Revision: 8387
http://fudaa.svn.sourceforge.net/fudaa/?rev=8387&view=rev
Author: deniger
Date: 2013-04-06 02:12:17 +0000 (Sat, 06 Apr 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2013-04-06 01:39:09 UTC (rev 8386)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2013-04-06 02:12:17 UTC (rev 8387)
@@ -291,6 +291,19 @@
}
public void apply(EGAxeVertical axeY) {
+ applyAllButRange(axeY);
+ if (range != null) {
+ axeY.range_.initWith(range);
+ }
+ }
+
+ public EGAxeVertical generateAxe() {
+ EGAxeVertical axeY = new EGAxeVertical();
+ apply(axeY);
+ return axeY;
+ }
+
+ public void applyAllButRange(EGAxeVertical axeY) {
axeY.droite_ = this.droite;
axeY.titreVertical_ = this.titreVertical;
axeY.titreVerticalDroite_ = this.titreVerticalDroite;
@@ -314,15 +327,6 @@
axeY.longueurPas_ = longueurPas_;
axeY.setModeGraduations(modeGraduations_);
axeY.nbSousGraduations_ = nbSousGraduations_;
- if (range != null) {
- axeY.range_.initWith(range);
- }
axeY.initDisplayValues();
}
-
- public EGAxeVertical generateAxe() {
- EGAxeVertical axeY = new EGAxeVertical();
- apply(axeY);
- return axeY;
- }
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2013-04-06 01:39:09 UTC (rev 8386)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2013-04-06 02:12:17 UTC (rev 8387)
@@ -106,6 +106,7 @@
vue_ = new EGVue(_a);
add(vue_, BuBorderLayout.CENTER);
selection_ = new EGInteractionSelection(vue_.graphe_);
+ setDoubleBuffered(false);
// suiviInfos_ = new EGInteractionSuiviAllOrdonnees(vue_.getGraphe());
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2013-04-06 01:39:09 UTC (rev 8386)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2013-04-06 02:12:17 UTC (rev 8387)
@@ -117,8 +117,6 @@
public ExportTableCommentSupplier getExportTableCommentSupplier() {
return exportTableCommentSupplier;
}
-
-
private void ajusteXAxe() {
final EGAxeHorizontal hAxe = getTransformer().getXAxe();
@@ -368,7 +366,7 @@
} else if (_c.isVisible_) {
final EGAxeVertical vert = _c.getAxeY();
// si l'axe n'a pas d\xE9j\xE0 \xE9t\xE9 initialis\xE9.
- if (!vert.isRangeInit()) {
+ if (vert != null && !vert.isRangeInit()) {
vert.ajusteFor(_c);
}
@@ -635,6 +633,9 @@
final EGObject o = m.getEGObject(i);
if (o.isVisible_) {
final EGAxeVertical axe = o.getAxeY();
+ if (axe == null) {
+ continue;
+ }
CtuluRange r = (CtuluRange) axeYRange.get(axe);
if (r == null) {
r = new CtuluRange();
@@ -643,6 +644,7 @@
axeYRange.put(axe, r);
}
o.ajusteY(r);
+ System.err.println("r=" + r);
}
}
for (final Iterator it = axeYRange.entrySet().iterator(); it.hasNext();) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-04-08 15:18:47
|
Revision: 8390
http://fudaa.svn.sourceforge.net/fudaa/?rev=8390&view=rev
Author: deniger
Date: 2013-04-08 15:18:37 +0000 (Mon, 08 Apr 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2013-04-06 02:18:47 UTC (rev 8389)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2013-04-08 15:18:37 UTC (rev 8390)
@@ -259,6 +259,18 @@
}
public void apply(final EGAxeHorizontal axeX) {
+ applyButRange(axeX);
+ if (range != null) {
+ axeX.range_.initWith(range);
+ }
+ }
+
+ /**
+ * N'applique pas la modification du Range.
+ *
+ * @param axeX
+ */
+ public void applyButRange(final EGAxeHorizontal axeX) {
axeX.titre_ = this.titre;
axeX.titreVisible_ = this.titreVisible;
axeX.unite_ = this.unite;
@@ -281,9 +293,6 @@
axeX.longueurPas_ = longueurPas_;
axeX.modeGraduations_ = modeGraduations_;
axeX.nbSousGraduations_ = nbSousGraduations_;
- if (range != null) {
- axeX.range_.initWith(range);
- }
axeX.initDisplayValues();
}
}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2013-04-06 02:18:47 UTC (rev 8389)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2013-04-08 15:18:37 UTC (rev 8390)
@@ -644,7 +644,6 @@
axeYRange.put(axe, r);
}
o.ajusteY(r);
- System.err.println("r=" + r);
}
}
for (final Iterator it = axeYRange.entrySet().iterator(); it.hasNext();) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2013-04-06 02:18:47 UTC (rev 8389)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java 2013-04-08 15:18:37 UTC (rev 8390)
@@ -134,7 +134,7 @@
// axe.fireCourbeAspectChanged(false);
}
if (initAxeHorizontal != null) {
- initAxeHorizontal.apply(graphe_.getTransformer().getXAxe());
+ initAxeHorizontal.applyButRange(graphe_.getTransformer().getXAxe());
}
return super.cancel();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2013-06-24 22:17:02
|
Revision: 8425
http://sourceforge.net/p/fudaa/svn/8425
Author: deniger
Date: 2013-06-24 22:16:59 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
CRUE-542
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2013-06-24 22:16:50 UTC (rev 8424)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2013-06-24 22:16:59 UTC (rev 8425)
@@ -234,7 +234,17 @@
}
// un seul | pour forcer l'appel aux deux methodes
// normal ....
- if (applyVertical() | applyHorizontal()) {
+ boolean axeHModified = applyHorizontal();
+ boolean axeVModified = applyVertical();
+ if (axeHModified) {
+ graphe_.getModel().fireAxeAspectChanged(axeX_);
+ }
+ if (axeVModified) {
+ for (int i = 0; i < axes_.length; i++) {
+ graphe_.getModel().fireAxeAspectChanged(axes_[i]);
+ }
+ }
+ if (axeHModified | axeVModified) {
graphe_.axeUpdated();
}
pnAxeX.requestFocus();
@@ -614,8 +624,8 @@
// -- selection du type de graduations
if (comboHorizontal_ == null) {
comboHorizontal_ = new BuComboBox(new String[]{EbliLib.getS("Manuel: Nombre de graduations"),
- EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
- EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")});
+ EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
+ EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")});
lb = new BuLabel(typePasTxt);
// -- listener de la combo --//
comboHorizontal_.addActionListener(new ActionListener() {
@@ -772,8 +782,8 @@
// -- selection du type de graduations
comboVertical_ = new BuComboBox(new String[]{EbliLib.getS("Manuel: Nombre de graduations"),
- EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
- EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")}) {
+ EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"),
+ EbliLib.getS("Automatique: Longueur des pas"), EbliLib.getS("Logarithmique")}) {
@Override
public void setSelectedIndex(int anIndex) {
super.setSelectedIndex(anIndex);
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java 2013-06-24 22:16:50 UTC (rev 8424)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java 2013-06-24 22:16:59 UTC (rev 8425)
@@ -85,14 +85,13 @@
int maxStringwidth = 0;
if (graduations_ || _grille) {
- // java.text.NumberFormat nf = getNumberFormat();
final double asc = _fm.getDescent();
final double fontHeight = _fm.getDescent() + _fm.getAscent();
final double xLeft = droite_ ? (_x + 3) : (_x - 3);
final double xLeftMinor = droite_ ? (_x + 1) : (_x - 1);
- int xMaxGrad = 1000;
- if (_g2d.getClipBounds() != null) {
- xMaxGrad = _g2d.getClipBounds().width;
+ int xMaxGrad = _t.getMaxEcranX();
+ if (droite_) {
+ xMaxGrad = _t.getMinEcranX();
}
final TraceLigne traceGraduations = new TraceLigne(traceGraduations_);
// traceGraduations.setCouleur(getLineColor());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2015-09-10 14:23:35
|
Revision: 9162
http://sourceforge.net/p/fudaa/svn/9162
Author: deniger
Date: 2015-09-10 14:23:32 +0000 (Thu, 10 Sep 2015)
Log Message:
-----------
CRUE-657
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2015-09-09 21:59:55 UTC (rev 9161)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2015-09-10 14:23:32 UTC (rev 9162)
@@ -154,6 +154,8 @@
};
// EM:Si la fonctionnalit\xE9 'Restaurer automatiquement' est d\xE9j\xE0 activ\xE9e, selectionner l'action.
((EbliActionChangeState) s).setSelected(getGraphe().isAutoRestore());
+
+ getGraphe().addPropertyChangeListener("autorestore", this);
//
s.putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Restaurer automatiquement la vue"));
r.add(s);
@@ -280,7 +282,6 @@
final EbliActionInterface[] rf = new EbliActionInterface[r.size()];
r.toArray(rf);
EbliLib.updateMapKeyStroke(this, rf);
-
return rf;
}
@@ -307,8 +308,17 @@
}
}
+ protected void majLabelInfoAutoRestore() {
+ String txt = (String) lbTools_.getClientProperty("actionNameSaved");
+ if (getGraphe().isAutoRestore()) {
+ txt = "<html><b><" + EbliLib.getS("Autom. zoom") + "></b> " + txt;
+ }
+ lbTools_.setText(txt);
+ }
+
protected void majLabelInfo(final String _s) {
- lbTools_.setText(_s);
+ lbTools_.putClientProperty("actionNameSaved", _s);
+ majLabelInfoAutoRestore();
}
protected void fillPopupMenu(final BuPopupMenu _menu) {
@@ -454,6 +464,10 @@
@Override
public void propertyChange(final PropertyChangeEvent _evt) {
+ if ("autorestore".equals(_evt.getPropertyName())) {
+ majLabelInfoAutoRestore();
+
+ }
if (_evt.getSource() instanceof EGInteractiveComponent) {
final EGInteractiveComponent c = (EGInteractiveComponent) _evt.getSource();
if (c.isActive()) {
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2015-09-09 21:59:55 UTC (rev 9161)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2015-09-10 14:23:32 UTC (rev 9162)
@@ -690,6 +690,7 @@
if (autoRestore_) {
restore();
}
+ firePropertyChange("autorestore", !autoRestore_, autoRestore_);
EbliPreferences.EBLI.putBooleanProperty(getAutorRestorePref(), autoRestore_);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <de...@us...> - 2015-11-24 23:15:50
|
Revision: 9199
http://sourceforge.net/p/fudaa/svn/9199
Author: deniger
Date: 2015-11-24 23:15:48 +0000 (Tue, 24 Nov 2015)
Log Message:
-----------
CRUE-667
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-24 23:15:41 UTC (rev 9198)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-24 23:15:48 UTC (rev 9199)
@@ -22,7 +22,6 @@
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCell;
-import org.apache.commons.lang.StringUtils;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.CtuluLibArray;
import org.fudaa.ctulu.CtuluLibString;
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2015-11-24 23:15:41 UTC (rev 9198)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2015-11-24 23:15:48 UTC (rev 9199)
@@ -3,13 +3,21 @@
*/
package org.fudaa.ebli.courbe;
+import com.lowagie.text.Font;
+import com.memoire.bu.BuLib;
import com.memoire.bu.BuVerticalLayout;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import org.apache.commons.lang.StringUtils;
/**
*
@@ -17,6 +25,14 @@
*/
public class EGLegendPanelManager extends MouseAdapter implements EGGrapheModelListener {
+ private class LegendLine {
+
+ String txt;
+ String tooltip;
+ EGCourbe courbe;
+ int padding;
+ }
+
JPanel panel;
JPanel mainPanel;
EGGraphe graphe;
@@ -105,26 +121,104 @@
return mainPanel;
}
+ private String groupByLastSeparator;
+
+ public String getGroupByLastSeparator() {
+ return groupByLastSeparator;
+ }
+
+ /**
+ * Si non null, sera utilis\xE9 pour afficher les courbes par groupe. Par exemple les courbes C1 - Toto / 1, C2 - Toto / 1, ... seront affich\xE9es
+ * <pre>
+ * Toto / 1
+ * C1
+ * C2
+ * </pre>
+ *
+ * @param groupByLastSeparator si null, pas de groupement par suffixe
+ */
+ public void setGroupByLastSeparator(String groupByLastSeparator) {
+ this.groupByLastSeparator = groupByLastSeparator;
+ }
+
private void rebuild() {
panel.removeAll();
panel.setDoubleBuffered(false);
EGCourbe[] courbes = graphe.getModel().getCourbes();
+ List<LegendLine> lines = new ArrayList<LegendLine>();
for (EGCourbe courbe : courbes) {
if (!courbe.isVisible_) {
continue;
}
- JLabel label = new JLabel();
+ LegendLine line = new LegendLine();
+ line.courbe = courbe;
+ line.tooltip = courbe.getTitle();
+ line.txt = courbe.getTitle();
+ lines.add(line);
+ }
+ manageGroupByPrefix(lines);
+ for (LegendLine line : lines) {
+ addLabelToPanel(line);
+ }
+ panel.revalidate();
+ panel.repaint(0);
+ }
+
+ /**
+ * Si un groupement par pr\xE9fixe est demand\xE9, les lignes vont \xEAtre r\xE9agenc\xE9es pour cela.
+ *
+ * @param lines
+ */
+ private void manageGroupByPrefix(List<LegendLine> lines) {
+ if (lines.size() > 0 && StringUtils.isNotBlank(groupByLastSeparator)) {
+ //contiend les lines par prefixes
+ LinkedHashMap<String, List<LegendLine>> linesByPrefix = new LinkedHashMap<String, List<LegendLine>>();
+ for (LegendLine line : lines) {
+ String prefix = StringUtils.substringAfterLast(line.txt, groupByLastSeparator);
+ List<LegendLine> foundList = linesByPrefix.get(prefix);
+ if (foundList == null) {
+ foundList = new ArrayList<LegendLine>();
+ linesByPrefix.put(prefix, foundList);
+ }
+ foundList.add(line);
+ }
+ lines.clear();
+ for (Map.Entry<String, List<LegendLine>> entry : linesByPrefix.entrySet()) {
+ String key = entry.getKey();
+ List<LegendLine> linesByTitle = entry.getValue();
+ //s'il y a plusieurs courbes pour le pr\xE9fixe on fait un padding de 5 et on enl\xE8ve le padding
+ //si une seule line ou le pr\xE9fixe est vide on ne fait rien
+ if (StringUtils.isNotBlank(key) && linesByTitle.size() > 1) {
+ LegendLine titleLine = new LegendLine();
+ titleLine.tooltip = key;
+ titleLine.txt = key;
+ lines.add(titleLine);
+ for (LegendLine legendLine : linesByTitle) {
+ legendLine.txt = StringUtils.substringBeforeLast(legendLine.txt, groupByLastSeparator).trim();
+ legendLine.padding = 15;
+ }
+ }
+ lines.addAll(linesByTitle);
+ }
+ }
+ }
+
+ private void addLabelToPanel(LegendLine line) {
+ JLabel label = new JLabel();
+
+ label.setText(line.txt);
+ label.setToolTipText(line.tooltip);
+ if (line.courbe != null) {
EGIconForCourbe icon = new EGIconForCourbe();
- icon.updateFromCourbe(courbe);
label.setIcon(icon);
- label.setText(courbe.getTitle());
- label.setToolTipText(courbe.getTitle());
- label.putClientProperty("COURBE", courbe);
- label.setOpaque(false);
- panel.add(label);
+ icon.updateFromCourbe(line.courbe);
+ label.putClientProperty("COURBE", line.courbe);
label.addMouseListener(this);
+ } else {
+ label.setFont(BuLib.deriveFont(label.getFont(), Font.BOLD, 1));
}
- panel.revalidate();
- panel.repaint(0);
+ label.setOpaque(false);
+ label.setBorder(BorderFactory.createEmptyBorder(0, line.padding, 0, 0));
+ panel.add(label);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|