Commit 24858746 authored by SAINT-MARCEL Frederic's avatar SAINT-MARCEL Frederic
Browse files

add StatusBar , rules and another tool bar

parent cbf4d312
......@@ -26,7 +26,8 @@ menubar=file edit transmorpher process component channel layout help
file=load download upload - save saveAs - quit
fileLabel=File
loadLabel=Load
loadLabel=Load
loadImage=resources/load.gif
downloadLabel=Import
downloadImage=resources/import.gif
uploadLabel=Export
......@@ -147,18 +148,47 @@ aboutImage=resources/help.gif
# toolbar definition
#
toolbar=Marquee - Undo Redo - Generate Serialize Merge Dispatch ApplyExternal ApplyProcess ApplyRuleset ApplyQuery - EdgeNormal
toolbar1=Load Save SaveAs - undo redo - Cut Copy Paste - Zoom ZoomIn ZoomOut
LoadAction=load
LoadToolTip=Load
LoadImage=resources/load.gif
SaveAction=save
SaveToolTip=Save
SaveImage=resources/save.gif
SaveAsAction=saveAs
SaveAsToolTip=SaveAs
SaveAsImage=resources/saveas.gif
undoAction=undo
undoToolTip=Undo
undoImage=resources/Undo.gif
redoAction=redo
redoToolTip=Redo
redoImage=resources/Redo.gif
CutAction=cut
CutToolTip=Cut
CutImage=resources/cut.gif
CopyAction=copy
CopyToolTip=Copy
CopyImage=resources/copy.gif
PasteAction=paste
PasteToolTip=Paste
PasteImage=resources/paste.gif
ZoomAction=zoom
ZoomToolTip=Zoom
ZoomImage=resources/zoom.gif
ZoomInAction=zoomIn
ZoomInToolTip=ZoomIn
ZoomInImage=resources/zoomin.gif
ZoomOutAction=zoomOut
ZoomOutToolTip=ZoomOut
ZoomOutImage=resources/zoomout.gif
toolbar2=Marquee Generate Serialize Merge Dispatch ApplyExternal ApplyProcess ApplyRuleset ApplyQuery - EdgeNormal PortRight PortLeft
#- In Out
#- EdgeTest EdgeIterator EdgeNull
toolboxLabel=Outils
MarqueeTooltip=Marqueur
MarqueeImage=resources/Marquee.gif
UndoAction=undo
UndoToolTip=Undo
UndoImage=resources/Undo.gif
RedoAction=redo
RedoToolTip=Redo
RedoImage=resources/Redo.gif
GenerateTooltip=Generate
GenerateImage=resources/generate.gif
SerializeTooltip=Serialize
......@@ -177,7 +207,12 @@ ApplyQueryTooltip=ApplyQuery
ApplyQueryImage=resources/applyQuery.gif
EdgeNormalTooltip=EdgeNormal
EdgeNormalImage=resources/EdgeNormal.gif
ApplyQueryImage=resources/applyQuery.gif
PortRightTooltip=PortRight
PortRightAction=portright
PortRightImage=resources/PortRight.gif
PortLeftTooltip=PortLeft
PortLeftImage=resources/PortLeft.gif
PortLeftAction=portleft
#EdgeTestTooltip=EdgeTest
#EdgeTestImage=resources/EdgeTest.gif
#EdgeIteratorTooltip=EdgeIterator
......@@ -195,5 +230,5 @@ EnterNameMessage = Please enter the name of this process
Id = id
#message
WARNING = Warning!!
WARNING = Warning!!
UNIQUE_NAME_PROCESS=A process must have an unique process
\ No newline at end of file
/**
* $Id: FCConstants.java,v 1.2 2002-05-28 16:08:17 gchomat Exp $
* $Id: FCConstants.java,v 1.3 2002-05-29 16:20:21 frederic Exp $
*
* Transmorpher
*
......@@ -30,7 +30,7 @@
package fr.fluxmedia.flowcomposer;
public interface FCConstants{
public class FCConstants{
public static final int MERGE =0;
public static final int GENERATE =1;
......@@ -41,12 +41,16 @@ public interface FCConstants{
public static final int APPLYRULESET =6;
public static final int APPLYQUERY =7;
public static final int PORTPROCESS =8;
public static final Object[] mergeType = new Object[]{"concat"};
public static final Object[] dispatchType = new Object[]{"broadcast"};
public static final Object[] serialyseType = new Object[]{"writeFile"};
public static final Object[] generateType = new Object[]{"readFile"};
public static final Object[] applyqueryType = new Object[]{"tmq"};
public static final Object[] applyexternalType= new Object[]{"xslt"};
}
/**
* $Id: FCMarqueeHandler.java,v 1.13 2002-05-28 16:08:17 gchomat Exp $
* $Id: FCMarqueeHandler.java,v 1.14 2002-05-29 16:20:21 frederic Exp $
*
* Transmorpher
*
......@@ -83,7 +83,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
protected int count=0;
protected Call currentCall;
public transient JToggleButton marquee = new JToggleButton();
public transient JToggleButton generate = new JToggleButton();
public transient JToggleButton serialize = new JToggleButton();
......@@ -93,11 +93,11 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
public transient JToggleButton applyProcess = new JToggleButton();
public transient JToggleButton applyRuleset = new JToggleButton();
public transient JToggleButton applyQuery = new JToggleButton();
public transient JToggleButton edgeTest = new JToggleButton();
//public transient JToggleButton edgeTest = new JToggleButton();
public transient JToggleButton edgeNormal = new JToggleButton();
public transient JToggleButton edgeIterator = new JToggleButton();
public transient JToggleButton edgeNull = new JToggleButton();
//public transient JToggleButton edgeIterator = new JToggleButton();
//public transient JToggleButton edgeNull = new JToggleButton();
protected Point start, current;
protected Object beginCell, endCell;
......@@ -107,13 +107,13 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
}
public void setCurrentProcess(Object process){
if(process instanceof ProcessGraph)
{
currentProcess = (ProcessGraph)process;
if(((ProcessGraph)currentProcess).getUserObject()!=null && ((ProcessGraph)currentProcess).getUserObject() instanceof Process){
currentTransformation = (Process)(((ProcessGraph)currentProcess).getUserObject());
currentTransformation = (Process)(((ProcessGraph)currentProcess).getUserObject());
}
System.out.println("currentTransformation "+currentTransformation);
}
......@@ -133,7 +133,8 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
//System.out.println("MousePressed Start...");
if(currentProcess != null)
{
if (!e.isConsumed() && !marquee.isSelected()) {
if (!e.isConsumed() && !marquee.isSelected()) {
start = currentProcess.snap(e.getPoint());
beginCell = currentProcess.getFirstCellForLocation(e.getX(), e.getY());
......@@ -170,7 +171,11 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
}
public void mouseReleased(MouseEvent event) {
EditCall dialog;
count++;
if(currentProcess != null)
{
......@@ -178,9 +183,10 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
if (event != null && !event.isConsumed() && !marquee.isSelected()) {
if (merge.isSelected())
{
dialog = new EditCall((JFrame)(currentProcess.getTopLevelAncestor()),(ProcessGraph)currentProcess,null,start,FCConstants.MERGE);
}
else if (generate.isSelected())
{
......@@ -189,21 +195,26 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.GENERATE);
}
else if (serialize.isSelected())
{
currentCall = new Serialize("serialize"+count,"writefile",currentTransformation,1,currentProcess+"serialize"+count+".xml");
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.SERIALYSE);
}
}
else if (dispatch.isSelected())
{
currentCall = new Dispatch("dispatch"+count,"broadcast",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.DISPATCH);
}
else if (applyExternal.isSelected())
{
......@@ -216,15 +227,19 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
{
currentCall = new ApplyProcess("applyProcess"+count,"no",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYPROCESS);
}
else if (applyRuleset.isSelected())
{
{
currentCall = new ApplyRuleset("applyRuleset"+count,"no",currentTransformation);
if(((ProcessGraph)currentProcess).getUserObject() instanceof Process)
((Process)(((ProcessGraph)currentProcess).getUserObject())).addCall(currentCall);
((ProcessGraph)currentProcess).addVertex(currentCall,start,FCConstants.APPLYRULESET);
}
else if (applyQuery.isSelected())
{
......@@ -237,7 +252,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
currentProcess.getModel().insert(null,null,null,null);
if ((beginCell!=null)&&(endCell!=null)&&(!beginCell.equals(endCell))) {
doConnectionSet(beginCell,endCell);
}
}
event.consume();
......@@ -268,7 +283,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
Point p,p2 = null;
Rectangle rect,rect2;
Port portIn,portOut;
Call tCallOut;
......@@ -277,14 +292,14 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
Channel channel;
String name;
rect=currentProcess.getCellBounds(cell);
rect2=currentProcess.getCellBounds(cell2);
int port = (((ProcessGraph)currentProcess).getPorts(cell,"output")).size();
int port2 = (((ProcessGraph)currentProcess).getPorts(cell2,"input")).size();
//System.out.println(port+"premier");
//System.out.println(port2+"deuxieme");
if ((cell instanceof SerializeCell)||(cell2 instanceof GenerateCell))
System.out.println("pas de port en entre (resp. sortie)");
else if ((port==1)&&((cell instanceof MergeCell)||(cell instanceof ApplyRulesetCell)
......@@ -297,12 +312,12 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
else {
tCallOut = (Call)(((DefaultGraphCell)cell).getUserObject());
tCallIn = (Call)(((DefaultGraphCell)cell2).getUserObject());
//System.out.println("tCallIn "+tCallIn);
//System.out.println("tCallOut "+tCallOut);
int indexIn = (tCallIn.inPorts().length()==0)?0:tCallIn.inPorts().length()-1;
int indexOut = (tCallOut.outPorts().length()==0)?0:tCallOut.outPorts().length()-1;
name = "C"+tCallIn.getId();
portIn = new Port(name,tCallIn,indexIn);
......@@ -311,7 +326,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
tCallIn.inPorts().addPort(portIn);
tCallOut.outPorts().addPort(portOut);
channel = new Channel( name, (fr.fluxmedia.transmorpher.Graph.Process)currentTransformation );
((Process)currentTransformation).addChannel( channel );
channel.setOut( portOut );
......@@ -320,7 +335,7 @@ public class FCMarqueeHandler extends BasicMarqueeHandler {
portOut.setChannel( channel );
((ProcessGraph)currentProcess).addPort("output",(DefaultGraphCell)cell);
((ProcessGraph)currentProcess).addPort("input",(DefaultGraphCell)cell2);
((ProcessGraph)currentProcess).addPort("input",(DefaultGraphCell)cell2);
p= new Point(rect.x+rect.width/2,rect.y+rect.height/2);
p2= new Point(rect2.x+rect2.width/2,rect2.y+rect2.height/2);
......
/**
*
*$Id: FlowComposer.java,v 1.25 2002-05-28 12:56:25 gchomat Exp $
*$Id: FlowComposer.java,v 1.26 2002-05-29 16:20:21 frederic Exp $
*
* Transmorpher
*
......@@ -125,12 +125,17 @@ public class FlowComposer extends JPanel implements GraphModelListener,
protected Hashtable buttons;
protected Hashtable menuItems;
protected Hashtable items;
protected JLabel message,scale;
protected JComponent status;
protected Rule colrule, rowrule;
protected static boolean isMetric = true;
/**Default width of the app*/
public static final int PREFERRED_WIDTH = 500;
public static final int PREFERRED_WIDTH =1024;
/**Default height of the app*/
public static final int PREFERRED_HEIGHT = 400;
public static final int PREFERRED_HEIGHT =768;
public static final int MAIN = 1;
public static final int SERVLET = 2;
......@@ -212,7 +217,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
transmorpher = new Transmorpher(filename,resource.getString("TRANSMORPHER_VERSION"),0,false);
createStatusbar();
parser = new ParserRDF();
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
......@@ -243,8 +248,11 @@ public class FlowComposer extends JPanel implements GraphModelListener,
buttons = createButtons();
// Add a ToolBar
panel.add(createToolBar(), BorderLayout.NORTH);
JPanel tool = new JPanel();
//tool.setLayout(new GridLayout(2,0));
tool.add(createToolBar("toolbar1"));
tool.add(createToolBar("toolbar2"));
panel.add(tool,BorderLayout.NORTH);
//Add a JTabbedPane for represnting the process notion.
tabProcess= new JTabbedPane();
tabProcess.getModel().addChangeListener(
......@@ -276,7 +284,7 @@ public class FlowComposer extends JPanel implements GraphModelListener,
panel.add(tabProcess, BorderLayout.CENTER);
this.add(createMenubar(),BorderLayout.NORTH);
this.add(panel,BorderLayout.CENTER);
this.add(status,BorderLayout.SOUTH);
}
public static void init() {
......@@ -378,7 +386,22 @@ public class FlowComposer extends JPanel implements GraphModelListener,
currentProcess.getModel().addUndoableEditListener(undoHandler);
sp = new JScrollPane(currentProcess);
sp = (JScrollPane)(tabProcess.add(process.getName(),sp));
JViewport port = sp.getViewport();
colrule = new Rule(Rule.HORIZONTAL,isMetric,currentProcess);
sp.setColumnHeaderView(colrule);
rowrule = new Rule(Rule.VERTICAL,isMetric,currentProcess);
sp.setRowHeaderView(rowrule);
final JButton button = new JButton("...");
button.setFont(currentProcess.getFont().deriveFont(8));
sp.setCorner(JScrollPane.UPPER_LEFT_CORNER, button);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean metric = !colrule.isMetric();
colrule.setIsMetric(metric);
rowrule.setIsMetric(metric);
}
});
sp = (JScrollPane)(tabProcess.add(process.getName(),sp));
tabProcess.setSelectedComponent(sp);
currentProcess = (ProcessGraph)(sp.getViewport().getView());
//marqueeHandler.setCurrentProcess(currentProcess);
......@@ -519,10 +542,10 @@ public class FlowComposer extends JPanel implements GraphModelListener,
*/
public Component createToolBar() {
public Component createToolBar(String st) {
toolbar = new JToolBar();
toolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
String[] tool = tokenize(getResourceString("toolbar"));
String[] tool = tokenize(getResourceString(st));
for (int i = 0; i < tool.length; i++) {
if (tool[i].equals("-")) {
//System.out.println("strut");
......@@ -548,13 +571,13 @@ public class FlowComposer extends JPanel implements GraphModelListener,
Object button;
AbstractButton b = null;
URL url;
URL url;
url = getResource(key + imageSuffix);
// System.out.println(url + " " + key);
System.out.println(url + " " + key);
button= buttons.get(key);
......@@ -685,7 +708,13 @@ public class FlowComposer extends JPanel implements GraphModelListener,
return menubar;
}
/**
* Create a status bar
*/
protected Component createStatusbar() {
status = new StatusBar();
return status;
}
/**
* Take the given string and make it up into a series
* of strings on whitespace boundries. This is useful
......@@ -737,7 +766,12 @@ public class FlowComposer extends JPanel implements GraphModelListener,
protected Action[] actions = {
undoAction,
redoAction,
new PortRightAction(this),
new PortLeftAction(this),
new LoadAction(this),
new ZoomInAction(),
new ZoomAction(),
new ZoomOutAction(),
new ImportAction(),
new ExportAction(),
new SaveAction(),
......@@ -920,7 +954,31 @@ public class FlowComposer extends JPanel implements GraphModelListener,
return name;
}
// Status Bar
class StatusBar extends JPanel {
public StatusBar() {
super();
setLayout(new BorderLayout());
message = new JLabel(" ");
scale = new JLabel(" ");
message.setBorder(BorderFactory.createLoweredBevelBorder());
scale.setBorder(BorderFactory.createLoweredBevelBorder());
add(message, BorderLayout.CENTER);
add(scale, BorderLayout.EAST);
}
public void paint(Graphics g) {
super.paint(g);
}
}
protected static class FCWindowListener extends WindowAdapter{
......@@ -1035,10 +1093,76 @@ public class FlowComposer extends JPanel implements GraphModelListener,
}
}
class PortRightAction extends AbstractAction {
private FlowComposer flow;
PortRightAction(FlowComposer flow) {
super("portright"+actionSuffix);
flow=flow;
}
public void actionPerformed(ActionEvent e) {
//(flow.getGraph()).
}
}
class PortLeftAction extends AbstractAction {
private FlowComposer flow;
PortLeftAction(FlowComposer flow) {
super("portleft"+actionSuffix);
flow=flow;
}
public void actionPerformed(ActionEvent e) {
//(flow.getGraph()).
}
}
class ZoomAction extends AbstractAction {
ZoomAction() {
super("zoom"+actionSuffix);
setEnabled(true);
}
public void actionPerformed(ActionEvent e) {
}
}
class ZoomInAction extends AbstractAction {
ZoomInAction() {
super("zoomIn"+actionSuffix);
setEnabled(true);
}
public void actionPerformed(ActionEvent e) {
}
}
class ZoomOutAction extends AbstractAction {
ZoomOutAction() {
super("zoomOut"+actionSuffix);
setEnabled(true);
}
public void actionPerformed(ActionEvent e) {
}
}
class ImportAction extends AbstractAction {
ImportAction() {
super("import"+actionSuffix);
setEnabled(true);
}
public void actionPerformed(ActionEvent e) {
......
......@@ -15,12 +15,13 @@ import fr.fluxmedia.transmorpher.Graph.Channel;
public class NormalEdge extends DefaultEdge{
public NormalEdge(){
this(null);
this(null);
}
public NormalEdge(Object userObject){
super(userObject);
super(userObject);
}
public String toString(){
if(userObject instanceof Channel){
System.out.println("userObject is Channel");
......@@ -28,4 +29,5 @@ public class NormalEdge extends DefaultEdge{
}
return super.toString();
}
}
/**
* $Id: ProcessGraph.java,v 1.11 2002-05-28 12:56:25 gchomat Exp $
* $Id: ProcessGraph.java,v 1.12 2002-05-29 16:20:21 frederic Exp $
*
* Transmorpher
*
......@@ -56,7 +56,7 @@ public class ProcessGraph extends JGraph implements Comparator{
*/
static Dimension boundsCube = new Dimension(70,70);
static Dimension boundsPort = new Dimension(5,5);
/** boundsRect define the dimension of a rectangle form composant such as ApplyProcess, Serialize,...
* ie: this composant are included in rectangle boxe