Package de.yaams.maker.helper.gui.form.core

Examples of de.yaams.maker.helper.gui.form.core.FormBuilder


   * @see de.yaams.packandgo.helper.gui.list.YSimpleList#open()
   */
  @Override
  protected void open() {
    // get form
    final FormBuilder f = getMainForm(null);

    // has it?
    if (f == null) {
      return;
    }

    // show
    if (YDialog.showForm(I18N.t("Projekt importieren"), "project_open", f) == false) {
      return;
    }

    // basics
    String type = f.getElement("basic.type").getContentAsString();
    File path = new File(f.getElement("basic.folder").getContentAsString());

    // add project
    add(new Project(path, f.getElement("basic.name").getContentAsString(), f.getElement("basic.icon").getContentAsString(), type));
  }
View Full Code Here


   */
  @Override
  public void add() {

    // get form
    final FormBuilder f = getMainForm(null);

    // has it?
    if (f == null) {
      return;
    }

    f.getElement("basic.folder").addValidator(new ValidatorBase() {

      @Override
      public void isValide(YMessagesDialog y) {
        // folder exist and contains files?
        File[] file = new File(f.getElement("basic.folder").getContentAsString()).listFiles();
        if (file != null && file.length > 0) {
          y.add(I18N.t("{0} enthält schon Dateien. Evtl. werden vorhandene überschrieben oder gelöscht.", f.getElement("basic.folder")
              .getContentAsString()), Level.WARN_INT);
        }

      }
    });

    // show
    if (YDialog.showForm(I18N.t("Projekt hinzufügen"), "project_add", f) == false) {
      return;
    }

    // basics
    String type = f.getElement("basic.type").getContentAsString();
    File path = new File(f.getElement("basic.folder").getContentAsString());

    Project p = new Project(path, f.getElement("basic.name").getContentAsString(), f.getElement("basic.icon").getContentAsString(), type);

    // create base project
    if (ProjectManagement.getType(type).createProject(p)) {
      // add project
      add(p);
View Full Code Here

   * Get more informations about this plugin
   *
   * @return
   */
  public FormBuilder getMoreInfo() {
    FormBuilder b = new FormBuilder("plugin.moreinfo");
    b.addElement("basic.name", new FormInfo(I18N.t("Info"), getDesc()).setSorting(-1));
    b.addElement("basic.author", new FormInfo(I18N.t("Autor"), getElement("author", "unknown")));
    if (YLevel.IS_ADVANCED) {
      b.addElement("basic.folder", new FormTextField(I18N.t("Path"), path.getAbsolutePath()));
    }
    b.addElement("basic.status", new FormSwing(I18N.t("Status"), status));
    b.addElement("basic.hp", new FormTextField(I18N.t("Homepage"), getElement("homepage", "-")));
    b.addElement("basic.version", new FormInfo(I18N.t("Inst. Version"), getElement("version", "0")));
    b.addElement("basic.versiono", new FormInfo(I18N.t("Online Version"), getOnlineElement("version", "0")));
    return b;
  }
View Full Code Here

  @Override
  protected void configIntern() {
    Project p = (Project) getSelectedObject();

    // get form
    FormBuilder f = getMainForm(p);
    f.getElement("basic.type").setEnabled(false);

    // show
    if (YDialog.showForm(I18N.t("Projekt editieren"), "project_opts", f) == false) {
      return;
    }

    // edit project
    p.setPath(new File(f.getElement("basic.folder").getContentAsString()));
    p.setTitle(f.getElement("basic.name").getContentAsString());
    p.setIcon(f.getElement("basic.icon").getContentAsString());
    p.updateDesc();
  }
View Full Code Here

    // get it
    final Project p = (Project) getSelectedObject();

    // form
    FormBuilder f = new FormBuilder("project.left");

    // add basics
    f.addHeader("main", new FormHeader(YAamsCore.NAME, "yaams").setSorting(-2));
    f.addElement("main.opts", new FormButton(I18N.t("Options"), "opts", new AE() {

      @Override
      public void run() {
        YaFrame.open(HomeTab.OPTIONS);

      }
    }));
    f.addElement("main.plugins", new FormButton(I18N.t("Plugins"), "plugin", new AE() {

      @Override
      public void run() {
        BasicTabEvent.openPlugin();

      }
    }).setSorting(1));
    f.addElement("main.feedback", new FormButton(I18N.t("Feedback"), "mail_web", new AE() {

      @Override
      public void run() {
        BasicTabEvent.openFeedback();

      }
    }).setSorting(2));

    // has project?
    if (p != null) {

      // main elements
      f.getHeader("basic").setTitle(p.getTitle()).setIcon(p.getIcon()).setCollapsed(true).setSorting(-1);
      f.addElement("basic.type", new FormInfo(I18N.t("Typ"), p.getType().getTitle()));

      // aktions
      f.addHeader("action", new FormHeader(I18N.t("Aktionen"), "mouse"));
      f.addElement("action.tab", new FormButton(I18N.t("Im Tab öffnen"), "tab_arrow", new AE() {

        @Override
        public void run() {
          doubleClick();

        }
      }).setSorting(-2));
      f.addElement("action.edit", new FormButton(I18N.t("Konfigurieren"), "opts", new AE() {

        @Override
        public void run() {
          config();

        }
      }).setSorting(-1));
      f.addElement("action.del", new FormButton(I18N.t("Löschen"), "trash", new AE() {

        @Override
        public void run() {
          del();

        }
      }));

      // add addons
      p.getType().leftForm(f, p);

      // show
      ppanel.setLeft(f.getPanel(true));
    } else {
      f.getHeader("basic").setTitle("Erste Schritte").setIcon("help");
      // aktions
      f.addElement("basic.add", new FormButton(I18N.t("Erstellen"), "project_add", new AE() {

        @Override
        public void run() {
          add();

        }
      }));
      f.addElement("basic.open", new FormButton(I18N.t("Importieren"), "folder", new AE() {

        @Override
        public void run() {
          open();

        }
      }));

      // show
      ppanel.setLeft(f.getPanel(true));
    }

  }
View Full Code Here

   */
  protected void reload() {
    actives.clear();

    // build form
    final FormBuilder f = new FormBuilder("plugins.details");
    f.getHeader("basic").setColumn(6);

    // has plugins?
    if (PluginLoader.getPlugins().size() == 0) {
      f.addElement("basic.error", new FormInfo("", I18N.t("Kein Plugin gefunden. Wählen Online prüfen aus, um die Liste "
          + "zu aktualisieren, oder füge manuell Plugins hinzu.")).setIcon("plugin_error", 32));
    }

    // run over all
    for (final String id : PluginLoader.getPlugins().keySet()) {
      // was added before?
      if (!f.existElement("basic." + id + "_box")) {
        // return;
      }

      final PluginInfo i = PluginLoader.getPlugins().get(id);

      f.addElement("basic." + id + "_box", new FormCheckbox(i.getTitle(), false).addChangeListener(new FormElementChangeListener() {

        @Override
        public void stateChanged(FormElement form) {
          JCheckBox c = (JCheckBox) form.getElement();
          // add or remove it?
          if (c.isSelected()) {
            actives.add(id);
          } else {
            actives.remove(id);
          }

        }
      }));

      f.addElement("basic." + id + "_detail", new FormSwing("", i.getStatusMessage()));
      f.addElement("basic." + id + "_moreinfo", new FormButton(I18N.t("Details"), i.getImg(), new AE() {

        @Override
        public void run() {
          YDialog.showForm(i.getTitle(), i.getImg(), i.getMoreInfo());

        }
      }));
    }

    // add buttons
    // add button
    f.addButton("change", YFactory.installTooltip(YFactory.b(I18N.t("Wechseln"), "reload", new AE() {

      @Override
      public void run() {
        for (String key : PluginLoader.getPlugins().keySet()) {
          JCheckBox c = (JCheckBox) f.getElement("basic." + key + "_box").getElement();
          c.setSelected(!c.isSelected());

        }

      }
    }), I18N.t("Wechselt den Stand der ausgewählten Plugins"), "reload"));

    // add button
    f.addButton("check", YFactory.b(I18N.t("Online prüfen"), "search", new AE() {

      @Override
      public void run() {
        PluginLoader.installOnlineInfo(true);
        // update plugin view
        reload();
      }
    }));

    // add button
    if (YLevel.IS_ADVANCED) {
      f.addButton("folder", YFactory.b(I18N.t("Pluginordner"), "folder_search", new AE() {

        @Override
        public void run() {
          SystemHelper.viewFile(PluginLoader.folder);
        }
      }));
      // add button
      f.addButton("enable", YFactory.b(I18N.t("Aktivieren"), "add", new AE() {

        @Override
        public void run() {
          // inform user
          if (checkSelected()) {
            // run over all
            for (String key : actives) {
              PluginLoader.getPlugins().get(key).setDisabled(false);
            }
          }
        }
      }));

      // add button
      f.addButton("disable", YFactory.b(I18N.t("Deaktivieren"), "del", new AE() {

        @Override
        public void run() {
          // inform user
          if (checkSelected()) {
            // run over all
            for (String key : actives) {
              PluginLoader.getPlugins().get(key).setDisabled(true);
            }
          }
        }
      }));
    }

    // add button
    f.addButton("del", YFactory.b(I18N.t("Deinstallieren"), "plugin_del", new AE() {

      @Override
      public void run() {
        // inform user
        if (checkSelected()) {
          // run over all
          for (String key : actives) {
            PluginLoader.uninstall(key);
          }
          SystemHelper.restart();
        }
      }
    }));

    // add button
    f.addButton("install", YFactory.installTooltip(YFactory.b(I18N.t("Installieren"), "setup", new AE() {

      @Override
      public void run() {
        // inform user
        if (checkSelected()) {
          // run over all
          for (String key : actives) {
            PluginLoader.installFromOnline(key);
          }
          SystemHelper.restart();
        }
      }
    }), I18N.t("Installiert bzw. aktualisiert die Ausgewählten"), "setup"));

    // add button
    f.addButton("open", YFactory.installTooltip(YFactory.b(I18N.t("Importieren"), "folder", new AE() {

      @Override
      public void run() {
        File[] fl = EditorIntegration.openDialog(true, false, new FileFilter() {

          @Override
          public String getDescription() {
            return "*.yex";
          }

          @Override
          public boolean accept(File f) {
            return f.isDirectory() || f.getName().endsWith(".yex");
          }
        });
        // copy all
        if (fl.length > 0) {
          for (File f : fl) {
            String id = PluginLoader.getIDForFile(f);
            FileHelper.copy(f, new File(PluginLoader.folder, id + ".yex"));
          }
          SystemHelper.restart();
        }

      }
    }), I18N.t("Öffnet einen Dialog und importiert, die angegeben .yex Dateien."), "folder"));

    // add it
    removeAll();
    add(f.getPanel(true));
    invalidate();
    revalidate();
  }
View Full Code Here

    // install options
    ExtentionManagement.add(OptionsTab.EXSYS, new IExtension() {

      @Override
      public void work(HashMap<String, Object> objects) {
        FormBuilder f = (FormBuilder) objects.get("form");

        // add it
        f.addHeader("plugins", new FormHeader(I18N.t("Plugins"), "plugin").setColumn(4));
        f.addElement("plugins.inet", YSettingHelper.bool(null, I18N.t("Internetzugriff aktivieren"), "net.access", true));
        f.addElement(AUTO, YSettingHelper.bool(null, I18N.t("Autom. Installation von Plugins"), AUTO, true));
        f.addElement(CHECK, YSettingHelper.combo(null, I18N.t("Updatecheck"), CHECK, "168", new String[] { "0", "24", "168", "714",
            "-1" }, new String[] { "Bei jedem Start", "Täglich", "Wöchentlich", "Monatlich", "Manuelle Prüfung" }));
      }
    });

    // install page
View Full Code Here

    // add setting
    ExtentionManagement.add("form.options.info", new IExtension() {

      @Override
      public void work(HashMap<String, Object> objects) {
        FormBuilder form = (FormBuilder) objects.get("form");
        form.addElement("basic.lang", new FormInfo(T.r("lang"), locale.getDisplayName()));

      }
    });

    // add setting
    ExtentionManagement.add("form.options.system", new IExtension() {

      @Override
      public void work(HashMap<String, Object> objects) {

        // add it
        FormBuilder form = (FormBuilder) objects.get("form");
        form.addElement("basic.lang",
            YSettingHelper.combo(null, T.r("lang"), "lang", "de", getLangIDs(), getLangNames()).setInfoTxt(T.r("lang.translate"))
                .addChangeListener(new FormElementChangeListener() {

                  @Override
                  public void stateChanged(FormElement form) {
                    setLocale(LocaleUtils.toLocale(form.getContentAsString()));

                  }
                }));
      }
    });
View Full Code Here

    try {
      TaskDialog task = new TaskDialog(YaFrame.get(), "");

      // show it
      // build form
      FormBuilder f = new FormBuilder("errorform.info");
      f.getHeader("basic").setTitle(I18N.t("Weitere Infos (freiwillig)")).setIcon("edit");
      f.addElement(
          "basic.contact",
          YSettingHelper.text(null, I18N.t("eMail"), "reporting.contact", "").setInfoTxt(
              I18N.t("Füge hier deine eMailadresse ein, wenn du eine Antwort wünscht oder Nachfragen erlaubst.")));
      f.addElement("basic.details", new FormTextArea(I18N.t("Ablauf"), "").setInfoTxt(I18N
          .t("Schreibe hier rein, was passiert ist, was du getan hast, wie es zu dem Fehler gekommen ist.")));

      // add details
      f.addHeader("error", new FormHeader(I18N.t("Details"), icon).setCollapsed(true));
      f.addElement("error.class", new FormTextField(I18N.t("Class"), t.getClass().toString()));
      f.addElement("error.mess", new FormTextField(I18N.t("Message"), YEx.toString(title, t, false)));
      f.addElement("error.stack", new FormTextArea(I18N.t("Stack"), Strings.stackStraceAsString(t)));

      task.setInstruction(I18N.t("{0}bericht einsenden", typ));
      task.setText(mess + (YLevel.IS_ADVANCED ? "<br>" + YEx.toString(title, t, false) : ""));
      task.setIcon(IconCache.get(icon, 64));
      task.setResizable(true);
      task.setFixedComponent(f.getPanel(true));
      task.setCommands(StandardCommand.OK.derive(I18N.t("{0} einsenden", typ), "mail"),
          StandardCommand.CANCEL.derive(I18N.t(exit ? "Programm beenden" : "Ignorieren"), "cancel"));
      TaskDialog.Command erg = task.show();
      if (erg != null && erg.getTitle().equals(I18N.t("{0} einsenden", typ))) {
        // send feedback
        sendError(t, title, f.getElement("basic.contact").getContentAsString(), f.getElement("basic.details").getContentAsString());
      } else {
        // close?
        if (exit) {
          SystemHelper.exit(0);
        }
View Full Code Here

    // download manually?
    if (y.getIcon(id).equals("open_web")) {
      if (isText) {
        // build form
        FormBuilder f = new FormBuilder("net.string");
        f.addElement("basic.help", new FormInfo("", I18N.t("Im 1. Feld steht der Link zur Seite. Den Link kopieren und mit einem "
            + "geeigneten Programm/Pc öffnen, danach im 2. Feld den Inhalt der  " + "Seite einfügen und Ok drücken"))
            .setSorting(-1));
        f.addElement("basic.source", new FormTextField("", link));
        f.addElement("basic.dest", new FormTextArea("", "").addValidator(new ValidatorNotEmpty()).setSorting(1));

        if (YDialog.showForm(I18N.t("Seite manuell anzeigen"), "open_web", f)) {
          return f.getElement("basic.dest").getContentAsString();
        }
        return null;
      } else {
        // build form
        FormBuilder f = new FormBuilder("net.download");
        f.addElement("basic.help",
            new FormInfo("", I18N.t("Im 1. Feld steht der Link zur Datei. Den Link kopieren und mit einem "
                + "geeigneten Programm/Pc runterladen, danach im 2. Feld die runtergeladene "
                + "Datei auswählen und Ok drücken")).setSorting(-1));
        f.addElement("basic.source", new FormTextField("", link));
        f.addElement("basic.dest", new FormFileSelectField("", null, JFileChooser.OPEN_DIALOG, false, false).setSorting(1));

        if (YDialog.showForm(I18N.t("Datei manuell runterladen"), "open_web", f)) {
          return new File(f.getElement("basic.dest").getContentAsString());
        }
        return null;
      }
    }
View Full Code Here

TOP

Related Classes of de.yaams.maker.helper.gui.form.core.FormBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.