MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / FunctionEditor

Class FunctionEditor

src/org/opensourcephysics/tools/FunctionEditor.java:110–2619  ·  view source on GitHub ↗

A JPanel that manages a table of objects with editable names and expressions. Main component of FunctionTool. subclassed as DataFunctionEditor, ParamEditor (incl. InitialValueEditor), and UserFunctionEditor FunctionEditor DataFunctionEditor ParamEditor InitialValueEdit

Source from the content-addressed store, hash-verified

108 * @author Douglas Brown
109 */
110public abstract class FunctionEditor extends JPanel implements PropertyChangeListener {
111
112 public static final String PROPERTY_FUNCTIONEDITOR_EDIT = "edit";
113 public static final String PROPERTY_FUNCTIONEDITOR_CLIPBOARD = "clipboard";
114 public static final String PROPERTY_FUNCTIONEDITOR_PARAM_DESCRIPTION = "param_description";
115 public static final String PROPERTY_FUNCTIONEDITOR_DESCRIPTION = "description";
116 public static final String PROPERTY_FUNCTIONEDITOR_FOCUS = "focus";
117 public static final String PROPERTY_FUNCTIONEDITOR_ANGLESINRADIANS = "angles_in_radians";
118
119 /**
120 * implemented by DataFunction, UserFunction, and Parameter
121 *
122 * @author hansonr
123 *
124 */
125 public interface FObject {
126 }
127
128 // static constants
129 public final static String THETA = TeXParser.parseTeX("$\\theta$"); //$NON-NLS-1$
130 public final static String OMEGA = TeXParser.parseTeX("$\\omega$"); //$NON-NLS-1$
131 public final static String DEGREES = "\u00B0"; //$NON-NLS-1$
132 public final static int ADD_EDIT = 0;
133 public final static int REMOVE_EDIT = 1;
134 public final static int NAME_EDIT = 2;
135 public final static int EXPRESSION_EDIT = 3;
136 final static Color LIGHT_BLUE = new Color(204, 204, 255);
137 final static Color MEDIUM_RED = new Color(255, 160, 180);
138 final static Color LIGHT_RED = new Color(255, 180, 200);
139 final static Color LIGHT_GRAY = javax.swing.UIManager.getColor("Panel.background"); //$NON-NLS-1$
140 final static Color DARK_RED = new Color(220, 0, 0);
141
142 public static final boolean allowPopopFieldTooltip = !OSPRuntime.isJS;
143
144 // static fields
145 static DecimalFormat decimalFormat;
146 static DecimalFormat sciFormat0000;
147
148 static {
149 decimalFormat = new DecimalFormat();
150 decimalFormat.setMaximumFractionDigits(4);
151 decimalFormat.setMinimumFractionDigits(0);
152 decimalFormat.setMaximumIntegerDigits(3);
153 decimalFormat.setMinimumIntegerDigits(1);
154 sciFormat0000 = Util.newDecimalFormat("0.0000E0"); //$NON-NLS-1$
155 }
156
157 protected static boolean undoEditsEnabled = true;
158 protected static String[] editTypes = { "add row", //$NON-NLS-1$
159 "delete row", "edit name", "edit expression" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
160
161 // instance fields
162 protected ParamEditor paramEditor;
163 protected FunctionPanel functionPanel;
164
165 // data model
166
167 protected ArrayList<FObject> objects = new ArrayList<>();

Callers

nothing calls this directly

Calls 4

parseTeXMethod · 0.95
newDecimalFormatMethod · 0.95
getColorMethod · 0.45

Tested by

no test coverage detected