use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DocumentSupporterFlagIT method testBriefed.
private Document testBriefed() {
Dossier dos = redTapeWorker.create(customerId, true, "JUnit");
Document doc = dos.getActiveDocuments().get(0);
addRandomPositions(doc);
doc = redTapeWorker.update(doc, null, arranger);
assertNotBriefed(doc);
dos = documentSupporter.briefed(doc, arranger);
assertExactlyBriefed(dos.getActiveDocuments().get(0));
return dos.getActiveDocuments().get(0);
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class ReceiptUnitOperationIT method assertsUpdate.
private void assertsUpdate(UniqueUnit receiptUnit, StockTransaction stockTransaction, ReceiptOperation receiptOperation, TradeName contractor) {
asserts(receiptUnit, stockTransaction, receiptOperation, contractor);
List<Dossier> allDossiers = redTapeAgent.findAllEager(Dossier.class);
List<Document> allDocumentsWithUnit = new ArrayList<>();
for (Dossier dossier : allDossiers) {
for (Document document : dossier.getActiveDocuments()) {
for (Position position : document.getPositions(PositionType.UNIT).values()) {
if (position.getUniqueUnitId() == receiptUnit.getId()) {
allDocumentsWithUnit.add(document);
}
}
}
}
List<Long> documentIds = new ArrayList<>();
for (Document document : allDocumentsWithUnit) {
documentIds.add(document.getId());
}
assertTrue("The UniqueUnit " + receiptUnit.getId() + " is in more than one document. DocumentsIds: " + documentIds, documentIds.size() <= 1);
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DossierCreateAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
Ui.exec(() -> {
Dossier dos = Dl.remote().lookup(RedTapeWorker.class).create(customer.getId(), dispatch, Dl.local().lookup(Guardian.class).getUsername());
// This is safe, as a create will return exactly one document.
Document doc = dos.getDocuments().iterator().next();
Addresses addresses = Dl.remote().lookup(RedTapeWorker.class).requestAdressesByCustomer(customer.getId());
doc.setInvoiceAddress(addresses.getInvoice());
doc.setShippingAddress(addresses.getShipping());
Ui.exec(() -> {
Ui.build().parent(controller.getView()).swing().eval(() -> {
DocumentUpdateView docView = new DocumentUpdateView(doc);
docView.setController(new DocumentUpdateController(docView, doc));
docView.setCustomerValues(customer.getId());
return OkCancelWrap.vetoResult(docView);
}).opt().filter(r -> handleFailure(r, doc)).map(Reply::getPayload).ifPresent(this::handleSuccesses);
});
});
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DossierIconPanelRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
List<JLabel> labels = new ArrayList<>();
// Get the Dossier status dependant icons
Dossier dos = (Dossier) value;
if (dos.isClosed()) {
JLabel closedLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.CLOSED_ICON)));
closedLabel.setToolTipText("Vorgang ist abgeschlossen");
labels.add(closedLabel);
}
JLabel complaintLabel = new JLabel();
if (!dos.getActiveDocuments(DocumentType.COMPLAINT).isEmpty()) {
complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_ICON)));
complaintLabel.setToolTipText("Eine Reklamation liegt vor");
}
boolean canceledExist = false;
for (Document document : dos.getDocuments()) {
if (!canceledExist && document.getConditions().contains(Condition.CANCELED)) {
JLabel canceledLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.CANCELED_ICON)));
canceledLabel.setToolTipText("Vorgang wurde storniert");
labels.add(canceledLabel);
canceledExist = true;
}
if (document.getConditions().contains(Condition.REJECTED)) {
complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_REJECTED_ICON)));
complaintLabel.setToolTipText("Eine Reklamation liegt vor");
} else if (document.getConditions().contains(Condition.WITHDRAWN)) {
complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_WITHDRAWN_ICON)));
complaintLabel.setToolTipText("Eine Reklamation wurde zurückgezogen");
} else if (document.getConditions().contains(Condition.ACCEPTED)) {
complaintLabel.setIcon(new ImageIcon(DossierTableController.load(IMAGE_NAME.COMPLAINT_ACCEPTED_ICON)));
complaintLabel.setToolTipText("Eine Reklamation wurde angenommen");
}
}
if (complaintLabel.getIcon() != null)
labels.add(complaintLabel);
if (!dos.getActiveDocuments(DocumentType.ANNULATION_INVOICE).isEmpty()) {
JLabel annulationLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.ANNULATION_INVOICE_ICON)));
annulationLabel.setToolTipText("Eine Stornorechnung liegt vor");
labels.add(annulationLabel);
}
if (!dos.getActiveDocuments(DocumentType.CREDIT_MEMO).isEmpty()) {
JLabel creditMemoLabel = new JLabel(new ImageIcon(DossierTableController.load(IMAGE_NAME.CREDIT_MEMO_ICON)));
creditMemoLabel.setToolTipText("Eine Gutschrift liegt vor");
labels.add(creditMemoLabel);
}
// create and fill a panel with all icons
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
String tooltip = "";
for (Iterator<JLabel> it = labels.iterator(); it.hasNext(); ) {
JLabel jLabel = it.next();
panel.add(jLabel);
if (it.hasNext())
tooltip += jLabel.getToolTipText() + " | ";
else
tooltip += jLabel.getToolTipText();
}
if (isSelected)
panel.setBackground(table.getSelectionBackground());
else
panel.setBackground(Color.white);
panel.setToolTipText(tooltip);
return panel;
}
use of eu.ggnet.dwoss.redtape.ee.entity.Dossier in project dwoss by gg-net.
the class DossierTableView method buildDossierPopup.
private JPopupMenu buildDossierPopup() {
JPopupMenu menu = new JPopupMenu();
JMenuItem detailsItem = new JMenuItem(new AbstractAction("Details") {
@Override
public void actionPerformed(ActionEvent e) {
Dossier dos = model.getDossier(table.convertRowIndexToModel(table.getSelectedRow()));
new HtmlDialog(SwingUtilities.getWindowAncestor(DossierTableView.this), Dialog.ModalityType.MODELESS).setText(LegacyBridgeUtil.toHtmlDetailed(dos)).setVisible(true);
}
});
detailsItem.setText("Details");
JMenuItem historyItem = new JMenuItem(new AbstractAction("Verlauf") {
@Override
public void actionPerformed(ActionEvent e) {
HtmlDialog dialog = new HtmlDialog(SwingUtilities.getWindowAncestor(DossierTableView.this), ModalityType.MODELESS);
dialog.setText(DossierFormater.toHtmlHistory(model.getDossier(table.convertRowIndexToModel(table.getSelectedRow()))));
dialog.setVisible(true);
}
});
historyItem.setText("Verlauf");
menu.add(detailsItem);
menu.add(historyItem);
return menu;
}
Aggregations