use of eu.ggnet.dwoss.common.AbstractGuardian in project dwoss by gg-net.
the class DocumentUpdateViewTryout method main.
public static void main(String[] args) {
// Test different settings of booking accounts in ledgers and in positions
// Test comment
Dl.remote().add(CustomerService.class, new CustomerServiceStub());
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
UiCore.startSwing(() -> {
JLabel l = new JLabel("Main Application");
l.setFont(new Font("DejaVu Sans", 0, 48));
return l;
});
Dossier dos = new Dossier();
dos.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
final Document doc = new Document(DocumentType.ORDER, SEND_ORDER, new DocumentHistory("UnitTest", "Ein Kommentar"));
dos.add(doc);
Address address = new Address("Max Mustermann\nMusterstrass 11\n22222 Musterstadt");
doc.setInvoiceAddress(address);
doc.setShippingAddress(address);
doc.setTaxType(GENERAL_SALES_TAX_DE_SINCE_2007);
doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:123456 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).uniqueUnitId(1).uniqueUnitProductId(1).price(100).tax(doc.getSingleTax()).build());
doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:12345 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).uniqueUnitId(2).uniqueUnitProductId(2).price(100).tax(doc.getSingleTax()).build());
doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:1234 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).price(100).uniqueUnitId(3).uniqueUnitProductId(3).tax(0.07).build());
doc.append(Position.builder().type(SERVICE).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Service Acer Aspire E1-572P-74508G75Dnii").price(100).bookingAccount(L_1001_HW_SW_STORE).tax(0).build());
doc.append(Position.builder().type(SHIPPING_COST).amount(1).description("Versandkosten").name("Versandkosten").price(10).bookingAccount(L_1002_VERSANDKOSTEN).tax(doc.getSingleTax()).build());
Dl.remote().add(Mandators.class, new Mandators() {
@Override
public PostLedger loadPostLedger() {
return new PostLedger(PostLedger.add().positionTypes(UNIT).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1000_STD_UNIT), PostLedger.add().positionTypes(UNIT).taxTypes(UNTAXED).primaryLedger(2001, "Geräte ohne Ust."), PostLedger.add().positionTypes(UNIT, SERVICE, PRODUCT_BATCH, SHIPPING_COST, UNIT_ANNEX).taxTypes(REVERSE_CHARGE).primaryLedger(3000, "Reverse Charge"), PostLedger.add().positionTypes(SERVICE).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(2002, "Dienstleistung Store").alternativeLedger(L_1000_STD_UNIT).alternativeLedger(L_1002_VERSANDKOSTEN).alternativeLedger(L_1001_HW_SW_STORE), PostLedger.add().positionTypes(PRODUCT_BATCH).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1001_HW_SW_STORE), PostLedger.add().positionTypes(SHIPPING_COST).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1002_VERSANDKOSTEN));
}
@Override
public DefaultCustomerSalesdata loadSalesdata() {
return new DefaultCustomerSalesdata(ShippingCondition.DEFAULT, PaymentCondition.CUSTOMER, PaymentMethod.DIRECT_DEBIT, null, null);
}
// <editor-fold defaultstate="collapsed" desc="Unused Methods">
@Override
public ShippingTerms loadShippingTerms() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Mandator loadMandator() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ReceiptCustomers loadReceiptCustomers() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public SpecialSystemCustomers loadSystemCustomers() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Contractors loadContractors() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.remote().add(RedTapeWorker.class, new RedTapeWorkerStub());
Dl.remote().add(RedTapeAgent.class, null);
Dl.remote().add(UnitOverseer.class, null);
Dl.local().add(Guardian.class, new AbstractGuardian() {
{
setRights(new Operator("All Rights", 1, Arrays.asList(AtomicRight.values())));
}
@Override
public void login(String user, char[] pass) throws AuthenticationException {
}
});
DocumentUpdateView view = new DocumentUpdateView(doc);
DocumentUpdateController controller = new DocumentUpdateController(view, doc);
view.setController(controller);
view.setCustomerValues(1);
Ui.exec(() -> {
Ui.build().title("Dokument bearbeiten").swing().eval(() -> OkCancelWrap.vetoResult(view)).opt().ifPresent(System.out::println);
});
}
use of eu.ggnet.dwoss.common.AbstractGuardian in project dwoss by gg-net.
the class ShipmentDialogTryout method testShipment.
@Test
public void testShipment() throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Dl.local().add(Guardian.class, new AbstractGuardian() {
{
setRights(new Operator("Testuser", 0, Arrays.asList(AtomicRight.values())));
}
@Override
public void login(String user, char[] pass) throws AuthenticationException {
}
});
StockUpiImpl su = new StockUpiImpl();
su.setActiveStock(new PicoStock(0, "Demostock"));
Dl.local().add(StockUpi.class, su);
Dl.remote().add(StockAgent.class, new StockAgentStub());
ShipmentController controller = new ShipmentController();
ShipmentDialog dialog = new ShipmentDialog(new javax.swing.JFrame(), controller);
dialog.setVisible(true);
}
use of eu.ggnet.dwoss.common.AbstractGuardian in project dwoss by gg-net.
the class RedTapeTryout method main.
public static void main(String[] args) {
Dl.local().add(RemoteLookup.class, new RemoteLookup() {
@Override
public <T> boolean contains(Class<T> clazz) {
return false;
}
@Override
public <T> T lookup(Class<T> clazz) {
return null;
}
});
Dl.remote().add(RedTapeAgent.class, new RedTapeAgentStub());
Dl.remote().add(RedTapeWorker.class, new RedTapeWorkerStub());
Dl.remote().add(UniversalSearcher.class, new UniversalSearcherStub());
Dl.remote().add(CustomerService.class, new CustomerServiceStub());
Dl.remote().add(DocumentSupporter.class, new DocumentSupporter() {
@Override
public void mail(Document document, DocumentViewType jtype) throws UserInfoException, RuntimeException {
System.out.println("Mailing " + document);
}
@Override
public JasperPrint render(Document document, DocumentViewType viewType) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Dossier briefed(Document detached, String arranger) {
detached.add(Document.Flag.CUSTOMER_BRIEFED);
detached.add(Document.Flag.CUSTOMER_EXACTLY_BRIEFED);
return detached.getDossier();
}
@Override
public FileJacket toXls(String identifier) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.local().add(Guardian.class, new AbstractGuardian() {
@Override
public void login(String user, char[] pass) throws AuthenticationException {
setRights(new Operator(user, 1, Arrays.asList(AtomicRight.values())));
}
});
Dl.remote().add(StockAgent.class, null);
Dl.remote().add(UniqueUnitAgent.class, null);
// Dl.remote().add(LegacyRemoteBridge.class, null);
Dl.remote().add(ShippingCostService.class, null);
Mandators mandatorSupporterMock = mock(Mandators.class);
when(mandatorSupporterMock.loadSalesdata()).thenReturn(new DefaultCustomerSalesdata(ShippingCondition.DEFAULT, PaymentCondition.CUSTOMER, PaymentMethod.DIRECT_DEBIT, Arrays.asList(SalesChannel.CUSTOMER, SalesChannel.RETAILER), null));
Dl.remote().add(Mandators.class, mandatorSupporterMock);
CustomerUpi ccos = mock(CustomerUpi.class);
when(ccos.createCustomer(any())).thenReturn(0L);
when(ccos.updateCustomer(any(), anyLong())).thenReturn(true);
Dl.local().add(CustomerUpi.class, ccos);
UiCore.startSwing(() -> new JLabel("Main Applikation"));
Ui.exec(() -> {
Ui.build().swing().show(() -> RedTapeController.build().getView());
});
}
use of eu.ggnet.dwoss.common.AbstractGuardian in project dwoss by gg-net.
the class ProductListTryout method main.
/**
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
*
* @param args the command line arguments
*/
public static void main(String[] args) {
Dl.remote().add(UniqueUnitAgent.class, new UniqueUnitAgentStub());
Dl.local().add(Guardian.class, new AbstractGuardian() {
{
setRights(new Operator("hans", 123, Arrays.asList(AtomicRight.values())));
}
@Override
public void login(String user, char[] pass) throws AuthenticationException {
}
});
JButton close = new JButton("Schliessen");
close.addActionListener(e -> Ui.closeWindowOf(close));
JButton run = new JButton("OpenUi");
run.addActionListener(ev -> {
Ui.exec(() -> {
Ui.build().fxml().show(ProductListController.class);
});
});
JPanel p = new JPanel();
p.add(run);
p.add(close);
UiCore.startSwing(() -> p);
}
use of eu.ggnet.dwoss.common.AbstractGuardian in project dwoss by gg-net.
the class CreateCustomerTryout method main.
public static void main(String[] args) {
Dl.remote().add(Mandators.class, mock(Mandators.class));
Dl.local().add(Guardian.class, new AbstractGuardian() {
{
setAllUsersnames(Arrays.asList("hans", "claus", "peter"));
}
@Override
public void login(String user, char[] pass) throws AuthenticationException {
}
});
Dl.remote().add(OldCustomerAgent.class, new OldCustomerAgent() {
@Override
public OldCustomer findById(long id) {
OldCustomer customer = new OldCustomer("Die Firma", "Herr", "Max", "Mustermann", "Keine Bemerkungen die ganz lang sein muss um zu testen ob die tabelle richtig funzt, was erst bei richtig richtig langem text auffällt und olli sicher nervt xD", "Helle Strasse 22", "12345", "Musterhausen", "LIStraße", "LIPLZ", "LIOrt");
customer.setKundenID(1);
customer.setTelefonnummer("0190 666666");
customer.setHandynummer("0123456789");
customer.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
customer.setPaymentCondition(PaymentCondition.DEALER);
customer.setShippingCondition(ShippingCondition.DEALER_ONE);
customer.setAllowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER, SalesChannel.RETAILER));
customer.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
customer.setHaendler(true);
return customer;
}
@Override
public OldCustomer store(OldCustomer old) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.remote().add(CustomerService.class, new CustomerService() {
@Override
public List<UiCustomer> asUiCustomers(String company, String firstName, String lastName, String email, boolean appendWildcard) {
L.info("call of asUiCustomers(company={},firstName={},lastName={},email={},wildCard={}", company, firstName, lastName, email, appendWildcard);
return new ArrayList<>();
}
// <editor-fold defaultstate="collapsed" desc="Unused Methods">
@Override
public CustomerMetaData asCustomerMetaData(long customerId) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public UiCustomer asUiCustomer(long customerId) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<UiCustomer> asUiCustomers(String search) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String asHtmlHighDetailed(long id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String findComment(long id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void updateCustomerFlags(long customerId, Set<CustomerFlag> flags) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<CustomerMetaData> allAsCustomerMetaData() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<Long> allSystemCustomerIds() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String asNewHtmlHighDetailed(long id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
CustomerCreateWithSearchView view = new CustomerCreateWithSearchView();
CustomerCreateWithSearchController controller = new CustomerCreateWithSearchController();
controller.setView(view);
view.setController(controller);
OkCancelDialog<CustomerCreateWithSearchView> dialog = new OkCancelDialog<>("Kundenmanagement", view);
dialog.setVisible(true);
System.out.println(view.getCustomer());
System.exit(0);
}
Aggregations