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();
}
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);
}
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;
}
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);
}
}
Aggregations