/** * Set the clusterer for this wrapper * * @param c a <code>weka.clusterers.Clusterer</code> value */ public void setClusterer(weka.clusterers.Clusterer c) { boolean loadImages = true; if (c.getClass().getName().compareTo(m_Clusterer.getClass().getName()) == 0) { loadImages = false; } else { // clusterer has changed so any batch training status is now // invalid m_trainingSet = null; } m_Clusterer = c; String clustererName = c.getClass().toString(); clustererName = clustererName.substring(clustererName.lastIndexOf('.') + 1, clustererName.length()); if (loadImages) { if (!m_visual.loadIcons( BeanVisual.ICON_PATH + clustererName + ".gif", BeanVisual.ICON_PATH + clustererName + "_animated.gif")) { useDefaultVisual(); } } m_visual.setText(clustererName); // get global info m_globalInfo = KnowledgeFlowApp.getGlobalInfo(m_Clusterer); }
@Override public void useDefaultVisual() { m_visual.loadIcons( BeanVisual.ICON_PATH + "FlowByExpression.png", BeanVisual.ICON_PATH + "FlowByExpression.png"); m_visual.setText("FlowByExpression"); }
/** * Overides default read object in order to reload icons. This is necessary because for some * strange reason animated gifs stop being animated after being serialized/deserialized. * * @param ois an <code>ObjectInputStream</code> value * @exception java.io.IOException if an error occurs * @exception ClassNotFoundException if an error occurs */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { try { ois.defaultReadObject(); remove(m_visualLabel); m_visualLabel = new JLabel(m_icon); loadIcons(m_iconPath, m_animatedIconPath); add(m_visualLabel, BorderLayout.CENTER); Dimension d = m_visualLabel.getPreferredSize(); Dimension d2 = new Dimension((int) d.getWidth() + 10, (int) d.getHeight() + 10); setMinimumSize(d2); setPreferredSize(d2); setMaximumSize(d2); } catch (Exception ex) { ex.printStackTrace(); } }
/** * Constructor * * @param visualName name for the bean * @param iconPath path to the icon file * @param animatedIconPath path to the animated icon file */ public BeanVisual(String visualName, String iconPath, String animatedIconPath) { loadIcons(iconPath, animatedIconPath); m_visualName = visualName; // m_textLabel = new JLabel(m_visualName, JLabel.CENTER); m_visualLabel = new JLabel(m_icon); setLayout(new BorderLayout()); // m_visualHolder = new IconHolder(m_visualLabel); add(m_visualLabel, BorderLayout.CENTER); Dimension d = m_visualLabel.getPreferredSize(); // this.setSize((int)d.getWidth()+50, (int)d.getHeight()+50); Dimension d2 = new Dimension((int) d.getWidth() + 10, (int) d.getHeight() + 10); setMinimumSize(d2); setPreferredSize(d2); setMaximumSize(d2); }
/** Use the default images for a data source */ public void useDefaultVisual() { m_visual.loadIcons( BeanVisual.ICON_PATH + "DefaultDataSource.gif", BeanVisual.ICON_PATH + "DefaultDataSource_animated.gif"); }
/** Use the default visual representation */ @Override public void useDefaultVisual() { m_visual.loadIcons( BeanVisual.ICON_PATH + "Sorter.gif", BeanVisual.ICON_PATH + "Sorter_animated.gif"); m_visual.setText("Sorter"); }
/** Use the default visual appearance for this bean */ public void useDefaultVisual() { m_visual.loadIcons( BeanVisual.ICON_PATH + "DefaultClusterer.gif", BeanVisual.ICON_PATH + "DefaultClusterer_animated.gif"); }