@Test public void setPresentationModel() { BnIconLabel lbl = new BnIconLabel(); IconPM icon = new IconPM(); icon.setIconUrl(BnLabelTest.class.getResource("sample.gif")); lbl.setPresentationModel(icon); assertEquals("lbl.isConnected()", true, lbl.isConnected()); assertEquals("lbl.getText()", "", lbl.getText()); assertNotNull("lbl.getIcon()", lbl.getIcon()); IconTextPM iconText = new IconTextPM(); iconText.setIconUrl(BnLabelTest.class.getResource("sample.gif")); iconText.setText("hello, world!"); lbl.setPresentationModel(iconText); assertEquals("lbl.isConnected()", true, lbl.isConnected()); assertEquals("lbl.getText()", "hello, world!", lbl.getText()); assertNotNull("lbl.getIcon()", lbl.getIcon()); lbl.setPresentationModel(null); assertEquals("lbl.isConnected()", false, lbl.isConnected()); assertEquals("lbl.getText()", "", lbl.getText()); }
public void setPresentationModel(IIconPM newModel) { IIconPM oldModel = this.pModel; if (newModel != null && newModel instanceof ITextPM == false && newModel instanceof IIconPM == false) { throw new IllegalArgumentException("pModel must be an instance of ITextPM or IIconPM"); } if (this.pModel != null) { this.pModel.removePropertyChangeListener(listener); } this.pModel = newModel; if (this.pModel != null) { this.pModel.addPropertyChangeListener(listener); } refresh(); this.firePropertyChange("presentationModel", oldModel, newModel); }
BnIconLabel extends JLabel implements View<IIconPM>, ModelSubscriber { public void setPresentationModel(IIconPM newModel) { IIconPM oldModel = this.pModel; if (newModel != null && newModel instanceof ITextPM == false && newModel instanceof IIconPM == false) { throw new IllegalArgumentException("pModel must be an instance of ITextPM or IIconPM"); } if (this.pModel != null) { this.pModel.removePropertyChangeListener(listener); } this.pModel = newModel; if (this.pModel != null) { this.pModel.addPropertyChangeListener(listener); } refresh(); this.firePropertyChange("presentationModel", oldModel, newModel); } }
BnIconLabel extends JLabel implements View<IIconPM>, ModelSubscriber { public void setPresentationModel(IIconPM newModel) { IIconPM oldModel = this.pModel; if (newModel != null && newModel instanceof ITextPM == false && newModel instanceof IIconPM == false) { throw new IllegalArgumentException("pModel must be an instance of ITextPM or IIconPM"); } if (this.pModel != null) { this.pModel.removePropertyChangeListener(listener); } this.pModel = newModel; if (this.pModel != null) { this.pModel.addPropertyChangeListener(listener); } refresh(); this.firePropertyChange("presentationModel", oldModel, newModel); } BnIconLabel();  BnIconLabel(IIconPM pModel);  BnIconLabel(ModelProvider provider, Path path);  BnIconLabel(ModelProvider provider); }
BnIconLabel extends JLabel implements View<IIconPM>, ModelSubscriber { public void setPresentationModel(IIconPM newModel) { IIconPM oldModel = this.pModel; if (newModel != null && newModel instanceof ITextPM == false && newModel instanceof IIconPM == false) { throw new IllegalArgumentException("pModel must be an instance of ITextPM or IIconPM"); } if (this.pModel != null) { this.pModel.removePropertyChangeListener(listener); } this.pModel = newModel; if (this.pModel != null) { this.pModel.addPropertyChangeListener(listener); } refresh(); this.firePropertyChange("presentationModel", oldModel, newModel); } BnIconLabel();  BnIconLabel(IIconPM pModel);  BnIconLabel(ModelProvider provider, Path path);  BnIconLabel(ModelProvider provider); ErrorIconPainter getErrorIconPainter(); void setErrorIconPainter(ErrorIconPainter aErrorIconPainter); @Override void paintChildren(Graphics g); IIconPM getPresentationModel(); void setPresentationModel(IIconPM newModel); void setModelProvider(IModelProvider provider); IModelProvider getModelProvider(); void setPath(Path path); Path getPath(); }
BnIconLabel extends JLabel implements View<IIconPM>, ModelSubscriber { public void setPresentationModel(IIconPM newModel) { IIconPM oldModel = this.pModel; if (newModel != null && newModel instanceof ITextPM == false && newModel instanceof IIconPM == false) { throw new IllegalArgumentException("pModel must be an instance of ITextPM or IIconPM"); } if (this.pModel != null) { this.pModel.removePropertyChangeListener(listener); } this.pModel = newModel; if (this.pModel != null) { this.pModel.addPropertyChangeListener(listener); } refresh(); this.firePropertyChange("presentationModel", oldModel, newModel); } BnIconLabel();  BnIconLabel(IIconPM pModel);  BnIconLabel(ModelProvider provider, Path path);  BnIconLabel(ModelProvider provider); ErrorIconPainter getErrorIconPainter(); void setErrorIconPainter(ErrorIconPainter aErrorIconPainter); @Override void paintChildren(Graphics g); IIconPM getPresentationModel(); void setPresentationModel(IIconPM newModel); void setModelProvider(IModelProvider provider); IModelProvider getModelProvider(); void setPath(Path path); Path getPath();  }