public BSBLineObjectView(BSBLineObject lineObj) { this.lineObj = lineObj; super.setBSBObject(this.lineObj); this.setLayout(new BorderLayout()); this.add(lineCanvas, BorderLayout.CENTER); this.add(lineSelector, BorderLayout.SOUTH); lineCanvas.setLocked(lineObj.isLocked()); lineSelector.setLineCanvas(lineCanvas); this.setBorder(new LineBorder(Color.GRAY)); revalidate(); setLineList(lineObj.getLines()); this.setSize( lineObj.getCanvasWidth(), lineObj.getCanvasHeight() + lineSelector.getPreferredSize().height); repaint(); lineObj.addPropertyChangeListener(this); }
public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() != lineObj) { return; } String prop = evt.getPropertyName(); if (prop.equals("canvasWidth") || prop.equals("canvasHeight")) { int w = lineObj.getCanvasWidth(); int h = lineObj.getCanvasHeight(); lineCanvas.setSize(new Dimension(w, h)); this.setSize(w, h + lineSelector.getPreferredSize().height); this.revalidate(); } else if (prop.equals("presetValue")) { this.repaint(); } }
public void setLineList(LineList lines) { lineObj.setLines(lines); lineCanvas.setLineList(lines); lineSelector.setLineList(lines); if (lines.size() > 0) { lineCanvas.setSelectedLine(lines.getLine(0)); } }
public void setLocked(boolean locked) { lineObj.setLocked(locked); lineCanvas.setLocked(locked); }
public boolean isLocked() { return lineObj.isLocked(); }
public void setSeparatorType(String separatorType) { lineObj.setSeparatorType(separatorType); }
public String getSeparatorType() { return lineObj.getSeparatorType(); }
public void setRelativeXValues(boolean relativeXValues) { lineObj.setRelativeXValues(relativeXValues); }
public int getCanvasWidth() { return lineObj.getCanvasWidth(); }
public LineList getLineList() { return lineObj.getLines(); }
public float getXMax() { return lineObj.getXMax(); }
public void setLeadingZero(boolean leadingZero) { lineObj.setLeadingZero(leadingZero); }
public boolean isLeadingZero() { return lineObj.isLeadingZero(); }
public void setCanvasWidth(int canvasWidth) { lineObj.setCanvasWidth(canvasWidth); }
public void setCanvasHeight(int canvasHeight) { lineObj.setCanvasHeight(canvasHeight); }
public void cleanup() { lineObj.removePropertyChangeListener(this); }
public void setXMax(float max) { if (max <= 0.0f) { return; } lineObj.setXMax(max); }
public boolean isRelativeXValues() { return lineObj.isRelativeXValues(); }
public int getCanvasHeight() { return lineObj.getCanvasHeight(); }