Skip to content

Commit

Permalink
remove edit field for person date
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Oct 18, 2014
1 parent 467fb05 commit 3931683
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 79 deletions.
32 changes: 7 additions & 25 deletions src/de/mpg/molgen/buczek/portifix/Gui.form
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSplitPane1" alignment="1" max="32767" attributes="0"/>
<Component id="jSplitPane1" alignment="1" pref="461" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
Expand Down Expand Up @@ -55,9 +55,9 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="38" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
Expand All @@ -78,7 +78,7 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jPanel2" max="32767" attributes="0"/>
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="jPanel3" pref="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
Expand All @@ -102,15 +102,13 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel1" linkSize="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="textField_endedatum" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="label_name" pref="162" max="32767" attributes="0"/>
<Component id="label_name" max="32767" attributes="0"/>
<Component id="label_abteilung" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="56" max="32767" attributes="0"/>
<EmptySpace pref="66" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand All @@ -126,11 +124,6 @@
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="label_abteilung" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textField_endedatum" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
Expand All @@ -147,11 +140,6 @@
<Property name="text" type="java.lang.String" value="Abteilung:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Ende Datum:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="label_name">
<Properties>
<Property name="text" type="java.lang.String" value="Donald Buczek"/>
Expand All @@ -163,12 +151,6 @@
<Property name="text" type="java.lang.String" value="Allgemein"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="textField_endedatum">
<Properties>
<Property name="columns" type="int" value="10"/>
<Property name="text" type="java.lang.String" value="01.01.1988"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="button_cancel">
Expand Down
61 changes: 7 additions & 54 deletions src/de/mpg/molgen/buczek/portifix/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ private String join(String delim, String s1, String s2) {

private void setEditEnabled(boolean enabled) {
textField_datum.setEnabled(enabled);
textField_endedatum.setEnabled(enabled);
}

private void updateForm() {
Expand All @@ -151,7 +150,6 @@ private void updateForm() {
label_abteilung.setText(singleColumnValueOfSelection(TableModel.COLUMN_ABTEILUNG));
label_schluessel.setText(singleColumnValueOfArray(exemplar));
textField_datum.setText(singleColumnValueOfSelection(TableModel.COLUMN_RUECKGABEDATUM));
textField_endedatum.setText(singleColumnValueOfSelection(TableModel.COLUMN_ENDEDATUM));

setEditEnabled(isUnique(columnValuesOfSelection(TableModel.COLUMN_PERSONAL_ID)));
}
Expand Down Expand Up @@ -196,18 +194,6 @@ private void saveThis() {
} catch (ParseException exception) {
// invalid date string. keep old values
}
} else if (edit_mode == EDIT_MODE_PERSON) {
try {
String s = textField_endedatum.getText();
Date d = MyDateFormat.parse(s);
System.out.printf(" %s --> %s\n", s, d);
for (int i = 0; i < selected.length; i++) {
tableModel.setNewDatePerson(jTable1.convertRowIndexToModel(selected[i]), d);
}
} catch (ParseException exception) {
// invalid date string. keep old values
}

} else {
throw new Error("internal error");
}
Expand All @@ -229,9 +215,7 @@ public void run() {
label_abteilung.setText("");
label_schluessel.setText("");
textField_datum.setText("");
textField_endedatum.setText("");
textField_datum.setEnabled(false);
textField_endedatum.setEnabled(false);

jTable1.addMouseListener(popupListener);

Expand Down Expand Up @@ -264,21 +248,6 @@ public void focusLost(FocusEvent e) {
}
});

textField_endedatum.addFocusListener(new FocusListener() {

@Override
public void focusGained(FocusEvent e) {
if (textField_endedatum.getText().equals("...")) {
textField_endedatum.setText("");
}
startEdit(EDIT_MODE_PERSON);
}

@Override
public void focusLost(FocusEvent e) {
}
});

button_cancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Expand Down Expand Up @@ -327,10 +296,8 @@ private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
label_name = new javax.swing.JLabel();
label_abteilung = new javax.swing.JLabel();
textField_endedatum = new javax.swing.JTextField();
button_cancel = new javax.swing.JButton();
button_refresh = new javax.swing.JButton();
button_ok = new javax.swing.JButton();
Expand All @@ -351,16 +318,11 @@ private void initComponents() {

jLabel3.setText("Abteilung:");

jLabel2.setText("Ende Datum:");

label_name.setText("Donald Buczek");
label_name.setToolTipText("");

label_abteilung.setText("Allgemein");

textField_endedatum.setColumns(10);
textField_endedatum.setText("01.01.1988");

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
Expand All @@ -369,14 +331,12 @@ private void initComponents() {
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel3)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3))
.addGap(19, 19, 19)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(textField_endedatum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(label_name, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
.addComponent(label_name, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(label_abteilung, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(56, Short.MAX_VALUE))
.addContainerGap(66, Short.MAX_VALUE))
);

jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel3});
Expand All @@ -391,10 +351,6 @@ private void initComponents() {
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(label_abteilung))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(textField_endedatum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);

Expand All @@ -404,7 +360,6 @@ private void initComponents() {
button_refresh.setText("Refresh");

button_ok.setText("OK");
button_ok.setActionCommand("OK");
button_ok.setEnabled(false);

label_schluessel.setText("Schlüssel");
Expand Down Expand Up @@ -452,7 +407,7 @@ private void initComponents() {
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 38, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(button_ok)
Expand All @@ -468,7 +423,7 @@ private void initComponents() {
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(button_ok)
Expand All @@ -489,7 +444,7 @@ private void initComponents() {
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 461, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
Expand Down Expand Up @@ -525,7 +480,6 @@ public void run() {
private javax.swing.JButton button_ok;
private javax.swing.JButton button_refresh;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
Expand All @@ -539,7 +493,6 @@ public void run() {
private javax.swing.JLabel label_name;
private javax.swing.JLabel label_schluessel;
private javax.swing.JTextField textField_datum;
private javax.swing.JTextField textField_endedatum;
// End of variables declaration//GEN-END:variables

private final JPopupMenu popupMenu = new JPopupMenu();
Expand Down

0 comments on commit 3931683

Please sign in to comment.