From: <had...@us...> - 2008-10-23 11:18:45
|
Revision: 4091 http://fudaa.svn.sourceforge.net/fudaa/?rev=4091&view=rev Author: hadouxad Date: 2008-10-23 11:14:24 +0000 (Thu, 23 Oct 2008) Log Message: ----------- - phase correction bug Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/pdf/CtuluFramePdfCustomViewer.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -1,33 +1,27 @@ package org.fudaa.ctulu.pdf; import java.awt.BorderLayout; -import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.ByteBuffer; -import java.nio.channels.FileChannel; import javax.swing.BorderFactory; -import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; -import javax.swing.JScrollPane; import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.CtuluUI; import com.memoire.bu.BuPanel; -import com.sun.pdfview.PDFFile; /** - * Fenetre viewer pdf custom + * Fenetre viewer pdf custom. Utilise un CtuluPanelPdfViewer + * * @author Adrien Hadoux - * + * */ public class CtuluFramePdfCustomViewer extends JFrame{ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -21,20 +21,19 @@ import java.util.ArrayList; import java.util.List; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.LinearRing; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.trace.TraceLigne; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; + /** * Un calque d'affichage d'une grille. * @@ -65,7 +64,8 @@ vue_ = _vue; setDestructible(false); setTitle(EbliLib.getS("Grille")); - setForeground(new Color(204, 153, 0)); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); } public int getNbXGraduations() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetBordureSingle.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -1,12 +1,15 @@ package org.fudaa.ebli.visuallibrary; +import java.awt.Graphics2D; import java.awt.Insets; +import java.awt.Rectangle; import java.util.HashMap; import java.util.List; import java.util.Map; import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ebli.animation.EbliAnimatedInterface; +import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.visuallibrary.animation.EbliWidgetAnimatedItem; import org.fudaa.ebli.visuallibrary.layout.OverlayLayoutGap; @@ -81,13 +84,16 @@ return intern_.isInEditMode_; } + OverlayLayoutGap layout_; + public EbliWidgetBordureSingle(final EbliWidget _intern, final boolean canMove, final boolean canResize) { super(_intern.getEbliScene(), false); intern_ = _intern; insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); - setLayout(new OverlayLayoutGap(insets_)); + layout_ = new OverlayLayoutGap(insets_); + setLayout(layout_); // -- ajout du child --// addChild(intern_); @@ -100,6 +106,44 @@ this.setController(controllerBordure_); } + + protected void paintWidget() { + + // -- mise a jour de la fonte que si il y a eu une modification --// + + final Graphics2D g = getGraphics(); + + final Rectangle rec = getClientArea(); + + g.translate(rec.x, rec.y); + + final TraceLigne l = new TraceLigne(getTraceLigneModel()); + + // // --test on autorise que si son widget fils le permet --// + if (this.getIntern().canColorBackground()) { + getGraphics().setColor(getColorFond()); + getGraphics().fillRect(0, 0, (int) (rec.width - l.getEpaisseur()), (int) (rec.height - l.getEpaisseur())); + } + + l.setCouleur(getColorContour()); + l.dessineRectangle(g, (int) (l.getEpaisseur() / 2), (int) (l.getEpaisseur() / 2), (int) (rec.width - l + .getEpaisseur()), (int) (rec.height - l.getEpaisseur())/* + * , rec.width + */); + + g.translate(-rec.x, -rec.y); + + // setBackground(getColorFond()); + + // layout_.justify(intern_); + insets_ = createInset((int) getTraceLigneModel().getEpaisseur()); + + layout_ = new OverlayLayoutGap(insets_); + setLayout(layout_); + revalidate(); + + } + public Insets createInset(final int epaisseur) { return new Insets(epaisseur, epaisseur, epaisseur, epaisseur); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/EbliWidgetShape.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -13,6 +13,7 @@ import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.visuallibrary.creator.ShapeCreator; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorLine; /** * Classe qui permet de dessinner des shapes. @@ -90,7 +91,7 @@ // Il faut prendre en compte l'epaisseur de la ligne final Rectangle2D.Float rec = new Rectangle2D.Float(ep / 2, ep / 2, recInit.width - ep, recInit.height - ep); Shape shape = shaper_.createShapeFor(rec, options_, ep); - if (getRotation() != 0) { + if (getRotation() != 0 && !(shaper_ instanceof ShapeCreatorLine)) { AffineTransform tr = AffineTransform.getRotateInstance(getRotation(), rec.getCenterX(), rec.getCenterY()); shape = tr.createTransformedShape(shape); final Rectangle2D newBound = shape.getBounds2D(); @@ -101,6 +102,10 @@ shape = AffineTransform.getScaleInstance(wRatio, hRatio).createTransformedShape(shape); tr = AffineTransform.getTranslateInstance(ep / 2, ep / 2); shape = tr.createTransformedShape(shape); + } else if (getRotation() != 0) { + // cas line + AffineTransform tr = AffineTransform.getRotateInstance(getRotation(), rec.getCenterX(), rec.getCenterY()); + shape = tr.createTransformedShape(shape); } if (fg_ != null) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetControllerCalque.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -150,6 +150,8 @@ } public boolean hasLegende() { + if (getNodeLegende() == null) + return false; return widget_.getEbliScene().isObject(getNodeLegende()); } Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/creator/ShapeCreatorLine.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -0,0 +1,26 @@ +package org.fudaa.ebli.visuallibrary.creator; + +import java.awt.Shape; +import java.awt.geom.Line2D; +import java.awt.geom.Rectangle2D.Float; +import java.util.Map; + +/** + * ShapeCreator pour les lignes classiques. + * + * @author Adrien Hadoux + * + */ +public class ShapeCreatorLine implements ShapeCreator { + + public Shape createShapeFor(Float _rec, Map _options, float _largeurTrait) { + // final GeneralPath path = new GeneralPath(); + // path.moveTo(_rec.x, _rec.y + _rec.height / 2f); + // path.lineTo(_rec.x + _rec.width, _rec.y + _rec.height / 2f); + // + // path.closePath(); + // return path; + return new Line2D.Float(_rec.x, _rec.y + _rec.height / 2f, _rec.x + _rec.width, _rec.y + _rec.height / 2f); + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/EbliWidgetControllerGraphe.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -169,8 +169,10 @@ public void actionPerformed(final ActionEvent e) { // -- si la widget a une bordure c'est la bordure que l on masque --// - final EbliWidget widgetUndo1 = widget_.getParentBordure(); - final EbliWidget widgetUndo2 = widgetGraphe_.getNodeLegende().getWidget().getParentBordure(); + final EbliWidget widgetGrapheBordure = widget_.getParentBordure(); + EbliWidget widgetLegendeBordure = null; + if(widgetGraphe_.getNodeLegende()!=null) + widgetLegendeBordure = widgetGraphe_.getNodeLegende().getWidget().getParentBordure(); // EbliNode n = (EbliNode) widget_.getEbliScene().findObject(widget_); // if (n.getCreator().getBordure() != null) { @@ -180,7 +182,7 @@ // widgetUndo1 = n.getCreator().getBordure(); // // } else { - widgetUndo1.setVisible(false); + widgetGrapheBordure.setVisible(false); // widgetUndo1 = widget_; // } @@ -191,14 +193,17 @@ // widgetUndo2 = widgetGraphe_.getNodeLegende().getCreator().getBordure(); // } else { // widgetGraphe_.getNodeLegende().getWidget().setVisible(false); - // - widgetUndo2.setVisible(false); + // + if(widgetLegendeBordure!=null) + widgetLegendeBordure.setVisible(false); // } // -- creation des comamndes undo/redo pour le masquage --// final ArrayList<EbliWidget> listeWidget = new ArrayList<EbliWidget>(); - listeWidget.add(widgetUndo1); - listeWidget.add(widgetUndo2); + listeWidget.add(widgetGrapheBordure); + + if(widgetLegendeBordure!=null) + listeWidget.add(widgetLegendeBordure); cmd_.addCmd(new CommandMasquer(listeWidget)); @@ -208,6 +213,9 @@ } public boolean hasLegende() { + if (widgetGraphe_.getNodeLegende() == null) + return false; + return widget_.getEbliScene().isObject(widgetGraphe_.getNodeLegende()); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/tree/EbliWidgetTreeTableNode.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -9,7 +9,9 @@ import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.actions.CommandMasquer; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetControllerCalque; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetControllerGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.netbeans.api.visual.model.ObjectScene; @@ -91,21 +93,26 @@ listeWidgetUndo.add(((EbliNode) getUserObject()).getWidget()); // -- cas particulier si il s agit d un calque ou d un graphe, on masque - // les sous fils --// + // aussi + if ((((EbliNode) getUserObject()).getWidget()) instanceof EbliWidgetBordureSingle && (((EbliNode) getUserObject()).getWidget()).getChildren() != null) { if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetVueCalque) { final EbliWidgetVueCalque wid = (EbliWidgetVueCalque) (((EbliNode) getUserObject()).getWidget()) .getChildren().get(0); + if (((EbliWidgetControllerCalque) wid.getController()).hasLegende()) { wid.nodeLegende.getWidget().setVisible(((Boolean) _value).booleanValue()); listeWidgetUndo.add(wid.nodeLegende.getWidget()); + } } else if ((((EbliNode) getUserObject()).getWidget()).getChildren().get(0) instanceof EbliWidgetGraphe) { final EbliWidgetGraphe wid = (EbliWidgetGraphe) (((EbliNode) getUserObject()).getWidget()).getChildren() .get(0); + if (((EbliWidgetControllerGraphe) wid.getController()).hasLegende()) { wid.getNodeLegende().getWidget().setVisible(((Boolean) _value).booleanValue()); listeWidgetUndo.add(wid.getNodeLegende().getWidget()); + } } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-23 09:39:33 UTC (rev 4090) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2008-10-23 11:14:24 UTC (rev 4091) @@ -53,6 +53,7 @@ import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorEllipse; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorFleche; +import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorLine; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorRectangle; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.actions.TrPostActionChangeSceneForWidget; @@ -261,6 +262,19 @@ return nodeLegende; } + public EbliNode addLigne() { + // -- ajout du rectangle --// + final EbliNodeDefault nodeLigne = new EbliNodeDefault(); + nodeLigne.setTitle("Ligne"); + nodeLigne.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorLine())); + nodeLigne.setPreferedSize(new Dimension(200, 100)); + nodeLigne.setPreferedLocation(new Point(350, 125)); + // ajout du node au layout + addNode(nodeLigne); + + return nodeLigne; + } + public EbliNode addCercle() { // -- ajout du rectangle --// final EbliNodeDefault nodeCercle = new EbliNodeDefault(); @@ -367,6 +381,15 @@ // TODO a revoir _l.add(new EbliWidgetActiontextEditor(getSceneCourante())); + // -- ligne --// + _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Ligne"), EbliResource.EBLI.getToolIcon("trait"), + "WIDGETLINE") { + @Override + public void actionPerformed(final ActionEvent _evt) { + addLigne(); + } + }); + // -- palette fleche --// _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Fleche"), EbliResource.EBLI.getToolIcon("crystal_bu_link"), "WIDGETFLECHE") { @@ -375,6 +398,16 @@ addFleche(); } }); + + // -- palette double fleche --// + // crystal_bu_scrollpane_corner.png + _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Double Fleche"), EbliResource.EBLI + .getToolIcon("crystal_bu_scrollpane_corner"), "WIDGETDBLFLECHE") { + @Override + public void actionPerformed(final ActionEvent _evt) { + addFleche(); + } + }); // -- palette Ellipse --// _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Ellipse"), EbliResource.EBLI.getToolIcon("ellip"), "WIDGETELLIPSE") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |