use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class RedTapeController method reloadSelectionOnStateChange.
/**
* Updates the selection in case of data change.
*
* @param dos
*/
public void reloadSelectionOnStateChange(Dossier dos) {
Dossier oldDos = model.getSelectedDossier();
dossierTableController.getModel().update(oldDos, dos);
model.setSelectedDossier(null);
model.setSelectedDossier(dos);
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class RedTapeController method openEditComment.
/**
* Opens a dialog to edit a dossiers comment.
* <p/>
* If Dossier.id equals 0, a wrapped Dossier from an old Sopo Auftrag is assumed and no change can be made.
* <p/>
* @param dossier the dossier from wich the comment will be changed
*/
public void openEditComment(Dossier dossier) {
if (model.getSelectedDossier() == null) {
JOptionPane.showMessageDialog(view, "Kein Auftrag ausgewählt");
return;
}
StringAreaView sav = new StringAreaView(dossier.getComment());
OkCancelDialog<StringAreaView> dialog = new OkCancelDialog<>(parent(), Dialog.ModalityType.DOCUMENT_MODAL, "Bemerkungen editieren", sav);
dialog.setVisible(true);
if (dialog.getCloseType() == CloseType.OK) {
try {
Dossier dos = Dl.remote().lookup(RedTapeWorker.class).updateComment(model.getSelectedDossier(), sav.getText());
reloadSelectionOnStateChange(dos);
} catch (UserInfoException ex) {
Ui.handle(ex);
}
}
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DossierTest method sampleOpenDossierWithClosedInvoice.
private Dossier sampleOpenDossierWithClosedInvoice() {
Dossier dos = new Dossier(PaymentMethod.ADVANCE_PAYMENT, true, 1);
Document d1 = new Document(DocumentType.INVOICE, Document.Directive.NONE, null);
d1.setActive(true);
d1.setClosed(true);
dos.add(d1);
return dos;
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DossierTest method testGetRelevantPositionsCapitalReturns.
@Test
public void testGetRelevantPositionsCapitalReturns() {
final int UNIQUE_UNIT_ID = 1;
Dossier dos1 = new Dossier();
Document dos1CapitalAsset = new Document(DocumentType.RETURNS, Document.Directive.HAND_OVER_GOODS, null);
dos1CapitalAsset.setActive(true);
Position p1 = new Position();
p1.setUniqueUnitId(UNIQUE_UNIT_ID);
p1.setType(PositionType.UNIT);
Position p2 = new Position();
p2.setType(PositionType.COMMENT);
dos1CapitalAsset.appendAll(p1, p2);
dos1.add(dos1CapitalAsset);
assertEquals(1, dos1.getRelevantUniqueUnitIds().size());
assertEquals(UNIQUE_UNIT_ID, (int) dos1.getRelevantUniqueUnitIds().iterator().next());
dos1CapitalAsset.add(Document.Condition.CANCELED);
assertTrue("Should have no relevant UniqueUnit ids, but there are: " + dos1.getRelevantUniqueUnitIds(), dos1.getRelevantUniqueUnitIds().isEmpty());
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DossierTest method testChangesAllowedClosedDossierPaymentMethod.
@Test
public void testChangesAllowedClosedDossierPaymentMethod() {
Dossier dos1 = sampleClosedDossier();
Dossier dos2 = sampleClosedDossier();
dos2.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
assertFalse(dos1.getPaymentMethod() == dos2.getPaymentMethod());
assertFalse("Changes should not be allowed", dos1.changesAllowed(dos2));
}
Aggregations