Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: gef/src/org/tigris/gef/presentation Fig.java FigGroup.java FigText.java

gef
Discussion topic

Back to topic list

CVS update: gef/src/org/tigris/gef/presentation Fig.java FigGroup.java FigText.java

Reply

Author toby
Full name Toby Baier
Date 2000-11-08 05:29:14 PST
Message User: toby
  Date: 00/11/08 05:29:14

  Modified: src build.xml
               src/org/tigris/gef/presentation Fig.java FigGroup.java
                        FigText.java
  Log:
  moved the functionality from ArgoUMLs FigCompartments to all GEF Figs. moved
  funct from ArgoUMLs FigNodeWithCompartments to GEF FigGroup. Should keep GEF
  downward compatible.
  I also added a "run" target to build.xml for the BasicApplication
  Obtained from:Toby
  Submitted by:Toby
  
  Revision Changes Path
  1.6 +13 -2 gef/src/build.xml
  
  Index: build.xml
  ====================​====================​====================​=======
  RCS file: /cvs/gef/src/build.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build.xml 2000/10/05 11:45:47 1.5
  +++ build.xml 2000/11/08 13:29:13 1.6
  @@ -4,7 +4,7 @@
   
   
                              * ================== *
  - | How to build Argo |
  + | How to build GEF |
                              * ================== *
   
              Adaption from the FOP build.xml written by Stefano Mazzocchi
  @@ -138,7 +138,8 @@
       <echo message=" compile --> compiles the source code"/>
       <echo message=" dist --> generates the ${Name} distribution as .tar.gz and .zip"/>
       <echo message=" dist-src --> generates the ${Name} source distribution as .tar.gz and .zip"/>
  - <echo message=" clean --> cleans up the directory"/>
  + <echo message=" clean --> cleans up the directory"/>
  + <echo message=" run --> run sample BasicApplication"/>
       <echo message=" usage --> show this message (default)"/>
       <echo message=""/>
       <echo message=" See the comments inside the build.xml file for more details."/>
  @@ -241,6 +242,16 @@
   
     <target name="distclean" depends="clean">
       <deltree dir="${dist.dir}"/>
  + </target>
  +
  + <!-- ====================​====================​====================​======= -->
  + <!-- Run GEF sample BasicApplication from compiled sources -->
  + <!-- ====================​====================​====================​======= -->
  + <target name="run" depends="compile">
  + <echo message="--- Executing GEF sample BasicApplication ---"/>
  + <java classname="org.tigri​s.gef.demo.BasicAppl​ication"
  + fork="yes"
  + classpath="${build.​dest};${classpath}"​/>
     </target>
   
   </project>
  
  
  
  1.2 +16 -1 gef/src/org/tigris/g​ef/presentation/Fig.​java
  
  Index: Fig.java
  ====================​====================​====================​=======
  RCS file: /cvs/gef/src/org/tig​ris/gef/presentation​/Fig.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Fig.java 2000/09/04 12:38:49 1.1
  +++ Fig.java 2000/11/08 13:29:13 1.2
  @@ -26,7 +26,7 @@
   // File: Fig.java
   // Classes: Fig
   // Original Author: ics125 spring 1996
  -// $Id: Fig.java,v 1.1 2000/09/04 12:38:49 1sturm Exp $
  +// $Id: Fig.java,v 1.2 2000/11/08 13:29:13 toby Exp $
   
   import java.awt.*;
   import java.awt.event.*;
  @@ -105,6 +105,10 @@
   
     protected Fig _group = null;
   
  + /** True if the Fig is shown. This funct once was in FogComponent of ArgoUML */
  +
  + protected boolean _displayed = true;
  +
     ////////////////////​////////////////////​////////////////////​////
     // static initializer
   
  @@ -552,10 +556,12 @@
     /** Method to paint this Fig. By default it paints an "empty"
      * space, subclasses should override this method. */
     public void paint(Graphics g) {
  + if ( _displayed ) {
       g.setColor(Color.pink);
       g.fillRect(_x, _y, _w, _h);
       g.setColor(Color.black);
       g.drawString("(undefined)", _x + _w/2, _y + _h/2);
  + }
     }
     /** Return a point at the given distance along the path around this
      * Fig. By default, uses perimeter of the Fig's bounding
  @@ -800,4 +806,13 @@
     public boolean within(Rectangle r) {
       return r.contains(_x, _y) && r.contains(_x + _w, _y + _h);
     }
  +
  +
  + /** Returns true if it is to be displayed. */
  + public boolean isDisplayed() { return _displayed; }
  +
  + /** Determine if it is to be displayed. */
  + public void setDisplayed(boolean isDisplayed) { _displayed = isDisplayed; }
  +
  +
   } /* end class Fig */
  
  
  
  1.3 +31 -8 gef/src/org/tigris/g​ef/presentation/FigG​roup.java
  
  Index: FigGroup.java
  ====================​====================​====================​=======
  RCS file: /cvs/gef/src/org/tig​ris/gef/presentation​/FigGroup.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FigGroup.java 2000/09/29 13:55:26 1.2
  +++ FigGroup.java 2000/11/08 13:29:13 1.3
  @@ -30,7 +30,7 @@
   // File: FigGroup.java
   // Classes: FigGroup
   // Original Author: jrobbins at ics dot uci dot edu
  -// $Id: FigGroup.java,v 1.2 2000/09/29 13:55:26 boger Exp $
  +// $Id: FigGroup.java,v 1.3 2000/11/08 13:29:13 toby Exp $
   
   import java.util.*;
   import java.awt.*;
  @@ -80,7 +80,7 @@
     /** Accumulate a bounding box for all the Figs in the group. */
     public void calcBounds() {
       Rectangle bbox; // could be blank final
  - Enumeration figs = _figs.elements();
  + Enumeration figs = getDisplayedFigs().elements();
       if (figs.hasMoreElements()) bbox = ((Fig)figs.nextEleme​nt()).getBounds();
       else bbox = new Rectangle(0, 0, 0, 0);
       while (figs.hasMoreElements()) {
  @@ -219,7 +219,7 @@
       Enumeration figs = elements();
       while (figs.hasMoreElements()) {
         Fig f = (Fig) figs.nextElement();
  - f.paint(g);
  + if (f.isDisplayed()) f.paint(g);
       }
     }
     /** Delete all Fig's from the group. Fires PropertyChange with "bounds".*/
  @@ -242,6 +242,27 @@
       calcBounds();
       firePropChange("bounds", oldBounds, getBounds());
     }
  +
  + /** Returns a list of the displayable Figs enclosed.
  + * e.g. returns the list of enclosed Figs, without
  + * the Compartments that should not be displayed. */
  + // added by Eric Lefevre 25 Mar 1999
  + // moved here by Toby 07 Nov 2000
  + public Vector getDisplayedFigs() {
  + Vector displayed = (Vector)getFigs().clone();
  + Fig f;
  +
  + for (int i=0; i< _figs.size(); i++) {
  + f = (Fig)_figs.elementAt(i);
  + // removes the compartments that are not to be displayed
  + if ( !(f).isDisplayed() ) {
  + displayed.removeElem​ent((Object)f);
  + }
  + }
  +
  + return displayed;
  + }
  +
     /** Set the bounding box to the given rect. Figs in the group are
      * scaled to fit. Fires PropertyChange with "bounds" */
     public void setBounds(int x, int y, int w, int h) {
  @@ -249,11 +270,13 @@
       Enumeration figs = _figs.elements();
       while (figs.hasMoreElements()) {
         Fig f = (Fig) figs.nextElement();
  - int newX = (_w == 0) ? x : x + ((f.getX() - _x) * w) / _w;
  - int newY = (_h == 0) ? y : y + ((f.getY() - _y) * h) / _h;
  - int newW = (_w == 0) ? 0 : (f.getWidth() * w) / _w;
  - int newH = (_h == 0) ? 0 : (f.getHeight() * h) / _h;
  - f.setBounds(newX, newY, newW, newH);
  + if (f.isDisplayed()) {
  + int newX = (_w == 0) ? x : x + ((f.getX() - _x) * w) / _w;
  + int newY = (_h == 0) ? y : y + ((f.getY() - _y) * h) / _h;
  + int newW = (_w == 0) ? 0 : f.getWidth() * (w / _w);
  + int newH = (_h == 0) ? 0 : f.getHeight() * (h / _h);
  + f.setBounds(newX, newY, newW, newH);
  + }
       }
       calcBounds(); //_x = x; _y = y; _w = w; _h = h;
       firePropChange("bounds", oldBounds, getBounds());
  
  
  
  1.2 +4 -2 gef/src/org/tigris/g​ef/presentation/FigT​ext.java
  
  Index: FigText.java
  ====================​====================​====================​=======
  RCS file: /cvs/gef/src/org/tig​ris/gef/presentation​/FigText.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FigText.java 2000/09/04 12:38:50 1.1
  +++ FigText.java 2000/11/08 13:29:13 1.2
  @@ -26,7 +26,7 @@
   // File: FigText.java
   // Classes: FigText
   // Original Author: ics125 spring 1996
  -// $Id: FigText.java,v 1.1 2000/09/04 12:38:50 1sturm Exp $
  +// $Id: FigText.java,v 1.2 2000/11/08 13:29:13 toby Exp $
   
   package org.tigris.gef.presentation;
   
  @@ -98,7 +98,7 @@
     protected int _rightMargin = 1;
   
     /** True if the FigText can only grow in size, never shrink. */
  - protected boolean _expandOnly = false;
  + protected boolean _expandOnly = true;
   
     /** Text justification can be JUSTIFY_LEFT, JUSTIFY_RIGHT, or JUSTIFY_CENTER. */
     protected int _justification = JUSTIFY_LEFT;
  @@ -519,6 +519,7 @@
      * now text objects can get larger when you type more, but they
      * do not get smaller when you backspace. */
     public void calcBounds() {
  + Rectangle bounds = getBounds();
       if (_font == null) return;
       if (_fm == null) _fm = Toolkit.getDefaultTo​olkit().getFontMetri​cs(_font);
       int overallW = 0;
  @@ -551,6 +552,7 @@
       }
       _w = _expandOnly ? Math.max(_w, overallW) : overallW;
       _h = _expandOnly ? Math.max(_h, overallH) : overallH;
  +
     }
   } /* end class FigText */

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: gef/src/org/tigris/gef/presentation Fig.java FigGroup.java FigText.java toby Toby Baier 2000-11-08 05:29:14 PST
Messages per page: