예제 #1
0
 @Override
 DependencyNode getTarget() {
   if (target == null) {
     target = new ImageAssetNode(2);
     target.addChild(new EngineNode<Image>(1, new Image("@drawable/man_stand_w_1.png")));
     target.setBase(new File(getDir(), AssetHandlerImpl.PROJECT_INTERNAL_PATH));
   }
   return target;
 }
예제 #2
0
  public static void main(String[] args) {

    Log4jConfig.configForConsole(Log4jConfig.Slf4jLevel.Info, new Object[] {});

    ArrayList<EditorLink> els = new ArrayList<EditorLink>();

    AssetDescriptor[] descriptors =
        new AssetDescriptor[] {
          new FramesAnimation(), new RectangleShape(), new BezierShape(), new Caption("Hi there!"),
        };
    for (AssetDescriptor a : descriptors) {
      AssetNode an = new AssetNode(els.size());
      an.addChild(new EngineNode<AssetDescriptor>(100 + els.size(), a));
      els.add(EditorLinkFactory.createLink(an, null));
    }
    {
      ImageAssetNode an = new ImageAssetNode(els.size());
      an.addChild(
          new EngineNode<AssetDescriptor>(
              100 + els.size(), new Image("@drawable/assets_image_vervideo.png")));
      els.add(EditorLinkFactory.createLink(an, null));
    }
    {
      VideoAssetNode an = new VideoAssetNode(els.size());
      an.addChild(
          new EngineNode<AssetDescriptor>(
              100 + els.size(), new Video("@binary/assets_video_IniciarTos.AVIXVID.webm")));
      els.add(EditorLinkFactory.createLink(an, null));
    }
    els.add(EditorLinkFactory.createLink(new QueryNode(els.size()), null));
    els.add(EditorLinkFactory.createLink(new EngineNode<Object>(els.size(), "guess not!"), null));

    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.setLayout(new GridBagLayout());
    GridBagConstraints gbc =
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(4, 4, 4, 4),
            0,
            0);
    for (EditorLink el : els) {
      gbc.gridy++;
      jf.add(el, gbc);
    }
    jf.setSize(150, 300);
    jf.setLocationRelativeTo(null);
    jf.setVisible(true);
  }
예제 #3
0
  public static void main(String[] args) {
    Log4jConfig.configForConsole(Log4jConfig.Slf4jLevel.Info);

    // initialize launcher & reflection
    Injector injector =
        Guice.createInjector(new DesktopModule(), new EditorGuiceModule(), new JavaToolsModule());
    ReflectionClassLoader.init(injector.getInstance(ReflectionClassLoader.class));
    Controller c = injector.getInstance(Controller.class);
    EditorModelImpl mi = (EditorModelImpl) c.getModel();
    mi.getLoader().setSaveDir(new File("src/main/resources/"));

    final AssetViewer rootAssetViewer = c.createAssetViewer();

    final ArrayList<EditorNode> ians = new ArrayList<EditorNode>();
    Identified root = new BasicElement();
    root.setId("fakeRoot");
    mi.addNode(null, null, root, false);
    for (int i = 0; i < 100; i++) {
      ImageAssetNode ian = new ImageAssetNode(i);
      Image image = new Image("@drawable/EditorIcon128x128.png");
      image.setId("id" + i);
      mi.addNode(mi.getNodeFor(root), "mock", image, false);
      ian.addChild(mi.getNodeFor(image));
      ian.setBase(new File("src/main/resources/", AssetHandlerImpl.PROJECT_INTERNAL_PATH));
      ians.add(ian);
      mi.registerEditorNodeWithGraph(ian);
    }
    final ThumbnailPanel tnp = new ThumbnailPanel();

    JButton jb = new JButton("click to add nodes");
    jb.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            tnp.setNodes(ians);
          }
        });
    JButton jbg = new JButton("grab a capture");
    jbg.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            Image i = (Image) ians.get(0).getFirst().getContent();
            System.err.println("Setting drawable to something: " + i + " " + i.getUri());
            rootAssetViewer.setDrawable(i);
          }
        });

    PropertiesTablePanel ptp = new PropertiesTablePanel();
    ptp.setNodes(ians);

    ptp.setController(c);

    JTabbedPane jtp = new JTabbedPane();
    jtp.add("Icons", tnp);
    jtp.add("Table", ptp);

    JFrame jf = new JFrame();
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.add(jtp);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(jb);
    buttonPanel.add(jbg);
    jf.add(buttonPanel, BorderLayout.SOUTH);
    jf.setSize(800, 600);
    jf.setLocationRelativeTo(null);
    jf.setVisible(true);
    jtp.add("assetViewer", rootAssetViewer.getCanvas());
  }