...
Two ways to add a custom visualizer to visualizer mapping:
- jaxfront.xml:
<property mutable="true">
<key>SimpleTypeDateView</key>
<value>com.jaxfront.swing.ui.beans.DateBean</value>
</property>
- API: JAXFrontProperties.getInstance().setStringProperty("SimpleTypeDateView","com.jaxfront.s wing.ui.beans.DateBean");
...
Default Visualizer Example:
com.jaxfront.demo.ui.OwnDefaultVisualizerImplementation
package com.jaxfront.demo.ui;
import java.awt.BorderLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import com.jaxfront.core.type.Type;
import com.jaxfront.core.ui.Visualizer;
public class OwnDefaultVisualizerImplementation extends JComponent implements com.jaxfront.core.ui.Visualizer {
private Type _context;
private Type _model;
public OwnDefaultVisualizerImplementation(Type model, Type context) {
_model = model;
_context = context;
setSize(100, 100);
setLayout(new BorderLayout());
add(new JLabel("my own impl"), BorderLayout.WEST);
add(new JTextArea("my own textarea"), BorderLayout.CENTER);
}
public Type getContext() {return _context;}
public Visualizer getImplementation() {return this;}
public String getLabelText() {return null;}
public Type getModel() {return _model;}
public boolean isViewReleased() {return false;}
public void jumpTo() {}
public void markError() {}
public void populateModel() {}
public void populateView() {}
public void postInitialization() {}
public void release() {}
public void removeLabel() {}
public void resetError() {}
public void setApplicationRequired(boolean required) {}
public void setEditable(boolean enabled) {}
public void setEnabled(boolean enabled) {}
public void setLabelColor(Color color) {}
public void setLabelText(String text) {}
public void setModel(Type type) {}
public void setRequired(boolean required) {}
public void setVisible(boolean visible) {}
public void showLabel(boolean show) {}
Mapping:
JAXFrontProperties.getInstance().setStringProperty("SimpleTypeDateTimeView", "com.jaxfront.demo.ui.OwnSimpleImplementation");