Search in sources :

Example 1 with Language

use of de.neemann.gui.language.Language in project Digital by hneemann.

the class DocuTest method testDocu.

public void testDocu() throws IOException, NodeException, PinException, TransformerException, SAXException {
    FopFactory fopFactory = FopFactory.newInstance(new File(Resources.getRoot(), "docu/fop.xconf"));
    File maven = Resources.getRoot().getParentFile().getParentFile().getParentFile();
    File target = new File(maven, "target/docu");
    File target2 = new File(maven, "target/docuDist");
    File images = new File(target, "img");
    images.mkdirs();
    target2.mkdirs();
    final File library = new File(target, "library.xml");
    write74xx(library);
    for (Language l : Lang.getBundle().getSupportedLanguages()) {
        // set language
        Lang.setActualRuntimeLanguage(l);
        final String basename = "Documentation_" + l.getName();
        // write xml
        File xml = new File(target, basename + ".xml");
        try (Writer w = new OutputStreamWriter(new FileOutputStream(xml), "UTF-8")) {
            writeXML(w, images, l.getName(), library);
        }
        // start xslt transformation
        File xslFO = new File(target, basename + ".fo");
        File xslt = new File(Resources.getRoot(), "docu/elem2fo.xslt");
        startXalan(xml, xslt, xslFO);
        // write pdf
        File pdf = new File(target, basename + ".pdf");
        startFOP(fopFactory, xslFO, pdf);
        copy(pdf, new File(target2, "Doc_" + l + ".pdf"));
    }
}
Also used : Language(de.neemann.gui.language.Language) FopFactory(org.apache.fop.apps.FopFactory)

Example 2 with Language

use of de.neemann.gui.language.Language in project Digital by hneemann.

the class ScreenShots method mainScreenShot.

private static void mainScreenShot() {
    Lang.setActualRuntimeLanguage(new Language("en"));
    Settings.getInstance().getAttributes().set(Keys.SETTINGS_IEEE_SHAPES, true);
    new GuiTester("../../main/dig/processor/Processor.dig", "examples/processor/Processor.dig").press(' ').delay(500).add(new GuiTester.WindowCheck<>(GraphicDialog.class, (gt, gd) -> {
        graphic = gd;
        final Main main = (Main) gd.getParent();
        main.getCircuitComponent().requestFocus();
    })).delay(500).press(' ').add((gt) -> graphic.dispose()).delay(500).press("F1").add(new MainScreenShot("screenshot.png")).execute();
    new GuiTester().press("F10").press("RIGHT", 4).press("DOWN", 3).press("ENTER").delay(500).press("control typed a").type("A B + B !C + A !C").add(new GuiTester.SetFocusTo<>(ExpressionDialog.class, comp -> comp instanceof JButton && ((JButton) comp).getText().equals(Lang.get("btn_create")))).press("SPACE").delay(500).press("control typed -", 1).add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> main.getCircuitComponent().translateCircuit(-120, 0))).delay(500).press("F9").delay(500).add(new GuiTester.WindowCheck<>(TableDialog.class, (gt, td) -> {
        td.getContentPane().setPreferredSize(new Dimension(370, 280));
        td.pack();
        final Point location = td.getParent().getLocation();
        location.x += 640;
        location.y += 410;
        td.setLocation(location);
    })).delay(500).press("F1").delay(500).add(new GuiTester.WindowCheck<>(KarnaughMapDialog.class, (gt, td) -> {
        final Point location = td.getParent().getLocation();
        location.x -= 150;
        location.y -= 340;
        td.setLocation(location);
        td.getContentPane().setPreferredSize(new Dimension(390, 300));
        td.pack();
    })).delay(500).add(new MainScreenShot("screenshot2.png")).add(new GuiTester.CloseTopMost()).add(new GuiTester.CloseTopMost()).add(new GuiTester.CloseTopMost()).execute();
}
Also used : Keys(de.neemann.digital.core.element.Keys) InputEvent(java.awt.event.InputEvent) AttributeDialog(de.neemann.digital.gui.components.AttributeDialog) Resources(de.neemann.digital.integration.Resources) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog) BufferedImage(java.awt.image.BufferedImage) SIZE(de.neemann.digital.draw.shapes.GenericShape.SIZE) Language(de.neemann.gui.language.Language) TestCaseDescriptionDialog(de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog) Lang(de.neemann.digital.lang.Lang) TestCaseElement(de.neemann.digital.testing.TestCaseElement) File(java.io.File) TableDialog(de.neemann.digital.gui.components.table.TableDialog) Settings(de.neemann.digital.gui.Settings) java.awt(java.awt) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) ImageIO(javax.imageio.ImageIO) TestInGUI(de.neemann.digital.integration.TestInGUI) Main(de.neemann.digital.gui.Main) GraphicDialog(de.neemann.digital.gui.components.graphics.GraphicDialog) GuiTester(de.neemann.digital.integration.GuiTester) javax.swing(javax.swing) KarnaughMapDialog(de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog) TableDialog(de.neemann.digital.gui.components.table.TableDialog) ValueTableDialog(de.neemann.digital.gui.components.testing.ValueTableDialog) Language(de.neemann.gui.language.Language) GuiTester(de.neemann.digital.integration.GuiTester) ExpressionDialog(de.neemann.digital.gui.components.expression.ExpressionDialog) Main(de.neemann.digital.gui.Main)

Example 3 with Language

use of de.neemann.gui.language.Language in project Digital by hneemann.

the class ScreenShots method all.

private static void all() {
    // english
    Lang.setActualRuntimeLanguage(new Language("en"));
    Settings.getInstance().getAttributes().set(Keys.SETTINGS_GRID, true).set(Keys.SETTINGS_IEEE_SHAPES, true);
    mainScreenShot();
    firstSteps();
    hierarchicalDesign();
    // german
    Lang.setActualRuntimeLanguage(new Language("de"));
    Settings.getInstance().getAttributes().set(Keys.SETTINGS_IEEE_SHAPES, false);
    firstSteps();
    hierarchicalDesign();
}
Also used : Language(de.neemann.gui.language.Language)

Aggregations

Language (de.neemann.gui.language.Language)3 Keys (de.neemann.digital.core.element.Keys)1 SIZE (de.neemann.digital.draw.shapes.GenericShape.SIZE)1 Main (de.neemann.digital.gui.Main)1 Settings (de.neemann.digital.gui.Settings)1 AttributeDialog (de.neemann.digital.gui.components.AttributeDialog)1 ExpressionDialog (de.neemann.digital.gui.components.expression.ExpressionDialog)1 GraphicDialog (de.neemann.digital.gui.components.graphics.GraphicDialog)1 KarnaughMapDialog (de.neemann.digital.gui.components.karnaugh.KarnaughMapDialog)1 TableDialog (de.neemann.digital.gui.components.table.TableDialog)1 TestCaseDescriptionDialog (de.neemann.digital.gui.components.testing.TestCaseDescriptionDialog)1 ValueTableDialog (de.neemann.digital.gui.components.testing.ValueTableDialog)1 GuiTester (de.neemann.digital.integration.GuiTester)1 Resources (de.neemann.digital.integration.Resources)1 TestInGUI (de.neemann.digital.integration.TestInGUI)1 Lang (de.neemann.digital.lang.Lang)1 TestCaseElement (de.neemann.digital.testing.TestCaseElement)1 java.awt (java.awt)1 InputEvent (java.awt.event.InputEvent)1 BufferedImage (java.awt.image.BufferedImage)1