use of eu.ggnet.dwoss.spec.ee.entity.piece.Cpu in project dwoss by gg-net.
the class DesktopView method filterCpuNames.
private void filterCpuNames() {
List<Cpu> filteredCpus = new ArrayList<>();
for (Cpu cpu : allCpus) {
if (cpu.getTypes().contains(cpuTypes.getSelected()) && cpuSeries.getSelected() == cpu.getSeries())
filteredCpus.add(cpu);
}
Collections.sort(filteredCpus, cpuComparator);
cpuBox.setModel(new DefaultComboBoxModel(filteredCpus.toArray()));
}
use of eu.ggnet.dwoss.spec.ee.entity.piece.Cpu in project dwoss by gg-net.
the class EditCpuPanel method pre.
@Override
public boolean pre(CloseType type) {
Cpu testCpu;
if (type == CloseType.CANCEL)
return true;
if (!(mobileCheckBox.isSelected() || desktopCheckBox.isSelected())) {
JOptionPane.showMessageDialog(this, "Kein Type ausgewählt");
return false;
}
try {
testCpu = updateCpu(new Cpu());
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Frequenz, Kerne oder wirtschaftl. Wert sind keine Zahlen");
return false;
}
for (Cpu cpu1 : allCpus) {
if (cpu1.getModel().equals(testCpu.getModel()) && cpu1.getSeries().equals(testCpu.getSeries())) {
if ((cpu != null && cpu1.getId() != cpu.getId()) || cpu == null) {
String text = "";
text += "Die CPU ";
text += testCpu.getModel() + " " + testCpu.getSeries().getNote();
text += "exestiert schon mit einer anderen ID!\n";
text += "Momentane ID:" + (cpu != null ? cpu.getId() : testCpu.getId());
text += " ID der schon existierenden:" + cpu1.getId();
JOptionPane.showMessageDialog(this, text);
return false;
}
}
}
try {
if (cpu == null) {
cpu = productProcessor.create(updateCpu(new Cpu()));
} else {
if (updateCpu(new Cpu()).equalsContent(cpu))
return true;
cpu = productProcessor.update(updateCpu(cpu));
}
} catch (IllegalArgumentException e) {
JOptionPane.showMessageDialog(this, "Cpu existiert schon " + e.getMessage());
return false;
}
return true;
}
use of eu.ggnet.dwoss.spec.ee.entity.piece.Cpu in project dwoss by gg-net.
the class EditCpuPanel method main.
// End of variables declaration//GEN-END:variables
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Cpu cpu = new Cpu(Cpu.Series.CORE_I7, "930", Cpu.Type.DESKTOP, 3.00, 4);
EditCpuPanel view = new EditCpuPanel(new ProductProcessorStub(), new ArrayList<Cpu>());
view.setCpu(cpu);
OkCancelDialog<EditCpuPanel> create = new OkCancelDialog<>("Spezifikationen", view);
create.setVisible(true);
if (create.getCloseType() == CloseType.OK) {
System.out.println(view.getCpu());
}
System.exit(0);
}
use of eu.ggnet.dwoss.spec.ee.entity.piece.Cpu in project dwoss by gg-net.
the class ReceiptProductLogicProductSpecIT method testCreateProductSpec.
@Test
public void testCreateProductSpec() throws Exception {
final long GTIN = 123456782;
// Create a CPU and GPU and persist it.
Cpu cpu = productProcessor.create(new Cpu(Cpu.Series.AMD_V, "TestCPU", Cpu.Type.MOBILE, 2.0, 5));
Gpu gpu = productProcessor.create(new Gpu(Gpu.Type.MOBILE, Gpu.Series.GEFORCE_100, "TestGPU"));
// Persist Display
Display display = new Display(Display.Size._10_1, Display.Resolution.VGA, Display.Type.MATT, Display.Ration.FOUR_TO_THREE);
ProductModel productModel = new ProductModel("M", new ProductFamily("F", new ProductSeries(ACER, NOTEBOOK, "S")));
Notebook notebook = new Notebook();
notebook.setDisplay(display);
notebook.setGpu(gpu);
notebook.setCpu(cpu);
notebook.setMemory(2048);
notebook.setOs(Desktop.Os.LINUX);
notebook.add(Desktop.Hdd.SSD_0016);
notebook.add(Desktop.Hdd.ROTATING_2000);
notebook.add(Desktop.Odd.DVD_ROM);
notebook.setExtras(ProductSpec.Extra.E_SATA, ProductSpec.Extra.HIGHT_CHANGEABLE);
notebook.setPartNo("LX.ASDFG.GHJ");
notebook.setModel(productModel);
ProductSpec testSpec = productProcessor.create(notebook, productModel, 0);
assertNotNull(testSpec);
Notebook notebook2 = new Notebook();
notebook2.setDisplay(display);
notebook2.setGpu(gpu);
notebook2.setCpu(cpu);
notebook2.setMemory(2048);
notebook2.setOs(Desktop.Os.LINUX);
notebook2.add(Desktop.Hdd.SSD_0016);
notebook2.add(Desktop.Hdd.ROTATING_2000);
notebook2.add(Desktop.Odd.DVD_ROM);
notebook2.setExtras(ProductSpec.Extra.E_SATA, ProductSpec.Extra.HIGHT_CHANGEABLE);
notebook2.setPartNo("LX.ASDFG.GH2");
notebook2.setModel(productModel);
ProductSpec testSpec2 = productProcessor.create(notebook2, productModel, GTIN);
assertNotNull(testSpec2);
assertNotSame(testSpec2, testSpec);
Product product = uuAgent.findById(Product.class, testSpec2.getProductId());
assertThat(product).isNotNull().returns(GTIN, Product::getGtin);
}
use of eu.ggnet.dwoss.spec.ee.entity.piece.Cpu in project dwoss by gg-net.
the class ReceiptProductLogicProductSpecIT method testCreateProductSpecException.
@Test(expected = RuntimeException.class)
public void testCreateProductSpecException() {
// Create a CPU and GPU and persist it.
Cpu cpu = productProcessor.create(new Cpu(Cpu.Series.AMD_V, "TestCPU", Cpu.Type.MOBILE, 2.0, 5));
Gpu gpu = productProcessor.create(new Gpu(Gpu.Type.MOBILE, Gpu.Series.GEFORCE_100, "TestGPU"));
// Persist Display
Display display = new Display(Display.Size._10_1, Display.Resolution.VGA, Display.Type.MATT, Display.Ration.FOUR_TO_THREE);
ProductModel productModel = new ProductModel("M", new ProductFamily("F", new ProductSeries(PACKARD_BELL, NOTEBOOK, "S")));
Notebook notebook = new Notebook();
notebook.setDisplay(display);
notebook.setGpu(gpu);
notebook.setCpu(cpu);
notebook.setMemory(2048);
notebook.setOs(Desktop.Os.LINUX);
notebook.add(Desktop.Hdd.SSD_0016);
notebook.add(Desktop.Hdd.ROTATING_2000);
notebook.add(Desktop.Odd.DVD_ROM);
notebook.setExtras(ProductSpec.Extra.E_SATA, ProductSpec.Extra.HIGHT_CHANGEABLE);
notebook.setPartNo("LX.ASDFG.GHJ");
notebook.setModel(productModel);
productProcessor.create(notebook, productModel, 0);
productProcessor.create(notebook, productModel, 0);
fail("Error 040: No Exception Found at: CreateProductSpec");
}
Aggregations