samer@0: /* samer@0: * MatrixPlotter.java samer@0: * samer@0: * Copyright (c) 2000, Samer Abdallah, King's College London. samer@0: * All rights reserved. samer@0: * samer@0: * This software is provided AS iS and WITHOUT ANY WARRANTY; samer@0: * without even the implied warranty of MERCHANTABILITY or samer@0: * FITNESS FOR A PARTICULAR PURPOSE. samer@0: */ samer@0: samer@0: package samer.maths; samer@0: import samer.core.*; samer@0: import java.util.*; samer@0: samer@0: /** samer@0: A Vector plotter that gets its data from a matrix samer@0: row or column samer@0: */ samer@0: samer@0: public class MatrixPlotter extends VectorPlotter samer@0: { samer@0: RowColumn src; samer@0: samer@0: public MatrixPlotter(final Matrix A) samer@0: { samer@0: super(A.observable()); samer@0: src = new RowColumn(new Node("rowcolumn"), A); samer@0: setVec(src.getVec()); samer@0: exposeCommands(src); samer@0: src.addObserver(new Observer() { samer@0: public void update(Observable o, Object s) { samer@0: setVec(src.getVec()); samer@0: update(A.observable(),null); samer@0: // if (autoscale) scale(); samer@0: repaint(); samer@0: } samer@0: } ); samer@0: } samer@0: samer@0: public void attach() samer@0: { samer@0: super.attach(); samer@0: Shell.registerViewable(src); samer@0: } samer@0: samer@0: public void detach() samer@0: { samer@0: Shell.deregisterViewable(src); samer@0: super.detach(); samer@0: src.dispose(); samer@0: } samer@0: }