Search in sources :

Example 16 with Gpu

use of eu.ggnet.dwoss.spec.ee.entity.piece.Gpu in project dwoss by gg-net.

the class GpuEaoIT method testFindSeriesName.

@Test
public void testFindSeriesName() throws Exception {
    utx.begin();
    em.joinTransaction();
    em.persist(new Gpu(Gpu.Type.MOBILE, Gpu.Series.RADEON_HD_4000, "Eine Graphiccarte"));
    em.persist(new Gpu(Gpu.Type.DESKTOP, Gpu.Series.RADEON_HD_5000, "Eine Graphiccarte"));
    em.persist(new Gpu(Gpu.Type.MOBILE, Gpu.Series.GEFORCE_500, "Eine Graphiccarte"));
    utx.commit();
    utx.begin();
    em.joinTransaction();
    GpuEao gpuEao = new GpuEao(em);
    Gpu gpu = gpuEao.find(Gpu.Series.RADEON_HD_4000, "Eine Graphiccarte");
    assertNotNull(gpu);
    gpu = gpuEao.find(Gpu.Series.GEFORCE_100, "Nocheine Grafikkarte");
    assertNull(gpu);
    utx.commit();
}
Also used : Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu) GpuEao(eu.ggnet.dwoss.spec.ee.eao.GpuEao) Test(org.junit.Test)

Example 17 with Gpu

use of eu.ggnet.dwoss.spec.ee.entity.piece.Gpu in project dwoss by gg-net.

the class EditGpuPanel method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    Gpu gpu = new Gpu(Type.MOBILE, Series.GEFORCE_500, "580");
    EditGpuPanel view = new EditGpuPanel(new ProductProcessorStub(), new ArrayList<Gpu>());
    view.setGpu(gpu);
    OkCancelDialog<EditGpuPanel> create = new OkCancelDialog<>("Spezifikationen", view);
    create.setVisible(true);
    System.out.println(view.getGpu());
    System.exit(0);
}
Also used : ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub) Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)

Example 18 with Gpu

use of eu.ggnet.dwoss.spec.ee.entity.piece.Gpu in project dwoss by gg-net.

the class EditGpuPanel method pre.

@Override
public boolean pre(CloseType type) {
    Gpu testGpu;
    if (type == CloseType.CANCEL)
        return true;
    if (!(mobileCheckBox.isSelected() || desktopCheckBox.isSelected())) {
        JOptionPane.showMessageDialog(this, "Kein Type ausgewählt");
        return false;
    }
    try {
        testGpu = updateGpu(new Gpu());
    } catch (NumberFormatException e) {
        JOptionPane.showMessageDialog(this, "Frequenz, Kerne oder wirtschaftl. Wert sind keine Zahlen");
        return false;
    }
    for (Gpu gpu1 : allgpu) {
        if (gpu1.getModel().equals(testGpu.getModel()) && gpu1.getSeries() == testGpu.getSeries()) {
            if ((gpu != null && gpu1.getId() != gpu.getId()) || gpu == null) {
                String text = "";
                text += "Die CPU ";
                text += testGpu.getModel() + " " + testGpu.getSeries().getNote();
                text += "exestiert schon mit einer anderen ID!\n";
                text += "Momentane ID:" + (gpu != null ? gpu.getId() : testGpu.getId());
                JOptionPane.showMessageDialog(this, text);
                return false;
            }
        }
    }
    try {
        if (gpu == null) {
            gpu = productProcessor.create(updateGpu(new Gpu()));
        } else {
            if (updateGpu(new Gpu()).equalsContent(gpu))
                return true;
            gpu = productProcessor.update(updateGpu(gpu));
        }
    } catch (IllegalArgumentException e) {
        JOptionPane.showMessageDialog(this, "Cpu existiert schon " + e.getMessage());
        return false;
    }
    return true;
}
Also used : Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)

Example 19 with Gpu

use of eu.ggnet.dwoss.spec.ee.entity.piece.Gpu in project dwoss by gg-net.

the class GpuListController method editSelected.

/**
 * Open EditCpuPanel via table selection
 */
public void editSelected() {
    EditGpuPanel gpuPanel = new EditGpuPanel(allGpus);
    gpuPanel.setGpu(model.getSelected());
    OkCancelDialog<EditGpuPanel> dialog = new OkCancelDialog<>(SwingUtilities.getWindowAncestor(this.view), "GPU bearbeiten", gpuPanel);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        model.remove(model.getSelected());
        Gpu editGpu = gpuPanel.getGpu();
        model.add(editGpu);
    }
}
Also used : OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)

Aggregations

Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)19 Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)11 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)9 Test (org.junit.Test)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 GpuEao (eu.ggnet.dwoss.spec.ee.eao.GpuEao)5 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)5 ProductSpecEao (eu.ggnet.dwoss.spec.ee.eao.ProductSpecEao)3 CpuEao (eu.ggnet.dwoss.spec.ee.eao.CpuEao)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