diff --git a/src/EX1VetorLista.java b/src/EX1VetorLista.java index 7b26d33..a5acf6c 100644 --- a/src/EX1VetorLista.java +++ b/src/EX1VetorLista.java @@ -1,12 +1,12 @@ -import iged.GraficoAED; -import iged.IGEDConst; -import iged.grafico.manager.AcaoUsuario; -import iged.grafico.manager.GraphicManager; -import iged.grafico.manager.PaintUI; -import iged.grafico.manager.Quadro; -import iged.grafico.struct.LinkedList; -import iged.grafico.struct.LinkedListNode; -import iged.grafico.struct.Struct; +import br.ufpb.iged.GraficoAED; +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.grafico.manager.AcaoUsuario; +import br.ufpb.iged.grafico.manager.GraphicManager; +import br.ufpb.iged.grafico.manager.PaintUI; +import br.ufpb.iged.grafico.manager.Quadro; +import br.ufpb.iged.grafico.struct.LinkedList; +import br.ufpb.iged.grafico.struct.LinkedListNode; +import br.ufpb.iged.grafico.struct.Struct; import java.util.Timer; import java.util.TimerTask; diff --git a/src/Ex1InvertVetor.java b/src/Ex1InvertVetor.java index 95a25f3..a843f9e 100644 --- a/src/Ex1InvertVetor.java +++ b/src/Ex1InvertVetor.java @@ -1,12 +1,12 @@ -import iged.GraficoAED; -import iged.IGEDConst; -import iged.grafico.manager.AcaoUsuario; -import iged.grafico.manager.GraphicManager; -import iged.grafico.manager.PaintUI; -import iged.grafico.manager.Quadro; -import iged.grafico.struct.LinkedList; -import iged.grafico.struct.LinkedListNode; -import iged.grafico.struct.Struct; +import br.ufpb.iged.GraficoAED; +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.grafico.manager.AcaoUsuario; +import br.ufpb.iged.grafico.manager.GraphicManager; +import br.ufpb.iged.grafico.manager.PaintUI; +import br.ufpb.iged.grafico.manager.Quadro; +import br.ufpb.iged.grafico.struct.LinkedList; +import br.ufpb.iged.grafico.struct.LinkedListNode; +import br.ufpb.iged.grafico.struct.Struct; public class Ex1InvertVetor implements AcaoUsuario { diff --git a/src/Ex2Listas.java b/src/Ex2Listas.java index 20c1293..c8e0ef6 100644 --- a/src/Ex2Listas.java +++ b/src/Ex2Listas.java @@ -1,12 +1,12 @@ -import iged.GraficoAED; -import iged.IGEDConst; -import iged.grafico.manager.AcaoUsuario; -import iged.grafico.manager.GraphicManager; -import iged.grafico.manager.PaintUI; -import iged.grafico.manager.Quadro; -import iged.grafico.struct.LinkedList; -import iged.grafico.struct.LinkedListNode; -import iged.grafico.struct.Struct; +import br.ufpb.iged.GraficoAED; +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.grafico.manager.AcaoUsuario; +import br.ufpb.iged.grafico.manager.GraphicManager; +import br.ufpb.iged.grafico.manager.PaintUI; +import br.ufpb.iged.grafico.manager.Quadro; +import br.ufpb.iged.grafico.struct.LinkedList; +import br.ufpb.iged.grafico.struct.LinkedListNode; +import br.ufpb.iged.grafico.struct.Struct; public class Ex2Listas implements AcaoUsuario { diff --git a/src/IGED.java b/src/IGED.java index ab49eaa..eafbe2b 100644 --- a/src/IGED.java +++ b/src/IGED.java @@ -1,8 +1,8 @@ -import iged.IGEDConst; -import iged.Interpretador; -import iged.grafico.manager.AcaoUsuario; -import iged.grafico.manager.PaintUI; -import iged.grafico.manager.Quadro; +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.Interpretador; +import br.ufpb.iged.grafico.manager.AcaoUsuario; +import br.ufpb.iged.grafico.manager.PaintUI; +import br.ufpb.iged.grafico.manager.Quadro; import java.util.StringTokenizer; public class IGED implements AcaoUsuario{ diff --git a/src/MainTree.java b/src/MainTree.java index c41f556..16cfb9c 100644 --- a/src/MainTree.java +++ b/src/MainTree.java @@ -1,8 +1,8 @@ -import iged.grafico.manager.AcaoUsuario; -import iged.grafico.manager.PaintUI; -import iged.grafico.manager.Quadro; -import iged.grafico.struct.NodeTree; +import br.ufpb.iged.grafico.manager.AcaoUsuario; +import br.ufpb.iged.grafico.manager.PaintUI; +import br.ufpb.iged.grafico.manager.Quadro; +import br.ufpb.iged.grafico.struct.NodeTree; import java.awt.geom.Point2D; diff --git a/src/TesteBinaryTree.java b/src/TesteBinaryTree.java index a07c4e1..7086d16 100644 --- a/src/TesteBinaryTree.java +++ b/src/TesteBinaryTree.java @@ -1,10 +1,10 @@ -import iged.IGEDConst; -import iged.grafico.manager.AcaoUsuario; -import iged.grafico.manager.GraphicManager; -import iged.grafico.manager.PaintUI; -import iged.grafico.manager.Quadro; -import iged.grafico.struct.BinaryTree; -import iged.grafico.struct.NodeTree; +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.grafico.manager.AcaoUsuario; +import br.ufpb.iged.grafico.manager.GraphicManager; +import br.ufpb.iged.grafico.manager.PaintUI; +import br.ufpb.iged.grafico.manager.Quadro; +import br.ufpb.iged.grafico.struct.BinaryTree; +import br.ufpb.iged.grafico.struct.NodeTree; import java.awt.geom.Point2D; diff --git a/src/iged/GraficoAED.java b/src/br/ufpb/iged/GraficoAED.java similarity index 93% rename from src/iged/GraficoAED.java rename to src/br/ufpb/iged/GraficoAED.java index 78658e3..6e3e654 100644 --- a/src/iged/GraficoAED.java +++ b/src/br/ufpb/iged/GraficoAED.java @@ -1,12 +1,12 @@ -package iged; +package br.ufpb.iged; -import iged.grafico.manager.ReferenceExistingException; +import br.ufpb.iged.grafico.manager.ReferenceExistingException; import java.util.List; -import iged.AED.Appraiser; -import iged.AED.StructManager; -import iged.grafico.manager.GraphicManager; -import iged.grafico.manager.Quadro; +import br.ufpb.iged.avaliador.AED.Appraiser; +import br.ufpb.iged.avaliador.AED.StructManager; +import br.ufpb.iged.grafico.manager.GraphicManager; +import br.ufpb.iged.grafico.manager.Quadro; public class GraficoAED { diff --git a/src/iged/IGEDConst.java b/src/br/ufpb/iged/IGEDConst.java similarity index 96% rename from src/iged/IGEDConst.java rename to src/br/ufpb/iged/IGEDConst.java index f7806c1..52698bc 100644 --- a/src/iged/IGEDConst.java +++ b/src/br/ufpb/iged/IGEDConst.java @@ -1,4 +1,4 @@ -package iged; +package br.ufpb.iged; public interface IGEDConst { diff --git a/src/iged/Interpretador.java b/src/br/ufpb/iged/Interpretador.java similarity index 99% rename from src/iged/Interpretador.java rename to src/br/ufpb/iged/Interpretador.java index cfd1109..9f43e56 100644 --- a/src/iged/Interpretador.java +++ b/src/br/ufpb/iged/Interpretador.java @@ -1,6 +1,6 @@ -package iged; +package br.ufpb.iged; -import iged.grafico.manager.*; +import br.ufpb.iged.grafico.manager.*; import java.util.StringTokenizer; /* diff --git a/src/iged/AED/Appraiser.java b/src/br/ufpb/iged/avaliador/AED/Appraiser.java similarity index 94% rename from src/iged/AED/Appraiser.java rename to src/br/ufpb/iged/avaliador/AED/Appraiser.java index 8dea33e..7963a7c 100644 --- a/src/iged/AED/Appraiser.java +++ b/src/br/ufpb/iged/avaliador/AED/Appraiser.java @@ -1,53 +1,53 @@ -package iged.AED; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ArrayList; - - -public class Appraiser { - - private Map structOriginal; - private Map structReplica; - private List correct; - - public Appraiser(StructManager sm){ - structOriginal = new HashMap(); - structReplica = new HashMap(); - - for(String k : sm.original.struct.keySet()){ - this.structOriginal.put(k, sm.original.struct.get(k).getStruct()); - } - - for(String k : sm.replica.struct.keySet()){ - this.structReplica.put(k, sm.replica.struct.get(k).getStruct()); - } - - } - - public boolean compare(Struct s1, Struct s2){ - return s1.compare(s2); - } - - public boolean assess(){ - correct = new ArrayList(); - for(String keyAlun: this.structOriginal.keySet()){ - for(String keyProf: this.structReplica.keySet()){ - if(this.compare(this.structReplica.get(keyProf), this.structOriginal.get(keyAlun))){ - correct.add(keyAlun); - break; - } - } - - } - if(this.structReplica.size() == correct.size()){ - return true; - } - return false; - } - - public List correct(){ - return this.correct; - } - -} +package br.ufpb.iged.avaliador.AED; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.ArrayList; + + +public class Appraiser { + + private Map structOriginal; + private Map structReplica; + private List correct; + + public Appraiser(StructManager sm){ + structOriginal = new HashMap(); + structReplica = new HashMap(); + + for(String k : sm.original.struct.keySet()){ + this.structOriginal.put(k, sm.original.struct.get(k).getStruct()); + } + + for(String k : sm.replica.struct.keySet()){ + this.structReplica.put(k, sm.replica.struct.get(k).getStruct()); + } + + } + + public boolean compare(Struct s1, Struct s2){ + return s1.compare(s2); + } + + public boolean assess(){ + correct = new ArrayList(); + for(String keyAlun: this.structOriginal.keySet()){ + for(String keyProf: this.structReplica.keySet()){ + if(this.compare(this.structReplica.get(keyProf), this.structOriginal.get(keyAlun))){ + correct.add(keyAlun); + break; + } + } + + } + if(this.structReplica.size() == correct.size()){ + return true; + } + return false; + } + + public List correct(){ + return this.correct; + } + +} diff --git a/src/iged/AED/LinkedList.java b/src/br/ufpb/iged/avaliador/AED/LinkedList.java similarity index 93% rename from src/iged/AED/LinkedList.java rename to src/br/ufpb/iged/avaliador/AED/LinkedList.java index d9a6320..bafa6eb 100644 --- a/src/iged/AED/LinkedList.java +++ b/src/br/ufpb/iged/avaliador/AED/LinkedList.java @@ -1,87 +1,87 @@ -package iged.AED; - -import iged.IGEDConst; - -public class LinkedList extends Struct { - - private LinkedListNode start; - private int tamanho = 0; - - public LinkedList() { - super(IGEDConst.LISTA); - } - - public void setStart(LinkedListNode start) { - this.start = start; - } - - public LinkedListNode getStart() { - return this.start; - } - - @Override - public boolean compare(Struct lk) { - if(!(lk instanceof LinkedList)) - return false; - if (lk.getType() == IGEDConst.LISTA) { - LinkedList l = ((LinkedList) lk); - - if(this.tamanho != l.tamanho) - return false; - - LinkedListNode thisNode = this.start; - LinkedListNode lkNode = l.getStart(); - while (thisNode != null && lkNode != null) { - if (!thisNode.compare(lkNode)) { - return false; - } - thisNode = thisNode.next(); - lkNode = lkNode.next(); - } - if(thisNode == null && lkNode == null) - return true; - else - return false; - } - return false; - } - - @Override - public Node readField(int field) { - - switch (field) { - - case IGEDConst.LISTA_INICIO: - return this.start; - default: - break; - - } - return null; - } - - @Override - public void writeField(Struct n, int field) { - switch (field) { - case IGEDConst.LISTA_INICIO: - this.start = (LinkedListNode) n; - break; - - - default: - break; - - } - - } - - @Override - public void writeInfo(int value) { - this.tamanho = value; - } - - @Override - public int readInfo() { - return this.tamanho; - } -} +package br.ufpb.iged.avaliador.AED; + +import br.ufpb.iged.IGEDConst; + +public class LinkedList extends Struct { + + private LinkedListNode start; + private int tamanho = 0; + + public LinkedList() { + super(IGEDConst.LISTA); + } + + public void setStart(LinkedListNode start) { + this.start = start; + } + + public LinkedListNode getStart() { + return this.start; + } + + @Override + public boolean compare(Struct lk) { + if(!(lk instanceof LinkedList)) + return false; + if (lk.getType() == IGEDConst.LISTA) { + LinkedList l = ((LinkedList) lk); + + if(this.tamanho != l.tamanho) + return false; + + LinkedListNode thisNode = this.start; + LinkedListNode lkNode = l.getStart(); + while (thisNode != null && lkNode != null) { + if (!thisNode.compare(lkNode)) { + return false; + } + thisNode = thisNode.next(); + lkNode = lkNode.next(); + } + if(thisNode == null && lkNode == null) + return true; + else + return false; + } + return false; + } + + @Override + public Node readField(int field) { + + switch (field) { + + case IGEDConst.LISTA_INICIO: + return this.start; + default: + break; + + } + return null; + } + + @Override + public void writeField(Struct n, int field) { + switch (field) { + case IGEDConst.LISTA_INICIO: + this.start = (LinkedListNode) n; + break; + + + default: + break; + + } + + } + + @Override + public void writeInfo(int value) { + this.tamanho = value; + } + + @Override + public int readInfo() { + return this.tamanho; + } +} diff --git a/src/iged/AED/LinkedListNode.java b/src/br/ufpb/iged/avaliador/AED/LinkedListNode.java similarity index 90% rename from src/iged/AED/LinkedListNode.java rename to src/br/ufpb/iged/avaliador/AED/LinkedListNode.java index 9f90891..13f4f82 100644 --- a/src/iged/AED/LinkedListNode.java +++ b/src/br/ufpb/iged/avaliador/AED/LinkedListNode.java @@ -1,64 +1,64 @@ -package iged.AED; - -import iged.IGEDConst; - -public class LinkedListNode extends Node{ - - private LinkedListNode next; - - public LinkedListNode() { - super(IGEDConst.NODE); - } - - public void setNext(LinkedListNode nodeNext){ - this.next = nodeNext; - } - - public LinkedListNode next(){ - return this.next; - } - - @Override - public Node readField(int field) { - - switch(field){ - - case IGEDConst.NODE_PROX: - - return this.next; - - - default: - break; - - } - return null; - } - - @Override - public void writeField(Struct n, int field) { - if(field == IGEDConst.NODE_PROX){ - this.next = (LinkedListNode)n; - } - } - - @Override - public boolean compare(Struct node){ - if(node instanceof LinkedListNode) - return content == ((LinkedListNode)node).getContent(); - else - return false; - } - - @Override - public void writeInfo(int value) { - this.content = value; - - } - - @Override - public int readInfo() { - return this.content; - } - -} +package br.ufpb.iged.avaliador.AED; + +import br.ufpb.iged.IGEDConst; + +public class LinkedListNode extends Node{ + + private LinkedListNode next; + + public LinkedListNode() { + super(IGEDConst.NODE); + } + + public void setNext(LinkedListNode nodeNext){ + this.next = nodeNext; + } + + public LinkedListNode next(){ + return this.next; + } + + @Override + public Node readField(int field) { + + switch(field){ + + case IGEDConst.NODE_PROX: + + return this.next; + + + default: + break; + + } + return null; + } + + @Override + public void writeField(Struct n, int field) { + if(field == IGEDConst.NODE_PROX){ + this.next = (LinkedListNode)n; + } + } + + @Override + public boolean compare(Struct node){ + if(node instanceof LinkedListNode) + return content == ((LinkedListNode)node).getContent(); + else + return false; + } + + @Override + public void writeInfo(int value) { + this.content = value; + + } + + @Override + public int readInfo() { + return this.content; + } + +} diff --git a/src/iged/AED/Node.java b/src/br/ufpb/iged/avaliador/AED/Node.java similarity index 87% rename from src/iged/AED/Node.java rename to src/br/ufpb/iged/avaliador/AED/Node.java index 195c62f..2476faf 100644 --- a/src/iged/AED/Node.java +++ b/src/br/ufpb/iged/avaliador/AED/Node.java @@ -1,19 +1,19 @@ -package iged.AED; - -public abstract class Node extends Struct{ - - protected int content; - - public Node(int type){ - super(type); - } - - public int getContent(){ - return content; - } - - public void setContent(int content){ - this.content = content; - } - -} +package br.ufpb.iged.avaliador.AED; + +public abstract class Node extends Struct{ + + protected int content; + + public Node(int type){ + super(type); + } + + public int getContent(){ + return content; + } + + public void setContent(int content){ + this.content = content; + } + +} diff --git a/src/iged/AED/Struct.java b/src/br/ufpb/iged/avaliador/AED/Struct.java similarity index 90% rename from src/iged/AED/Struct.java rename to src/br/ufpb/iged/avaliador/AED/Struct.java index 462c482..338e688 100644 --- a/src/iged/AED/Struct.java +++ b/src/br/ufpb/iged/avaliador/AED/Struct.java @@ -1,28 +1,28 @@ -package iged.AED; - -public abstract class Struct{ - - private int type; - - public Struct(int type){ - this.type = type; - } - - public boolean equalsType(Struct s){ - return this.type == s.getType(); - } - - public int getType() { - return type; - } - - public abstract Node readField(int field); - - public abstract void writeField(Struct n ,int field); - - public abstract void writeInfo(int value); - - public abstract int readInfo(); - - public abstract boolean compare(Struct s); -} +package br.ufpb.iged.avaliador.AED; + +public abstract class Struct{ + + private int type; + + public Struct(int type){ + this.type = type; + } + + public boolean equalsType(Struct s){ + return this.type == s.getType(); + } + + public int getType() { + return type; + } + + public abstract Node readField(int field); + + public abstract void writeField(Struct n ,int field); + + public abstract void writeInfo(int value); + + public abstract int readInfo(); + + public abstract boolean compare(Struct s); +} diff --git a/src/iged/AED/StructFactory.java b/src/br/ufpb/iged/avaliador/AED/StructFactory.java similarity index 94% rename from src/iged/AED/StructFactory.java rename to src/br/ufpb/iged/avaliador/AED/StructFactory.java index 3bc945b..5e4e7c0 100644 --- a/src/iged/AED/StructFactory.java +++ b/src/br/ufpb/iged/avaliador/AED/StructFactory.java @@ -1,75 +1,75 @@ -package iged.AED; - -import iged.IGEDConst; - -public class StructFactory { - - private int lengthStruct = 10; - private static StructFactory sf = null; - - - private StructFactory(){ - - } - - public static synchronized StructFactory getInstance(){ - if(sf == null){ - sf = new StructFactory(); - } - return sf; - } - - public Struct createStruct(int type) { - Struct s; - switch (type) { - case IGEDConst.LISTA: - s = new LinkedList(); - break; - case IGEDConst.VETOR: - s = new Vector(lengthStruct); - break; - case IGEDConst.NODE: - s = new LinkedListNode(); - break; - default: - return null; - - } - return s; - //StructManager.pilha.add(new WrapperStruct(s)); - } - - /*public WrapperStruct duplicateStruct(Struct s) { - if (s != null) { - switch (s.getType()) { - - case IGEDConst.VETOR: - this.lengthStruct = ((Vector) s).getLength(); - this.createStruct(IGEDConst.VETOR); - return StructManager.pilha.pop(); - case IGEDConst.LISTA: - this.createStruct(IGEDConst.LISTA); - return StructManager.pilha.pop(); - case IGEDConst.NODE: - this.createStruct(IGEDConst.NODE); - return StructManager.pilha.pop(); - default: - return null; - } - } - else { - this.createStruct(IGEDConst.LISTA); - return StructManager.pilha.pop(); - } - }*/ - - - public void setLengthStruct(int lengthStruct) { - this.lengthStruct = lengthStruct; - } - - public int getLengthStruct() { - return this.lengthStruct; - } - -} +package br.ufpb.iged.avaliador.AED; + +import br.ufpb.iged.IGEDConst; + +public class StructFactory { + + private int lengthStruct = 10; + private static StructFactory sf = null; + + + private StructFactory(){ + + } + + public static synchronized StructFactory getInstance(){ + if(sf == null){ + sf = new StructFactory(); + } + return sf; + } + + public Struct createStruct(int type) { + Struct s; + switch (type) { + case IGEDConst.LISTA: + s = new LinkedList(); + break; + case IGEDConst.VETOR: + s = new Vector(lengthStruct); + break; + case IGEDConst.NODE: + s = new LinkedListNode(); + break; + default: + return null; + + } + return s; + //StructManager.pilha.add(new WrapperStruct(s)); + } + + /*public WrapperStruct duplicateStruct(Struct s) { + if (s != null) { + switch (s.getType()) { + + case IGEDConst.VETOR: + this.lengthStruct = ((Vector) s).getLength(); + this.createStruct(IGEDConst.VETOR); + return StructManager.pilha.pop(); + case IGEDConst.LISTA: + this.createStruct(IGEDConst.LISTA); + return StructManager.pilha.pop(); + case IGEDConst.NODE: + this.createStruct(IGEDConst.NODE); + return StructManager.pilha.pop(); + default: + return null; + } + } + else { + this.createStruct(IGEDConst.LISTA); + return StructManager.pilha.pop(); + } + }*/ + + + public void setLengthStruct(int lengthStruct) { + this.lengthStruct = lengthStruct; + } + + public int getLengthStruct() { + return this.lengthStruct; + } + +} diff --git a/src/iged/AED/StructManager.java b/src/br/ufpb/iged/avaliador/AED/StructManager.java similarity index 96% rename from src/iged/AED/StructManager.java rename to src/br/ufpb/iged/avaliador/AED/StructManager.java index 38fdfa0..c5778d0 100644 --- a/src/iged/AED/StructManager.java +++ b/src/br/ufpb/iged/avaliador/AED/StructManager.java @@ -1,248 +1,248 @@ -package iged.AED; - -import iged.IGEDConst; - -public class StructManager { - StructManagerInstance original; - StructManagerInstance replica; - private int mode; - private StructFactory factory; - - public StructManager() { - original = new StructManagerInstance(); - replica = new StructManagerInstance(); - factory = StructFactory.getInstance(); - mode = IGEDConst.MODE_BOTH; - } - - public boolean removeStruct(String id) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - return this.replica.removeStruct(id); - case IGEDConst.MODE_BOTH: - this.original.removeStruct(id); - return this.replica.removeStruct(id); - case IGEDConst.MODE_STUDENT: - return this.original.removeStruct(id); - default: - return false; - } - } - - public void setMode(int m) { - if (m == IGEDConst.MODE_BOTH || m == IGEDConst.MODE_STUDENT || m == IGEDConst.MODE_PROFESSOR) { - this.mode = m; - } - } - - public void set_LengthStruct(int lengthStruct) { - this.factory.setLengthStruct(lengthStruct); - } - - public void createStruct(int type) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.createStruct(type); - break; - case IGEDConst.MODE_BOTH: - this.original.createStruct(type); - this.replica.createStruct(type); - break; - case IGEDConst.MODE_STUDENT: - this.original.createStruct(type); - break; - default: - break; - } - } - - public void createReference(String id, int type) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.createReference(id, type); - break; - case IGEDConst.MODE_BOTH: - this.original.createReference(id, type); - this.replica.createReference(id, type); - break; - case IGEDConst.MODE_STUDENT: - this.original.createReference(id, type); - break; - default: - break; - } - } - - public void readReference(String id) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.readReference(id); - break; - case IGEDConst.MODE_BOTH: - this.original.readReference(id); - this.replica.readReference(id); - break; - case IGEDConst.MODE_STUDENT: - this.original.readReference(id); - break; - default: - break; - } - } - - public void writeReference() { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.writeReference(); - break; - case IGEDConst.MODE_BOTH: - this.original.writeReference(); - this.replica.writeReference(); - break; - case IGEDConst.MODE_STUDENT: - this.original.writeReference(); - break; - default: - break; - } - } - - public void readReferenceField(int field) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.readReferenceField(field); - break; - case IGEDConst.MODE_BOTH: - this.original.readReferenceField(field); - this.replica.readReferenceField(field); - break; - case IGEDConst.MODE_STUDENT: - this.original.readReferenceField(field); - break; - default: - break; - } - } - - public void writeReferenceField(int field) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.writeReferenceField(field); - break; - case IGEDConst.MODE_BOTH: - this.original.writeReferenceField(field); - this.replica.writeReferenceField(field); - break; - case IGEDConst.MODE_STUDENT: - this.original.writeReferenceField(field); - break; - default: - break; - } - } - - public void writeReferenceFieldNull(int field) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.writeReferenceFieldNull(field); - break; - case IGEDConst.MODE_BOTH: - this.original.writeReferenceFieldNull(field); - this.replica.writeReferenceFieldNull(field); - break; - case IGEDConst.MODE_STUDENT: - this.original.writeReferenceFieldNull(field); - break; - default: - break; - } - } - - public int readInfo() { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - return this.replica.readInfo(); - case IGEDConst.MODE_BOTH: - this.replica.readInfo(); - return this.original.readInfo(); - case IGEDConst.MODE_STUDENT: - return this.original.readInfo(); - - default: - return Integer.MIN_VALUE; - } - } - - public void writeInfo(int value) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.writeInfo(value); - break; - case IGEDConst.MODE_BOTH: - this.replica.writeInfo(value); - this.original.writeInfo(value); - break; - case IGEDConst.MODE_STUDENT: - this.original.writeInfo(value); - break; - default: - break; - } - } - - public void setPosVector(int pos) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.setPosVector(pos); - break; - case IGEDConst.MODE_BOTH: - this.replica.setPosVector(pos); - this.original.setPosVector(pos); - break; - case IGEDConst.MODE_STUDENT: - this.original.setPosVector(pos); - break; - default: - break; - } - } - - public void insertStruct(String id, Struct s) { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.insertStruct(id, s); - break; - case IGEDConst.MODE_BOTH: - this.replica.insertStruct(id, s); - this.original.insertStruct(id, s); - break; - case IGEDConst.MODE_STUDENT: - this.original.insertStruct(id, s); - break; - default: - break; - } - } - - public void endCommand() { - switch (mode) { - case IGEDConst.MODE_PROFESSOR: - this.replica.endCommand(); - break; - case IGEDConst.MODE_BOTH: - this.replica.endCommand(); - this.original.endCommand(); - break; - case IGEDConst.MODE_STUDENT: - this.original.endCommand(); - break; - default: - break; - } - } - - public void clear(){ - original.clear(); - replica.clear(); - } -} +package br.ufpb.iged.avaliador.AED; + +import br.ufpb.iged.IGEDConst; + +public class StructManager { + StructManagerInstance original; + StructManagerInstance replica; + private int mode; + private StructFactory factory; + + public StructManager() { + original = new StructManagerInstance(); + replica = new StructManagerInstance(); + factory = StructFactory.getInstance(); + mode = IGEDConst.MODE_BOTH; + } + + public boolean removeStruct(String id) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + return this.replica.removeStruct(id); + case IGEDConst.MODE_BOTH: + this.original.removeStruct(id); + return this.replica.removeStruct(id); + case IGEDConst.MODE_STUDENT: + return this.original.removeStruct(id); + default: + return false; + } + } + + public void setMode(int m) { + if (m == IGEDConst.MODE_BOTH || m == IGEDConst.MODE_STUDENT || m == IGEDConst.MODE_PROFESSOR) { + this.mode = m; + } + } + + public void set_LengthStruct(int lengthStruct) { + this.factory.setLengthStruct(lengthStruct); + } + + public void createStruct(int type) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.createStruct(type); + break; + case IGEDConst.MODE_BOTH: + this.original.createStruct(type); + this.replica.createStruct(type); + break; + case IGEDConst.MODE_STUDENT: + this.original.createStruct(type); + break; + default: + break; + } + } + + public void createReference(String id, int type) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.createReference(id, type); + break; + case IGEDConst.MODE_BOTH: + this.original.createReference(id, type); + this.replica.createReference(id, type); + break; + case IGEDConst.MODE_STUDENT: + this.original.createReference(id, type); + break; + default: + break; + } + } + + public void readReference(String id) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.readReference(id); + break; + case IGEDConst.MODE_BOTH: + this.original.readReference(id); + this.replica.readReference(id); + break; + case IGEDConst.MODE_STUDENT: + this.original.readReference(id); + break; + default: + break; + } + } + + public void writeReference() { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.writeReference(); + break; + case IGEDConst.MODE_BOTH: + this.original.writeReference(); + this.replica.writeReference(); + break; + case IGEDConst.MODE_STUDENT: + this.original.writeReference(); + break; + default: + break; + } + } + + public void readReferenceField(int field) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.readReferenceField(field); + break; + case IGEDConst.MODE_BOTH: + this.original.readReferenceField(field); + this.replica.readReferenceField(field); + break; + case IGEDConst.MODE_STUDENT: + this.original.readReferenceField(field); + break; + default: + break; + } + } + + public void writeReferenceField(int field) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.writeReferenceField(field); + break; + case IGEDConst.MODE_BOTH: + this.original.writeReferenceField(field); + this.replica.writeReferenceField(field); + break; + case IGEDConst.MODE_STUDENT: + this.original.writeReferenceField(field); + break; + default: + break; + } + } + + public void writeReferenceFieldNull(int field) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.writeReferenceFieldNull(field); + break; + case IGEDConst.MODE_BOTH: + this.original.writeReferenceFieldNull(field); + this.replica.writeReferenceFieldNull(field); + break; + case IGEDConst.MODE_STUDENT: + this.original.writeReferenceFieldNull(field); + break; + default: + break; + } + } + + public int readInfo() { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + return this.replica.readInfo(); + case IGEDConst.MODE_BOTH: + this.replica.readInfo(); + return this.original.readInfo(); + case IGEDConst.MODE_STUDENT: + return this.original.readInfo(); + + default: + return Integer.MIN_VALUE; + } + } + + public void writeInfo(int value) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.writeInfo(value); + break; + case IGEDConst.MODE_BOTH: + this.replica.writeInfo(value); + this.original.writeInfo(value); + break; + case IGEDConst.MODE_STUDENT: + this.original.writeInfo(value); + break; + default: + break; + } + } + + public void setPosVector(int pos) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.setPosVector(pos); + break; + case IGEDConst.MODE_BOTH: + this.replica.setPosVector(pos); + this.original.setPosVector(pos); + break; + case IGEDConst.MODE_STUDENT: + this.original.setPosVector(pos); + break; + default: + break; + } + } + + public void insertStruct(String id, Struct s) { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.insertStruct(id, s); + break; + case IGEDConst.MODE_BOTH: + this.replica.insertStruct(id, s); + this.original.insertStruct(id, s); + break; + case IGEDConst.MODE_STUDENT: + this.original.insertStruct(id, s); + break; + default: + break; + } + } + + public void endCommand() { + switch (mode) { + case IGEDConst.MODE_PROFESSOR: + this.replica.endCommand(); + break; + case IGEDConst.MODE_BOTH: + this.replica.endCommand(); + this.original.endCommand(); + break; + case IGEDConst.MODE_STUDENT: + this.original.endCommand(); + break; + default: + break; + } + } + + public void clear(){ + original.clear(); + replica.clear(); + } +} diff --git a/src/iged/AED/StructManagerInstance.java b/src/br/ufpb/iged/avaliador/AED/StructManagerInstance.java similarity index 98% rename from src/iged/AED/StructManagerInstance.java rename to src/br/ufpb/iged/avaliador/AED/StructManagerInstance.java index dd8f064..656cbc8 100644 --- a/src/iged/AED/StructManagerInstance.java +++ b/src/br/ufpb/iged/avaliador/AED/StructManagerInstance.java @@ -1,6 +1,6 @@ -package iged.AED; +package br.ufpb.iged.avaliador.AED; -import iged.IGEDConst; +import br.ufpb.iged.IGEDConst; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/src/iged/AED/Vector.java b/src/br/ufpb/iged/avaliador/AED/Vector.java similarity index 92% rename from src/iged/AED/Vector.java rename to src/br/ufpb/iged/avaliador/AED/Vector.java index 19d5d28..4c28d09 100644 --- a/src/iged/AED/Vector.java +++ b/src/br/ufpb/iged/avaliador/AED/Vector.java @@ -1,74 +1,74 @@ -package iged.AED; - -public class Vector extends Struct { - - private int[]vet ; - private int pos = 0; - - - public Vector(int length){ - super(1); - vet = new int[length]; - } - - public int read(int index)throws ArrayIndexOutOfBoundsException{ - return vet[index]; - } - - public boolean write(int index, int value){ - try{ - vet[index] = value; - return true; - }catch (ArrayIndexOutOfBoundsException ae) { - return false; - } - } - - public int getLength(){ - return vet.length; - } - - - public boolean compare(Struct o){ - if(!(o instanceof Vector)) - return false; - Vector v = ((Vector)o); - if(this.vet.length == v.vet.length ){ - int pos = 0; - for(int i: vet){ - if(i != v.vet[pos]){ - return false; - } - pos++; - } - }else { - return false; - } - return true; - } - - @Override - public Node readField(int field) { - return null; - } - - @Override - public void writeField(Struct n, int field) { - } - - @Override - public void writeInfo(int value) { - vet[pos] = value; - } - - @Override - public int readInfo() { - return vet[pos]; - } - - public void setField(int pos){ - this.pos = pos; - } - - -} +package br.ufpb.iged.avaliador.AED; + +public class Vector extends Struct { + + private int[]vet ; + private int pos = 0; + + + public Vector(int length){ + super(1); + vet = new int[length]; + } + + public int read(int index)throws ArrayIndexOutOfBoundsException{ + return vet[index]; + } + + public boolean write(int index, int value){ + try{ + vet[index] = value; + return true; + }catch (ArrayIndexOutOfBoundsException ae) { + return false; + } + } + + public int getLength(){ + return vet.length; + } + + + public boolean compare(Struct o){ + if(!(o instanceof Vector)) + return false; + Vector v = ((Vector)o); + if(this.vet.length == v.vet.length ){ + int pos = 0; + for(int i: vet){ + if(i != v.vet[pos]){ + return false; + } + pos++; + } + }else { + return false; + } + return true; + } + + @Override + public Node readField(int field) { + return null; + } + + @Override + public void writeField(Struct n, int field) { + } + + @Override + public void writeInfo(int value) { + vet[pos] = value; + } + + @Override + public int readInfo() { + return vet[pos]; + } + + public void setField(int pos){ + this.pos = pos; + } + + +} diff --git a/src/iged/AED/WrapperStruct.java b/src/br/ufpb/iged/avaliador/AED/WrapperStruct.java similarity index 86% rename from src/iged/AED/WrapperStruct.java rename to src/br/ufpb/iged/avaliador/AED/WrapperStruct.java index 463030c..fd249e6 100644 --- a/src/iged/AED/WrapperStruct.java +++ b/src/br/ufpb/iged/avaliador/AED/WrapperStruct.java @@ -1,4 +1,4 @@ -package iged.AED; +package br.ufpb.iged.avaliador.AED; public class WrapperStruct { diff --git a/src/iged/gerenciadorAtividade/CampoInvalidoException.java b/src/br/ufpb/iged/gerenciadorApresentacao/CampoInvalidoException.java similarity index 50% rename from src/iged/gerenciadorAtividade/CampoInvalidoException.java rename to src/br/ufpb/iged/gerenciadorApresentacao/CampoInvalidoException.java index 0666afd..f372c30 100644 --- a/src/iged/gerenciadorAtividade/CampoInvalidoException.java +++ b/src/br/ufpb/iged/gerenciadorApresentacao/CampoInvalidoException.java @@ -2,15 +2,15 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorApresentacao; /** * * @author Dorgi */ -public class CampoInvalidoException extends Exception { - - public CampoInvalidoException(String msg) { +public class CampoInvalidoException extends Exception{ + + public CampoInvalidoException(String msg){ super(msg); } } diff --git a/src/iged/gui/gerenciador/CampoObrigatorioException.java b/src/br/ufpb/iged/gerenciadorApresentacao/CampoObrigatorioException.java similarity index 69% rename from src/iged/gui/gerenciador/CampoObrigatorioException.java rename to src/br/ufpb/iged/gerenciadorApresentacao/CampoObrigatorioException.java index 2a93cc0..ad63854 100644 --- a/src/iged/gui/gerenciador/CampoObrigatorioException.java +++ b/src/br/ufpb/iged/gerenciadorApresentacao/CampoObrigatorioException.java @@ -2,7 +2,8 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gui.gerenciador; + +package br.ufpb.iged.gerenciadorApresentacao; /** * @@ -10,7 +11,7 @@ */ public class CampoObrigatorioException extends Exception { - CampoObrigatorioException(String msg) { + public CampoObrigatorioException(String msg){ super(msg); } } diff --git a/src/br/ufpb/iged/gerenciadorApresentacao/DiretorioExistenteException.java b/src/br/ufpb/iged/gerenciadorApresentacao/DiretorioExistenteException.java new file mode 100644 index 0000000..9f2011c --- /dev/null +++ b/src/br/ufpb/iged/gerenciadorApresentacao/DiretorioExistenteException.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package br.ufpb.iged.gerenciadorApresentacao; + +/** + * + * @author Dorgi + */ +public class DiretorioExistenteException extends Exception { + + public DiretorioExistenteException(String msg){ + super (msg); + } + +} diff --git a/src/br/ufpb/iged/gerenciadorApresentacao/Tutorial.java b/src/br/ufpb/iged/gerenciadorApresentacao/Tutorial.java new file mode 100644 index 0000000..04d12a5 --- /dev/null +++ b/src/br/ufpb/iged/gerenciadorApresentacao/Tutorial.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package br.ufpb.iged.gerenciadorApresentacao; + +import java.io.File; +import java.util.LinkedList; +import java.util.List; + +/** + * + * @author Dorgi + */ +public class Tutorial { + + private String titulo; + private String autor; + private String ano; + private String descricao; + private String area; + private LinkedList slides; + + public Tutorial() { + slides = new LinkedList(); + } + + public String getAno() { + return ano; + } + + public void setAno(String ano) { + this.ano = ano; + } + + public String getAutor() { + return autor; + } + + public void setAutor(String autor) { + this.autor = autor; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getTitulo() { + return titulo; + } + + public void setTitulo(String titulo) { + this.titulo = titulo; + } + + public LinkedList getSlides() { + return slides; + } + + public void setSlides(LinkedList slides) { + this.slides = slides; + } + + +} \ No newline at end of file diff --git a/src/br/ufpb/iged/gerenciadorApresentacao/TutorialXml.java b/src/br/ufpb/iged/gerenciadorApresentacao/TutorialXml.java new file mode 100644 index 0000000..6acd622 --- /dev/null +++ b/src/br/ufpb/iged/gerenciadorApresentacao/TutorialXml.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package br.ufpb.iged.gerenciadorApresentacao; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomDriver; +import br.ufpb.iged.gui.TelaCadastroDeTutorialInterno; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +/** + * + * @author Dorgi + */ +public class TutorialXml { + + //private static Tutorial tutorial; + private static XmlPersistencia p; + public static final File raiz = new File("./Tutoriais"); + + public static void criarXml(Tutorial tutorial) throws DiretorioExistenteException { + XStream xstream = new XStream(new DomDriver()); + + xstream.alias("tutorial", Tutorial.class); + + String xmlTutorial = xstream.toXML(tutorial); + System.out.println(xmlTutorial); + XmlPersistencia.salvarXml(xmlTutorial, "tutorial.xml"); + + } + + public static Tutorial lerXml() { + XStream x = new XStream(new DomDriver()); + //MetadadoTarefa metadado = new MetadadoAtividade(); + try { + // carrega o arquivo XML + FileInputStream input = new FileInputStream(new File(p.getNovoDir()+"/tutorial.xml")); + // informa o nome do nó raiz do xml + x.alias("tutorial", Tutorial.class); + // cria um objeto da classe, contendo os dados lidos no xml + Tutorial tut = (Tutorial) x.fromXML(input); + + System.out.println("Área: "+tut.getArea()); + System.out.println("Autor: "+tut.getAutor()); + System.out.println("Ano: "+tut.getAno()); + System.out.println("Título: "+tut.getTitulo()); + System.out.println("Descrição: "+tut.getDescricao()); + System.out.println("Slides: "+tut.getSlides()); + + return tut; + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + +} diff --git a/src/br/ufpb/iged/gerenciadorApresentacao/XmlPersistencia.java b/src/br/ufpb/iged/gerenciadorApresentacao/XmlPersistencia.java new file mode 100644 index 0000000..a2faa2c --- /dev/null +++ b/src/br/ufpb/iged/gerenciadorApresentacao/XmlPersistencia.java @@ -0,0 +1,93 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package br.ufpb.iged.gerenciadorApresentacao; + +import br.ufpb.iged.gui.TelaCadastroDeTarefaInterno; +import br.ufpb.iged.gui.TelaCadastroDeTutorialInterno; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Dorgi + */ +public class XmlPersistencia { + + public static final String DIRTAREFAS = "./Tutoriais/"; + private static File novoDir; + static File dir; + + public XmlPersistencia() { + } + + public static File criarDiretorio() throws DiretorioExistenteException { + TelaCadastroDeTutorialInterno tc = new TelaCadastroDeTutorialInterno(); + novoDir = new File(DIRTAREFAS + tc.getTituloStr()); + //if (novoDir.exists()) { + // throw new DiretorioExistenteException("Diretório já existe! Digite outro título!"); + // } else { + novoDir.mkdir(); + System.out.println("Diretório criado em: " + novoDir.getAbsolutePath()); + //} + return novoDir; + } + + public static File getNovoDir() throws DiretorioExistenteException{ + dir = criarDiretorio(); + return dir; + } + + static TutorialXml cxml = new TutorialXml(); + + public static void salvarXml(String tutorial, String nomeArquivo) throws DiretorioExistenteException { + BufferedWriter writer = null; + //Cria o arquivo já no sub-diretório + File arquivo = new File(getNovoDir(), "tutorial.xml"); + + try { + writer = new BufferedWriter(new FileWriter(arquivo)); + } catch (IOException ex) { + Logger.getLogger(TelaCadastroDeTutorialInterno.class.getName()).log(Level.SEVERE, null, ex); + } + try { + writer.write(tutorial); + } catch (IOException ex) { + Logger.getLogger(TelaCadastroDeTutorialInterno.class.getName()).log(Level.SEVERE, null, ex); + } + try { + writer.close(); + } catch (IOException ex) { + Logger.getLogger(TelaCadastroDeTutorialInterno.class.getName()).log(Level.SEVERE, null, ex); + } + + } + /* + public static void salvarPortifolioXmlAtualizado() { + BufferedWriter writer = null; + //Cria o arquivo já no sub-diretório + File arquivo = new File(cxml.getDir(), DIRTAREFAS+"tarefas.xml"); + + try { + writer = new BufferedWriter(new FileWriter(arquivo)); + } catch (IOException ex) { + Logger.getLogger(TelaCadastroDeTarefaInterno.class.getName()).log(Level.SEVERE, null, ex); + } + try { + writer.write(cxml.atualizar()); //salva fisicamente + } catch (IOException ex) { + Logger.getLogger(TelaCadastroDeTarefaInterno.class.getName()).log(Level.SEVERE, null, ex); + } + try { + writer.close(); + } catch (IOException ex) { + Logger.getLogger(TelaCadastroDeTarefaInterno.class.getName()).log(Level.SEVERE, null, ex); + } + } + */ +} diff --git a/src/iged/gerenciadorTarefa/CampoInvalidoException.java b/src/br/ufpb/iged/gerenciadorIGEDlet/CampoInvalidoException.java similarity index 86% rename from src/iged/gerenciadorTarefa/CampoInvalidoException.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/CampoInvalidoException.java index 325fab8..009fb76 100644 --- a/src/iged/gerenciadorTarefa/CampoInvalidoException.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/CampoInvalidoException.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorTarefa; +package br.ufpb.iged.gerenciadorIGEDlet; /** * diff --git a/src/iged/gerenciadorTarefa/CampoObrigatorioException.java b/src/br/ufpb/iged/gerenciadorIGEDlet/CampoObrigatorioException.java similarity index 86% rename from src/iged/gerenciadorTarefa/CampoObrigatorioException.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/CampoObrigatorioException.java index daa4cd3..b0bc638 100644 --- a/src/iged/gerenciadorTarefa/CampoObrigatorioException.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/CampoObrigatorioException.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorTarefa; +package br.ufpb.iged.gerenciadorIGEDlet; /** * diff --git a/src/iged/gui/gerenciador/DiretorioExistenteException.java b/src/br/ufpb/iged/gerenciadorIGEDlet/DiretorioExistenteException.java similarity index 86% rename from src/iged/gui/gerenciador/DiretorioExistenteException.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/DiretorioExistenteException.java index c9bdcbb..3e42cf5 100644 --- a/src/iged/gui/gerenciador/DiretorioExistenteException.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/DiretorioExistenteException.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gui.gerenciador; +package br.ufpb.iged.gerenciadorIGEDlet; /** * diff --git a/src/iged/gerenciadorAtividade/GerenciadorAtividade.java b/src/br/ufpb/iged/gerenciadorIGEDlet/GerenciadorAtividade.java similarity index 71% rename from src/iged/gerenciadorAtividade/GerenciadorAtividade.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/GerenciadorAtividade.java index d208b10..a25f610 100644 --- a/src/iged/gerenciadorAtividade/GerenciadorAtividade.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/GerenciadorAtividade.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; import java.util.LinkedList; @@ -15,18 +15,18 @@ private GerenciadorAtividade() { portifolio = PortifolioXml.lerXml(); } - public void cadastrar(AtividadeSubjetiva t) { + public void cadastrar(IGEDletSubjetiva t) { portifolio.adicionar(t.getDAO().getMetadado()); PortifolioXml.criarXml(portifolio); - AtividadeXml.criarXml(t); + IGEDletXml.criarXml(t); } - public LinkedList listarTarefas() { + public LinkedList listarTarefas() { return portifolio.getTarefas(); } - public Atividade loadTarefa(MetadadoAtividade mt){ - return AtividadeXml.lerXml(mt); + public IGEDlet loadTarefa(Metadado mt){ + return IGEDletXml.lerXml(mt); } public static GerenciadorAtividade getInstance() { diff --git a/src/iged/gerenciadorAtividade/Atividade.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDlet.java similarity index 60% rename from src/iged/gerenciadorAtividade/Atividade.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/IGEDlet.java index fdc7bdc..c31ad82 100644 --- a/src/iged/gerenciadorAtividade/Atividade.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDlet.java @@ -2,30 +2,30 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; import java.util.ArrayList; import java.util.List; import javax.swing.JPanel; -public abstract class Atividade { - AtividadeDAO ativ = null; - List listeners = null; +public abstract class IGEDlet { + IGEDletDAO ativ = null; + List listeners = null; - public Atividade(){ - this.listeners = new ArrayList(); + public IGEDlet(){ + this.listeners = new ArrayList(); } - public void addListener(AtividadeListener l){ + public void addListener(IGEDletListener l){ this.listeners.add(l); } - public void removeListener(AtividadeListener l){ + public void removeListener(IGEDletListener l){ this.listeners.remove(l); } - protected void enviaEventoInicio(final AtividadeEvent e){ - for(final AtividadeListener al : this.listeners){ + protected void enviaEventoInicio(final IGEDletEvent e){ + for(final IGEDletListener al : this.listeners){ new Thread(){ public void run(){ al.atividadeIniciada(e); @@ -34,8 +34,8 @@ public void run(){ } } - protected void enviaEventoResolvido(final AtividadeEvent e){ - for(final AtividadeListener al : this.listeners){ + protected void enviaEventoResolvido(final IGEDletEvent e){ + for(final IGEDletListener al : this.listeners){ new Thread(){ public void run(){ al.atividadeResolvida(e); @@ -44,11 +44,11 @@ public void run(){ } } - public AtividadeDAO getDAO(){ + public IGEDletDAO getDAO(){ return this.ativ; } - public void setDAO(AtividadeDAO a){ + public void setDAO(IGEDletDAO a){ this.ativ = a; } diff --git a/src/iged/gerenciadorAtividade/AtividadeDAO.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletDAO.java similarity index 66% rename from src/iged/gerenciadorAtividade/AtividadeDAO.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletDAO.java index dad1a1b..f8f8db0 100644 --- a/src/iged/gerenciadorAtividade/AtividadeDAO.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletDAO.java @@ -2,21 +2,21 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; /** * * @author GILBERTO FARIAS */ -public class AtividadeDAO { - protected MetadadoAtividade metadado; +public class IGEDletDAO { + protected Metadado metadado; protected String descricao; - public MetadadoAtividade getMetadado() { + public Metadado getMetadado() { return metadado; } - public void setMetadado(MetadadoAtividade metadado) { + public void setMetadado(Metadado metadado) { this.metadado = metadado; } diff --git a/src/iged/gerenciadorAtividade/AtividadeEvent.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletEvent.java similarity index 75% rename from src/iged/gerenciadorAtividade/AtividadeEvent.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletEvent.java index 95af74e..1cc516f 100644 --- a/src/iged/gerenciadorAtividade/AtividadeEvent.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletEvent.java @@ -2,23 +2,23 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; /** * * @author GILBERTO FARIAS */ -public class AtividadeEvent { +public class IGEDletEvent { int status; - Atividade source; + IGEDlet source; - AtividadeEvent(int status, Atividade a){ + IGEDletEvent(int status, IGEDlet a){ this.status = status; this.source = a; } - public Atividade getSource(){ + public IGEDlet getSource(){ return this.source; } diff --git a/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletListener.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletListener.java new file mode 100644 index 0000000..c254ca9 --- /dev/null +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletListener.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package br.ufpb.iged.gerenciadorIGEDlet; + +/** + * + * @author GILBERTO FARIAS + */ +public interface IGEDletListener { + + public abstract void atividadeIniciada(IGEDletEvent event); + public abstract void atividadeResolvida(IGEDletEvent event); + +} diff --git a/src/iged/gerenciadorAtividade/AtividadeSubjetiva.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletSubjetiva.java similarity index 72% rename from src/iged/gerenciadorAtividade/AtividadeSubjetiva.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletSubjetiva.java index 1a1878f..6ce8172 100644 --- a/src/iged/gerenciadorAtividade/AtividadeSubjetiva.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletSubjetiva.java @@ -2,45 +2,45 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; -import iged.IGEDConst; -import iged.Interpretador; +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.Interpretador; import java.util.StringTokenizer; import java.util.concurrent.Semaphore; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JPanel; -public class AtividadeSubjetiva extends Atividade{ +public class IGEDletSubjetiva extends IGEDlet{ Interpretador iter = null; Thread exec = null; Semaphore sem = null; - public AtividadeSubjetiva(){ + public IGEDletSubjetiva(){ iter = new Interpretador(); sem = new Semaphore(1, true); } @Override public void inicio() { - //Bloqueia as outras ações na Atividade, enquanto sua Thread n finaliza. + //Bloqueia as outras ações na IGEDlet, enquanto sua Thread n finaliza. try { sem.acquire(); } catch (InterruptedException ex){ } - final AtividadeSubjetiva as = (AtividadeSubjetiva)this; + final IGEDletSubjetiva as = (IGEDletSubjetiva)this; this.exec = new Thread(){ public void run(){ as.iter.setMode(IGEDConst.MODE_BOTH); - String codigo = ((AtividadeSubjetivaDAO)as.ativ).getCodInicializacao(); + String codigo = ((IGEDletSubjetivaDAO)as.ativ).getCodInicializacao(); as.execute(codigo); - as.enviaEventoInicio(new AtividadeEvent(AtividadeEvent.INIT, as)); + as.enviaEventoInicio(new IGEDletEvent(IGEDletEvent.INIT, as)); as.iter.setMode(IGEDConst.MODE_PROFESSOR); - codigo = ((AtividadeSubjetivaDAO)as.ativ).getCodSolucao(); + codigo = ((IGEDletSubjetivaDAO)as.ativ).getCodSolucao(); as.execute(codigo); as.iter.setMode(IGEDConst.MODE_STUDENT); @@ -61,22 +61,22 @@ private void execute(String cod) { @Override public void resolve(final String response) { - //Bloqueia as outras ações na Atividade, enquanto sua Thread n finaliza. + //Bloqueia as outras ações na IGEDlet, enquanto sua Thread n finaliza. try { sem.acquire(); } catch (InterruptedException ex){ } - final AtividadeSubjetiva as = (AtividadeSubjetiva)this; + final IGEDletSubjetiva as = (IGEDletSubjetiva)this; this.exec = new Thread(){ public void run(){ as.execute(response); - AtividadeEvent e; + IGEDletEvent e; if(as.estaCorreta()){ - e = new AtividadeEvent(AtividadeEvent.SUCCESS, as); + e = new IGEDletEvent(IGEDletEvent.SUCCESS, as); }else{ - e = new AtividadeEvent(AtividadeEvent.FAIL, as); + e = new IGEDletEvent(IGEDletEvent.FAIL, as); } as.enviaEventoResolvido(e); diff --git a/src/iged/gerenciadorAtividade/AtividadeSubjetivaDAO.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletSubjetivaDAO.java similarity index 86% rename from src/iged/gerenciadorAtividade/AtividadeSubjetivaDAO.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletSubjetivaDAO.java index f0dd00b..c497da9 100644 --- a/src/iged/gerenciadorAtividade/AtividadeSubjetivaDAO.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletSubjetivaDAO.java @@ -2,13 +2,13 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; /** * * @author GILBERTO FARIAS */ -public class AtividadeSubjetivaDAO extends AtividadeDAO{ +public class IGEDletSubjetivaDAO extends IGEDletDAO{ private String codInicializacao; private String codSolucao; diff --git a/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletXml.java b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletXml.java new file mode 100644 index 0000000..34af0c6 --- /dev/null +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/IGEDletXml.java @@ -0,0 +1,63 @@ + +package br.ufpb.iged.gerenciadorIGEDlet; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomDriver; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; + +/** + * + * @author Dorgi + */ +public class IGEDletXml { + + private static Metadado atividade; + public static final File raiz = new File("./Tarefas"); + + public static void criarXml(IGEDletSubjetiva atividade) { + XStream xstream = new XStream(new DomDriver()); + + xstream.alias("atividade", IGEDletSubjetiva.class); + xstream.alias("metadados", Metadado.class); + + String xmlTutorial = xstream.toXML(atividade); + System.out.println(xmlTutorial); + XmlPersistencia.salvarXml(xmlTutorial, "tarefa" + atividade.getDAO().getMetadado().getId() + ".xml"); + } + + static IGEDletSubjetiva lerXmlSubjetiva(int id) { + XStream x = new XStream(new DomDriver()); + //MetadadoTarefa metadado = new Metadado(); + try { + // carrega o arquivo XML + FileInputStream input = new FileInputStream(new File(XmlPersistencia.DIRTAREFAS + "tarefa" + id + ".xml")); + // informa o nome do nó raiz do xml + x.alias("atividade", IGEDletSubjetivaDAO.class); + x.alias("metadados", Metadado.class); + // cria um objeto da classe, contendo os dados lidos no xml + IGEDletSubjetivaDAO dao = (IGEDletSubjetivaDAO) x.fromXML(input); + IGEDletSubjetiva as = new IGEDletSubjetiva(); + as.setDAO(dao); + + return as; + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } + + public static IGEDlet lerXml(Metadado mt) { + if(mt.getType() == IGEDlet.SUBJETIVA) + return IGEDletXml.lerXmlSubjetiva(mt.getId()); + else + return null; + } + +} + diff --git a/src/iged/gerenciadorAtividade/MetadadoAtividade.java b/src/br/ufpb/iged/gerenciadorIGEDlet/Metadado.java similarity index 89% rename from src/iged/gerenciadorAtividade/MetadadoAtividade.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/Metadado.java index 946038b..c33e560 100644 --- a/src/iged/gerenciadorAtividade/MetadadoAtividade.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/Metadado.java @@ -2,13 +2,13 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; /** * * @author Dorgi */ -public class MetadadoAtividade { +public class Metadado { String area; String autor; @@ -17,7 +17,7 @@ public class MetadadoAtividade { int type; - public MetadadoAtividade(){ + public Metadado(){ } diff --git a/src/iged/gerenciadorTarefa/Portifolio.java b/src/br/ufpb/iged/gerenciadorIGEDlet/Portifolio.java similarity index 61% rename from src/iged/gerenciadorTarefa/Portifolio.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/Portifolio.java index f59e13b..bcc691c 100644 --- a/src/iged/gerenciadorTarefa/Portifolio.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/Portifolio.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorTarefa; +package br.ufpb.iged.gerenciadorIGEDlet; import java.util.LinkedList; @@ -12,22 +12,22 @@ */ public class Portifolio { - LinkedList tarefas; + LinkedList tarefas; int cont=0; public Portifolio(){ - tarefas = new LinkedList(); + tarefas = new LinkedList(); } - public LinkedList getTarefas() { + public LinkedList getTarefas() { return tarefas; } - public void setTarefas(LinkedList tarefas) { + public void setTarefas(LinkedList tarefas) { this.tarefas = tarefas; } - public void adicionar(MetadadoTarefa m){ + public void adicionar(Metadado m){ m.setId(cont); tarefas.add(m); cont++; diff --git a/src/iged/gerenciadorTarefa/PortifolioXml.java b/src/br/ufpb/iged/gerenciadorIGEDlet/PortifolioXml.java similarity index 84% rename from src/iged/gerenciadorTarefa/PortifolioXml.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/PortifolioXml.java index 2aea916..6888005 100644 --- a/src/iged/gerenciadorTarefa/PortifolioXml.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/PortifolioXml.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorTarefa; +package br.ufpb.iged.gerenciadorIGEDlet; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; @@ -22,7 +22,7 @@ public static void criarXml(Portifolio portifolio) { XStream xstream = new XStream(new DomDriver()); xstream.alias("portifolio", Portifolio.class); - xstream.alias("metadados", MetadadoTarefa.class); + xstream.alias("metadados", Metadado.class); String xmlTutorial = xstream.toXML(portifolio); System.out.println(xmlTutorial); @@ -32,20 +32,20 @@ public static void criarXml(Portifolio portifolio) { public static Portifolio lerXml() { XStream x = new XStream(new DomDriver()); - //MetadadoTarefa metadado = new MetadadoTarefa(); + //MetadadoTarefa metadado = new Metadado(); try { // carrega o arquivo XML FileInputStream input = new FileInputStream(new File(XmlPersistencia.DIRTAREFAS+"tarefas.xml")); // informa o nome do nó raiz do xml x.alias("portifolio", Portifolio.class); - x.alias("metadados", MetadadoTarefa.class); + x.alias("metadados", Metadado.class); // cria um objeto da classe, contendo os dados lidos no xml Portifolio pf = (Portifolio) x.fromXML(input); if (pf.getTarefas()==null){ - pf.setTarefas(new LinkedList()) ; + pf.setTarefas(new LinkedList()) ; } - for (MetadadoTarefa mt : pf.getTarefas()){ + for (Metadado mt : pf.getTarefas()){ System.out.println("Portifolio"); System.out.println("Área: "+mt.getArea()); System.out.println("Autor: "+mt.getAutor()); diff --git a/src/iged/gerenciadorAtividade/Xml.java b/src/br/ufpb/iged/gerenciadorIGEDlet/Xml.java similarity index 81% rename from src/iged/gerenciadorAtividade/Xml.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/Xml.java index 0fc44c0..52d6c81 100644 --- a/src/iged/gerenciadorAtividade/Xml.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/Xml.java @@ -2,13 +2,13 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; -import iged.gui.ConversorXmlTutorial; -import iged.gui.DiretorioExistenteException; -import iged.gui.TelaCadastroDeTutorialInterno; -import iged.gui.gerenciador.ConversorXmlTarefa; -import iged.gui.TelaCadastroDeTarefaInterno; +import br.ufpb.iged.gui.ConversorXmlTutorial; +import br.ufpb.iged.gui.DiretorioExistenteException; +import br.ufpb.iged.gui.TelaCadastroDeTutorialInterno; +import br.ufpb.iged.gui.gerenciador.ConversorXmlTarefa; +import br.ufpb.iged.gui.TelaCadastroDeTarefaInterno; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; diff --git a/src/iged/gerenciadorAtividade/XmlPersistencia.java b/src/br/ufpb/iged/gerenciadorIGEDlet/XmlPersistencia.java similarity index 94% rename from src/iged/gerenciadorAtividade/XmlPersistencia.java rename to src/br/ufpb/iged/gerenciadorIGEDlet/XmlPersistencia.java index be3dfcf..b0e2cbf 100644 --- a/src/iged/gerenciadorAtividade/XmlPersistencia.java +++ b/src/br/ufpb/iged/gerenciadorIGEDlet/XmlPersistencia.java @@ -2,11 +2,11 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.gerenciadorAtividade; +package br.ufpb.iged.gerenciadorIGEDlet; -import iged.gui.gerenciador.ConversorXmlTarefa; -import iged.gui.gerenciador.PortifolioXml; -import iged.gui.TelaCadastroDeTarefaInterno; +import br.ufpb.iged.gui.gerenciador.ConversorXmlTarefa; +import br.ufpb.iged.gui.gerenciador.PortifolioXml; +import br.ufpb.iged.gui.TelaCadastroDeTarefaInterno; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; diff --git a/src/iged/grafico/geometria/Circulo.java b/src/br/ufpb/iged/grafico/geometria/Circulo.java similarity index 91% rename from src/iged/grafico/geometria/Circulo.java rename to src/br/ufpb/iged/grafico/geometria/Circulo.java index c8b6c54..30598b3 100644 --- a/src/iged/grafico/geometria/Circulo.java +++ b/src/br/ufpb/iged/grafico/geometria/Circulo.java @@ -1,41 +1,41 @@ -package iged.grafico.geometria; - -import java.awt.geom.Point2D; - -public class Circulo extends Poligono{ - private Point2D pcenter = null; - private int radius = 0; - - public Circulo(Point2D pc, int r){ - this.pcenter = pc; - this.radius = r; - - this.createCirclePoints(); - } - - private void createCirclePoints(){ - for (int a = 0 ; a < 361 ; a++ ) { - double aRad = a*(Math.PI/180); - double x = pcenter.getX() + (this.radius * Math.cos(aRad)); - double y = pcenter.getY() + (this.radius * Math.sin(aRad)); - - this.add(new Point2D.Double(x, y)); - } - } - - public void mover(int dx, int dy, int t){ - pcenter.setLocation(pcenter.getX() + dx, pcenter.getY() + dy); - - //super.mover(dx, dy, t); - } - - public void zoom(double z){ - if(z < 0) - return; - - this.points.clear(); - this.radius *= z; - - this.createCirclePoints(); - } +package br.ufpb.iged.grafico.geometria; + +import java.awt.geom.Point2D; + +public class Circulo extends Poligono{ + private Point2D pcenter = null; + private int radius = 0; + + public Circulo(Point2D pc, int r){ + this.pcenter = pc; + this.radius = r; + + this.createCirclePoints(); + } + + private void createCirclePoints(){ + for (int a = 0 ; a < 361 ; a++ ) { + double aRad = a*(Math.PI/180); + double x = pcenter.getX() + (this.radius * Math.cos(aRad)); + double y = pcenter.getY() + (this.radius * Math.sin(aRad)); + + this.add(new Point2D.Double(x, y)); + } + } + + public void mover(int dx, int dy, int t){ + pcenter.setLocation(pcenter.getX() + dx, pcenter.getY() + dy); + + //super.mover(dx, dy, t); + } + + public void zoom(double z){ + if(z < 0) + return; + + this.points.clear(); + this.radius *= z; + + this.createCirclePoints(); + } } \ No newline at end of file diff --git a/src/iged/grafico/geometria/Label.java b/src/br/ufpb/iged/grafico/geometria/Label.java similarity index 90% rename from src/iged/grafico/geometria/Label.java rename to src/br/ufpb/iged/grafico/geometria/Label.java index e4b109c..fa0a413 100644 --- a/src/iged/grafico/geometria/Label.java +++ b/src/br/ufpb/iged/grafico/geometria/Label.java @@ -1,46 +1,46 @@ -package iged.grafico.geometria; - -import java.awt.geom.Point2D; -import java.awt.*; - -public class Label{ - private String text = null; - private Font font = null; - private Point2D pb = null; - - public Label(String t, Point2D p){ - this.text = t; - this.pb = p; - this.setFont(new Font("Serif", Font.PLAIN, 20)); - } - - public void setText(String t){ - this.text = t; - } - - public String getText(){ - return this.text; - } - - public void setFont(Font f){ - this.font = f; - } - - public Font getFont(){ - return this.font; - } - - public Point2D getPoint(){ - return this.pb; - } - - - - public void setPoint(Point2D p){ - this.pb = p; - } - - public void mover(double dx, double dy) { - this.pb.setLocation(pb.getX() + dx, pb.getY() + dy); - } +package br.ufpb.iged.grafico.geometria; + +import java.awt.geom.Point2D; +import java.awt.*; + +public class Label{ + private String text = null; + private Font font = null; + private Point2D pb = null; + + public Label(String t, Point2D p){ + this.text = t; + this.pb = p; + this.setFont(new Font("Serif", Font.PLAIN, 20)); + } + + public void setText(String t){ + this.text = t; + } + + public String getText(){ + return this.text; + } + + public void setFont(Font f){ + this.font = f; + } + + public Font getFont(){ + return this.font; + } + + public Point2D getPoint(){ + return this.pb; + } + + + + public void setPoint(Point2D p){ + this.pb = p; + } + + public void mover(double dx, double dy) { + this.pb.setLocation(pb.getX() + dx, pb.getY() + dy); + } } \ No newline at end of file diff --git a/src/iged/grafico/geometria/Poligono.java b/src/br/ufpb/iged/grafico/geometria/Poligono.java similarity index 89% rename from src/iged/grafico/geometria/Poligono.java rename to src/br/ufpb/iged/grafico/geometria/Poligono.java index 45c5e9d..c945e0f 100644 --- a/src/iged/grafico/geometria/Poligono.java +++ b/src/br/ufpb/iged/grafico/geometria/Poligono.java @@ -1,65 +1,65 @@ -package iged.grafico.geometria; - -import iged.grafico.manager.Quadro; -import iged.grafico.manager.PoligonoGrafico; -import java.awt.geom.Point2D; -import java.awt.Color; - -public class Poligono extends PoligonoGrafico { - - //Adiciona um vertice do poligono - public void add(Point2D p) { - this.points.add(p); - } - - public void mover(double dx, double dy) { - for (Point2D p : points) { - p.setLocation(p.getX() + dx, p.getY() + dy); - } - } - - public void evidencia(final Color cor, final float st, final Quadro quadro) { - final Poligono p = this; - //new Thread() { - - //public void run() { - Color caux = p.getStrokeColor(); - float staux = p.getStroke(); - p.setStrokeColor(cor); - p.setStroke(st); - quadro.atualizar(); - - try { - Thread.sleep(300); - } catch (Exception e) { - } - - p.setStrokeColor(caux); - p.setStroke(staux); - quadro.atualizar(); - - //} - //}.start(); - } - - public void zoom(double z) { - if (z < 0) { - return; - } - - Point2D pbase = points.get(0); - - for (int i = 1; i < points.size(); ++i) { - Point2D p = points.get(i); - double dx = 0; - double dy = 0; - if (pbase.getX() != p.getX()) { - dx = (p.getX() - pbase.getX()) * z; - } - if (pbase.getY() != p.getY()) { - dy = (p.getY() - pbase.getY()) * z; - } - p.setLocation(p.getX() + dx, p.getY() + dy); - } - } +package br.ufpb.iged.grafico.geometria; + +import br.ufpb.iged.grafico.manager.Quadro; +import br.ufpb.iged.grafico.manager.PoligonoGrafico; +import java.awt.geom.Point2D; +import java.awt.Color; + +public class Poligono extends PoligonoGrafico { + + //Adiciona um vertice do poligono + public void add(Point2D p) { + this.points.add(p); + } + + public void mover(double dx, double dy) { + for (Point2D p : points) { + p.setLocation(p.getX() + dx, p.getY() + dy); + } + } + + public void evidencia(final Color cor, final float st, final Quadro quadro) { + final Poligono p = this; + //new Thread() { + + //public void run() { + Color caux = p.getStrokeColor(); + float staux = p.getStroke(); + p.setStrokeColor(cor); + p.setStroke(st); + quadro.atualizar(); + + try { + Thread.sleep(300); + } catch (Exception e) { + } + + p.setStrokeColor(caux); + p.setStroke(staux); + quadro.atualizar(); + + //} + //}.start(); + } + + public void zoom(double z) { + if (z < 0) { + return; + } + + Point2D pbase = points.get(0); + + for (int i = 1; i < points.size(); ++i) { + Point2D p = points.get(i); + double dx = 0; + double dy = 0; + if (pbase.getX() != p.getX()) { + dx = (p.getX() - pbase.getX()) * z; + } + if (pbase.getY() != p.getY()) { + dy = (p.getY() - pbase.getY()) * z; + } + p.setLocation(p.getX() + dx, p.getY() + dy); + } + } } \ No newline at end of file diff --git a/src/iged/grafico/geometria/Retangulo.java b/src/br/ufpb/iged/grafico/geometria/Retangulo.java similarity index 89% rename from src/iged/grafico/geometria/Retangulo.java rename to src/br/ufpb/iged/grafico/geometria/Retangulo.java index c62c306..d1d7fb4 100644 --- a/src/iged/grafico/geometria/Retangulo.java +++ b/src/br/ufpb/iged/grafico/geometria/Retangulo.java @@ -1,23 +1,23 @@ -package iged.grafico.geometria; - -import java.awt.geom.Point2D; -import java.awt.Color; - -public class Retangulo extends Poligono{ - public int width = 0; - public int height = 0; - - public Retangulo(Point2D pbase, int w, int h){ - this.width = w; - this.height = h; - - double xb = (int)pbase.getX(); - double yb = (int)pbase.getY(); - - this.add(pbase); - this.add(new Point2D.Double(xb + w, yb)); - this.add(new Point2D.Double(xb + w, yb + h)); - this.add(new Point2D.Double(xb, yb + h)); - - } +package br.ufpb.iged.grafico.geometria; + +import java.awt.geom.Point2D; +import java.awt.Color; + +public class Retangulo extends Poligono{ + public int width = 0; + public int height = 0; + + public Retangulo(Point2D pbase, int w, int h){ + this.width = w; + this.height = h; + + double xb = (int)pbase.getX(); + double yb = (int)pbase.getY(); + + this.add(pbase); + this.add(new Point2D.Double(xb + w, yb)); + this.add(new Point2D.Double(xb + w, yb + h)); + this.add(new Point2D.Double(xb, yb + h)); + + } } \ No newline at end of file diff --git a/src/iged/grafico/manager/AcaoUsuario.java b/src/br/ufpb/iged/grafico/manager/AcaoUsuario.java similarity index 83% rename from src/iged/grafico/manager/AcaoUsuario.java rename to src/br/ufpb/iged/grafico/manager/AcaoUsuario.java index 19664ea..c2a74da 100644 --- a/src/iged/grafico/manager/AcaoUsuario.java +++ b/src/br/ufpb/iged/grafico/manager/AcaoUsuario.java @@ -1,10 +1,10 @@ -package iged.grafico.manager; - -public interface AcaoUsuario{ - public abstract void init(); - public abstract void color(); - public abstract void move(); - public abstract void zoom(); - public abstract Quadro getQuadro(); - +package br.ufpb.iged.grafico.manager; + +public interface AcaoUsuario{ + public abstract void init(); + public abstract void color(); + public abstract void move(); + public abstract void zoom(); + public abstract Quadro getQuadro(); + } \ No newline at end of file diff --git a/src/iged/grafico/manager/Desenhavel.java b/src/br/ufpb/iged/grafico/manager/Desenhavel.java similarity index 79% rename from src/iged/grafico/manager/Desenhavel.java rename to src/br/ufpb/iged/grafico/manager/Desenhavel.java index 82b227f..3481d28 100644 --- a/src/iged/grafico/manager/Desenhavel.java +++ b/src/br/ufpb/iged/grafico/manager/Desenhavel.java @@ -1,4 +1,4 @@ -package iged.grafico.manager; +package br.ufpb.iged.grafico.manager; import java.awt.Graphics; diff --git a/src/iged/grafico/manager/ExitListener.java b/src/br/ufpb/iged/grafico/manager/ExitListener.java similarity index 89% rename from src/iged/grafico/manager/ExitListener.java rename to src/br/ufpb/iged/grafico/manager/ExitListener.java index 96fc234..0961406 100644 --- a/src/iged/grafico/manager/ExitListener.java +++ b/src/br/ufpb/iged/grafico/manager/ExitListener.java @@ -1,15 +1,15 @@ -package iged.grafico.manager; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -/** A listener that you attach to the top-level Frame or JFrame of - * your application, so quitting the frame exits the application. - * 1998 Marty Hall, http://www.apl.jhu.edu/~hall/java/ - */ - -public class ExitListener extends WindowAdapter { - public void windowClosing(WindowEvent event) { - System.exit(0); - } +package br.ufpb.iged.grafico.manager; + +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/** A listener that you attach to the top-level Frame or JFrame of + * your application, so quitting the frame exits the application. + * 1998 Marty Hall, http://www.apl.jhu.edu/~hall/java/ + */ + +public class ExitListener extends WindowAdapter { + public void windowClosing(WindowEvent event) { + System.exit(0); + } } \ No newline at end of file diff --git a/src/iged/grafico/manager/GraphicManager.java b/src/br/ufpb/iged/grafico/manager/GraphicManager.java similarity index 96% rename from src/iged/grafico/manager/GraphicManager.java rename to src/br/ufpb/iged/grafico/manager/GraphicManager.java index e3c5cd5..f753fd3 100644 --- a/src/iged/grafico/manager/GraphicManager.java +++ b/src/br/ufpb/iged/grafico/manager/GraphicManager.java @@ -1,13 +1,13 @@ -package iged.grafico.manager; - -import iged.IGEDConst; -import iged.grafico.struct.BinaryTree; -import iged.grafico.struct.Vetor; -import iged.grafico.struct.LinkedList; -import iged.grafico.struct.LinkedListNode; -import iged.grafico.struct.NodeTree; -import iged.grafico.struct.Struct; -import iged.grafico.struct.WrapperStruct; +package br.ufpb.iged.grafico.manager; + +import br.ufpb.iged.IGEDConst; +import br.ufpb.iged.grafico.struct.BinaryTree; +import br.ufpb.iged.grafico.struct.Vetor; +import br.ufpb.iged.grafico.struct.LinkedList; +import br.ufpb.iged.grafico.struct.LinkedListNode; +import br.ufpb.iged.grafico.struct.NodeTree; +import br.ufpb.iged.grafico.struct.Struct; +import br.ufpb.iged.grafico.struct.WrapperStruct; import java.awt.geom.Point2D; import java.util.ArrayList; import java.util.Collections; diff --git a/src/iged/grafico/manager/PaintManager.java b/src/br/ufpb/iged/grafico/manager/PaintManager.java similarity index 86% rename from src/iged/grafico/manager/PaintManager.java rename to src/br/ufpb/iged/grafico/manager/PaintManager.java index cad6599..1d19b8d 100644 --- a/src/iged/grafico/manager/PaintManager.java +++ b/src/br/ufpb/iged/grafico/manager/PaintManager.java @@ -2,7 +2,7 @@ * To change this template, choose Tools | Templates * and open the template in the editor. */ -package iged.grafico.manager; +package br.ufpb.iged.grafico.manager; /** * diff --git a/src/iged/grafico/manager/PaintUI.java b/src/br/ufpb/iged/grafico/manager/PaintUI.java similarity index 95% rename from src/iged/grafico/manager/PaintUI.java rename to src/br/ufpb/iged/grafico/manager/PaintUI.java index d8860eb..1632957 100644 --- a/src/iged/grafico/manager/PaintUI.java +++ b/src/br/ufpb/iged/grafico/manager/PaintUI.java @@ -1,120 +1,120 @@ -package iged.grafico.manager; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Container; -import java.awt.FlowLayout; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.StringTokenizer; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JTextArea; -import javax.swing.JTextPane; - -public class PaintUI extends JFrame { - /** - * - */ - private static final long serialVersionUID = 604149682055649395L; - javax.swing.JScrollPane scroll; - javax.swing.JScrollPane scroll2; - javax.swing.JTextArea text; - - - public JButton colorB = new JButton("", new ImageIcon("icons/exe.png")); - //public JButton moveB = new JButton("Mover", new ImageIcon("icons/move.png")); - //public JButton zoomB = new JButton("Zoom", new ImageIcon("icons/zoom.png")); - - public PaintUI(String nome, final AcaoUsuario paint) { - super(nome); - Container framePane = this.getContentPane(); - framePane.setLayout(new BorderLayout()); - - //framePane.setLayout(null); - //JPanel exec = new JPanel(); - //exec.setBackground(Color.LIGHT_GRAY); - //exec.setLayout(null); - - //JPanel botao = new JPanel(); - //botao.setLayout(null); - //botoes.setLayout(new GridLayout(3,1)); - - //colorB.setBounds(10, 10, 50, 30); - //botao.add(colorB); - //botoes.add(moveB); - //botoes.add(zoomB); - - //JTextArea tp = new JTextArea(); - //exec.add(tp); - //exec.add(botao); - Container c = paint.getQuadro(); - c.setBackground(Color.white); - c.setLayout(null); - - colorB.setBounds(690, 490, 60, 60); - //colorB.setLocation(650, 450); - - //c.add(colorB); - - text = new javax.swing.JTextArea(); - scroll = new javax.swing.JScrollPane(); - scroll2 = new javax.swing.JScrollPane(); - - text.setColumns(10); - text.setRows(5); - scroll2.setViewportView(text); - scroll.setViewportView(c); - - framePane.add(scroll,BorderLayout.CENTER); - - framePane.add(scroll2,BorderLayout.SOUTH); - this.setSize(1024,768); - this.addWindowListener(new ExitListener()); - this.setVisible(true); - - c.add(colorB);// Tirar essa linha, � somente para teste - colorB.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - paint.color(); - } - }); - - /*moveB.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - paint.move(); - } - }); - - zoomB.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - paint.zoom(); - } - });*/ - } - - public StringTokenizer lastLine(){ - - StringTokenizer st = new StringTokenizer(text.getText()); - StringTokenizer last = null; - while(st.hasMoreTokens()){ - last = new StringTokenizer(st.nextToken("\n")); - } - return last; - } - - public String Lines(){ - return text.getText(); - } - - public javax.swing.JTextArea getTextArea(){ - return text; - } - - - +package br.ufpb.iged.grafico.manager; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.FlowLayout; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.StringTokenizer; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.JTextPane; + +public class PaintUI extends JFrame { + /** + * + */ + private static final long serialVersionUID = 604149682055649395L; + javax.swing.JScrollPane scroll; + javax.swing.JScrollPane scroll2; + javax.swing.JTextArea text; + + + public JButton colorB = new JButton("", new ImageIcon("icons/exe.png")); + //public JButton moveB = new JButton("Mover", new ImageIcon("icons/move.png")); + //public JButton zoomB = new JButton("Zoom", new ImageIcon("icons/zoom.png")); + + public PaintUI(String nome, final AcaoUsuario paint) { + super(nome); + Container framePane = this.getContentPane(); + framePane.setLayout(new BorderLayout()); + + //framePane.setLayout(null); + //JPanel exec = new JPanel(); + //exec.setBackground(Color.LIGHT_GRAY); + //exec.setLayout(null); + + //JPanel botao = new JPanel(); + //botao.setLayout(null); + //botoes.setLayout(new GridLayout(3,1)); + + //colorB.setBounds(10, 10, 50, 30); + //botao.add(colorB); + //botoes.add(moveB); + //botoes.add(zoomB); + + //JTextArea tp = new JTextArea(); + //exec.add(tp); + //exec.add(botao); + Container c = paint.getQuadro(); + c.setBackground(Color.white); + c.setLayout(null); + + colorB.setBounds(690, 490, 60, 60); + //colorB.setLocation(650, 450); + + //c.add(colorB); + + text = new javax.swing.JTextArea(); + scroll = new javax.swing.JScrollPane(); + scroll2 = new javax.swing.JScrollPane(); + + text.setColumns(10); + text.setRows(5); + scroll2.setViewportView(text); + scroll.setViewportView(c); + + framePane.add(scroll,BorderLayout.CENTER); + + framePane.add(scroll2,BorderLayout.SOUTH); + this.setSize(1024,768); + this.addWindowListener(new ExitListener()); + this.setVisible(true); + + c.add(colorB);// Tirar essa linha, � somente para teste + colorB.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + paint.color(); + } + }); + + /*moveB.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + paint.move(); + } + }); + + zoomB.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + paint.zoom(); + } + });*/ + } + + public StringTokenizer lastLine(){ + + StringTokenizer st = new StringTokenizer(text.getText()); + StringTokenizer last = null; + while(st.hasMoreTokens()){ + last = new StringTokenizer(st.nextToken("\n")); + } + return last; + } + + public String Lines(){ + return text.getText(); + } + + public javax.swing.JTextArea getTextArea(){ + return text; + } + + + } \ No newline at end of file diff --git a/src/iged/grafico/manager/PoligonoGrafico.java b/src/br/ufpb/iged/grafico/manager/PoligonoGrafico.java similarity index 95% rename from src/iged/grafico/manager/PoligonoGrafico.java rename to src/br/ufpb/iged/grafico/manager/PoligonoGrafico.java index ff8558b..e796f96 100644 --- a/src/iged/grafico/manager/PoligonoGrafico.java +++ b/src/br/ufpb/iged/grafico/manager/PoligonoGrafico.java @@ -1,120 +1,120 @@ -package iged.grafico.manager; - -import java.awt.Color; -import java.awt.geom.CubicCurve2D; -import java.awt.geom.GeneralPath; -import java.awt.geom.Path2D; -import java.util.LinkedList; -import java.awt.geom.Point2D; - -public class PoligonoGrafico{ - - public static final int LINEAR = 0; - public static final int CURVE = 1; - - protected java.util.List points = null; - protected Color color = Color.white; - protected float stroke = 2; - protected Color strokeColor = Color.black; - - int type; - - public PoligonoGrafico(){ - this.points = new LinkedList(); - type = LINEAR; - } - - //adiciona um poligono já constuido - public void setType(int t){ - this.type = t; - } - - //Adiciona um vertice do poligono - public void add(Point2D p){ - this.points.add(p); - } - - //Adciona todos os pontos da List - public void addAll(java.util.List ps){ - this.points.addAll(ps); - } - - //Limpa todos os pontos do desenho. - public void clearPoints(){ - this.points.clear(); - } - - public Color getColor(){ - return this.color; - } - public void setColor(Color c){ - this.color = c; - } - - public Color getStrokeColor(){ - return this.strokeColor; - } - public void setStrokeColor(Color c){ - this.strokeColor = c; - } - - public float getStroke(){ - return this.stroke; - } - public void setStroke(float st){ - this.stroke = st; - } - - public Object getPrint(){ - if(type == LINEAR){ - GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, - this.points.size()); - - Point2D pto = this.points.get(0); - polygon.moveTo(pto.getX(), pto.getY()); - for ( int index = 1; index < this.points.size(); index++ ) { - pto = this.points.get(index); - polygon.lineTo(pto.getX(), pto.getY()); - } - - polygon.closePath(); - return polygon; - }else{ - - CubicCurve2D c = new CubicCurve2D.Double(); - // Define suas coordenadas e a desenha - - Point2D p0 = this.points.get(0); - Point2D p1 = this.points.get(1); - Point2D p2 = this.points.get(2); - Point2D p3 = this.points.get(3); - - c.setCurve(p0.getX(), p0.getY(), p1.getX(), p1.getY(), - p2.getX(), p2.getY(), p3.getX(), p3.getY()); - - return c; - - /*polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); - - Point2D pto = this.points.get(0); - polygon.moveTo(pto.getX(), pto.getY()); - pto = this.points.get(1); - polygon.lineTo(pto.getX(), pto.getY()); - - - - polygon.curveTo(p1.getX(), p1.getY(), - p2.getX(), p2.getY(), - p3.getX(), p3.getY()); - */ - //polygon - } - - //return polygon; - } - - public Point2D getBasePoint(){ - return this.points.get(0); - } - +package br.ufpb.iged.grafico.manager; + +import java.awt.Color; +import java.awt.geom.CubicCurve2D; +import java.awt.geom.GeneralPath; +import java.awt.geom.Path2D; +import java.util.LinkedList; +import java.awt.geom.Point2D; + +public class PoligonoGrafico{ + + public static final int LINEAR = 0; + public static final int CURVE = 1; + + protected java.util.List points = null; + protected Color color = Color.white; + protected float stroke = 2; + protected Color strokeColor = Color.black; + + int type; + + public PoligonoGrafico(){ + this.points = new LinkedList(); + type = LINEAR; + } + + //adiciona um poligono já constuido + public void setType(int t){ + this.type = t; + } + + //Adiciona um vertice do poligono + public void add(Point2D p){ + this.points.add(p); + } + + //Adciona todos os pontos da List + public void addAll(java.util.List ps){ + this.points.addAll(ps); + } + + //Limpa todos os pontos do desenho. + public void clearPoints(){ + this.points.clear(); + } + + public Color getColor(){ + return this.color; + } + public void setColor(Color c){ + this.color = c; + } + + public Color getStrokeColor(){ + return this.strokeColor; + } + public void setStrokeColor(Color c){ + this.strokeColor = c; + } + + public float getStroke(){ + return this.stroke; + } + public void setStroke(float st){ + this.stroke = st; + } + + public Object getPrint(){ + if(type == LINEAR){ + GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, + this.points.size()); + + Point2D pto = this.points.get(0); + polygon.moveTo(pto.getX(), pto.getY()); + for ( int index = 1; index < this.points.size(); index++ ) { + pto = this.points.get(index); + polygon.lineTo(pto.getX(), pto.getY()); + } + + polygon.closePath(); + return polygon; + }else{ + + CubicCurve2D c = new CubicCurve2D.Double(); + // Define suas coordenadas e a desenha + + Point2D p0 = this.points.get(0); + Point2D p1 = this.points.get(1); + Point2D p2 = this.points.get(2); + Point2D p3 = this.points.get(3); + + c.setCurve(p0.getX(), p0.getY(), p1.getX(), p1.getY(), + p2.getX(), p2.getY(), p3.getX(), p3.getY()); + + return c; + + /*polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 3); + + Point2D pto = this.points.get(0); + polygon.moveTo(pto.getX(), pto.getY()); + pto = this.points.get(1); + polygon.lineTo(pto.getX(), pto.getY()); + + + + polygon.curveTo(p1.getX(), p1.getY(), + p2.getX(), p2.getY(), + p3.getX(), p3.getY()); + */ + //polygon + } + + //return polygon; + } + + public Point2D getBasePoint(){ + return this.points.get(0); + } + } \ No newline at end of file diff --git a/src/iged/grafico/manager/Quadro.java b/src/br/ufpb/iged/grafico/manager/Quadro.java similarity index 92% rename from src/iged/grafico/manager/Quadro.java rename to src/br/ufpb/iged/grafico/manager/Quadro.java index a9007b4..610ba9c 100644 --- a/src/iged/grafico/manager/Quadro.java +++ b/src/br/ufpb/iged/grafico/manager/Quadro.java @@ -1,156 +1,156 @@ -package iged.grafico.manager; - -import iged.grafico.struct.Elemento; -import iged.grafico.geometria.Poligono; -import iged.grafico.geometria.Label; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Font; -import java.awt.geom.Point2D; -import java.util.*; - - -import javax.swing.JPanel; - -public class Quadro extends JPanel { - - private java.util.List desenhaveis = null; - private java.util.List