use of eu.ggnet.dwoss.stock.api.PicoStock 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.stock.api.PicoStock in project dwoss by gg-net.
the class UiUnitSupport method optionalChangeStock.
private UniqueUnit optionalChangeStock(UniqueUnit uniqueUnit, StockUnit stockUnit, PicoStock localStock, Window parent, String account) {
if (!stockUnit.isInStock())
return uniqueUnit;
if (localStock.getId() == stockUnit.getStock().getId())
return uniqueUnit;
if (stockUnit.isInTransaction()) {
JOptionPane.showMessageDialog(parent, "Achtung, Gerät ist nicht auf " + localStock.getShortDescription() + ",\n" + "aber Gerät ist auch auf einer Transaktion.\n" + "Automatische Lageränderung nicht möglich !");
return uniqueUnit;
}
int option = JOptionPane.showConfirmDialog(parent, "Gerät steht nicht auf " + localStock.getShortDescription() + ", welches als Standort angegeben ist. Gerätestandort ändern ?", "Standortabweichung", JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION) {
StockDialog dialog = new StockDialog(parent, Dl.remote().lookup(StockAgent.class).findAll(Stock.class).toArray(new Stock[0]), new StockCellRenderer());
dialog.setSelection(localStock);
dialog.setVisible(true);
if (dialog.isOk())
return unitProcessor.transfer(uniqueUnit, dialog.getSelection().getId(), account);
}
return uniqueUnit;
}
Aggregations