Search in sources :

Example 11 with Cpu

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()));
}
Also used : Cpu(eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)

Example 12 with Cpu

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;
}
Also used : Cpu(eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)

Example 13 with Cpu

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);
}
Also used : Cpu(eu.ggnet.dwoss.spec.ee.entity.piece.Cpu) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub)

Example 14 with Cpu

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);
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) Notebook(eu.ggnet.dwoss.spec.ee.entity.Notebook) Cpu(eu.ggnet.dwoss.spec.ee.entity.piece.Cpu) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Display(eu.ggnet.dwoss.spec.ee.entity.piece.Display) Test(org.junit.Test)

Example 15 with Cpu

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");
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) Notebook(eu.ggnet.dwoss.spec.ee.entity.Notebook) Cpu(eu.ggnet.dwoss.spec.ee.entity.piece.Cpu) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Display(eu.ggnet.dwoss.spec.ee.entity.piece.Display) Test(org.junit.Test)

Aggregations

Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)21 Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)11 Test (org.junit.Test)11 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)9 ProductFamily (eu.ggnet.dwoss.spec.ee.entity.ProductFamily)8 ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)8 Notebook (eu.ggnet.dwoss.spec.ee.entity.Notebook)7 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)7 Display (eu.ggnet.dwoss.spec.ee.entity.piece.Display)7 CpuEao (eu.ggnet.dwoss.spec.ee.eao.CpuEao)6 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)5 ProductSpecEao (eu.ggnet.dwoss.spec.ee.eao.ProductSpecEao)3 GpuEao (eu.ggnet.dwoss.spec.ee.eao.GpuEao)2 DisplayEmo (eu.ggnet.dwoss.spec.ee.emo.DisplayEmo)2 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)2 DesktopBundle (eu.ggnet.dwoss.spec.ee.entity.DesktopBundle)2 DisplayAble (eu.ggnet.dwoss.spec.ee.entity.DisplayAble)2 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)2 EntityManager (javax.persistence.EntityManager)2 ProductProcessorStub (eu.ggnet.dwoss.receipt.stub.ProductProcessorStub)1