use of doc.attributes.AttributeException in project OpenNotebook by jaltekruse.
the class BasicAddition method setAttributes.
@Override
protected void setAttributes() {
setName("Basic Addition");
setAuthor("Open Notebook Staff");
setDirections("Simplify.");
try {
this.setAttributeValue(UUID_STR, new UUID(2846184626069213495L, 3575720896865422970L));
addTags("Arithmetic", "Addition", "Integers");
} catch (AttributeException e) {
// should not be thrown
e.printStackTrace();
}
setDate(new Date(2, 1, 2011));
}
use of doc.attributes.AttributeException in project OpenNotebook by jaltekruse.
the class BasicAdditionAndSubraction method setAttributes.
@Override
protected void setAttributes() {
setName("Basic Addition and Subtraction");
setAuthor("Open Notebook Staff");
setDirections("Simplify.");
try {
this.setAttributeValue(UUID_STR, new UUID(282048723434478295L, 3549720219560301290L));
getTags().addValueWithString("Arithmetic");
getTags().addValueWithString("Addition");
getTags().addValueWithString("Integers");
getTags().addValueWithString("Negative Numbers");
getTags().addValueWithString("Subtraction");
getTags().addValueWithString("Negation");
} catch (AttributeException e) {
// should not be thrown
throw new RuntimeException(e);
}
setDate(new Date(2, 1, 2011));
}
use of doc.attributes.AttributeException in project OpenNotebook by jaltekruse.
the class BasicArithmeticExpression method setAttributes.
@Override
protected void setAttributes() {
setName("Basic Arithmetic Expression");
setAuthor("Open Notebook Staff");
setDirections("Simplify.");
try {
this.setAttributeValue(UUID_STR, new UUID(4234031236056521345L, 2345748762121345701L));
getTags().addValueWithString("Arithmetic");
getTags().addValueWithString("Addition");
getTags().addValueWithString("Subtraction");
getTags().addValueWithString("Multiplication");
getTags().addValueWithString("Dividison");
getTags().addValueWithString("Integers");
} catch (AttributeException e) {
// should not be thrown
throw new RuntimeException(e);
}
setDate(new Date(2, 1, 2011));
}
use of doc.attributes.AttributeException in project OpenNotebook by jaltekruse.
the class BasicAssociativeProperty method setAttributes.
@Override
protected void setAttributes() {
setName("Basic Associative Property Problem");
setAuthor("Open Notebook Staff");
setDirections("Simplify. Use the associative and commutative properties of addition and multiplication" + " to reorder and regroup the numbers into easier calculations.");
try {
this.setAttributeValue(UUID_STR, new UUID(4470592837206498305L, 1948027489360475701L));
getTags().addValueWithString("Arithmetic");
getTags().addValueWithString("Addition");
getTags().addValueWithString("Multiplication");
getTags().addValueWithString("Integers");
getTags().addValueWithString("Mental Math");
} catch (AttributeException e) {
// should not be thrown
throw new RuntimeException(e);
}
setDate(new Date(2, 1, 2011));
}
use of doc.attributes.AttributeException in project OpenNotebook by jaltekruse.
the class GenericAdjustmentPanel method addPanelContent.
@Override
public void addPanelContent() {
setLayout(new GridBagLayout());
GridBagConstraints con = new GridBagConstraints();
con.fill = GridBagConstraints.HORIZONTAL;
con.weightx = .1;
con.gridx = 0;
con.gridy = 0;
con.insets = new Insets(0, 5, 0, 5);
add(new JLabel(mAtt.getName()), con);
field = new JTextField();
con.weightx = 1;
con.gridx = 1;
con.insets = new Insets(0, 0, 0, 0);
add(field, con);
if (mAtt.getValue() instanceof Double) {
int len = mAtt.getValue().toString().length();
if (len > 5) {
formatter = new Formatter();
field.setText(String.format("%.5G", mAtt.getValue()));
}
} else {
if (mAtt.getValue() == null) {
field.setText("");
} else
field.setText(mAtt.getValue().toString());
}
field.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent arg0) {
}
@Override
public void focusLost(FocusEvent arg0) {
try {
if (mAtt.getParentObject() != null) {
mAtt.getParentObject().setAttributeValueWithString(mAtt.getName(), field.getText());
} else {
mAtt.setValueWithString(field.getText());
}
if (notebookPanel != null) {
notebookPanel.getCurrentDocViewer().repaintDoc();
notebookPanel.getCurrentDocViewer().updateObjectToolFrame();
}
} catch (AttributeException e) {
if (!showingDialog) {
JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
showingDialog = false;
}
}
}
});
field.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
applyPanelValueToObject();
}
});
}
Aggregations