Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added wizard for yabs beginners

  • Loading branch information...
commit 0f03630a9fc84663e89d5d68ff13e6c90675f022 1 parent 7f07969
@anti43 authored
Showing with 2,819 additions and 945 deletions.
  1. +471 −472 src/enoa/handler/TemplateHandler.java
  2. +2 −1  src/mpv5/db/common/QueryHandler.java
  3. +2 −1  src/mpv5/globals/Messages.java
  4. +1 −1  src/mpv5/handler/FormFieldsHandler.java
  5. BIN  src/mpv5/resources/extra/invoice_de.odt
  6. +30 −1 src/mpv5/resources/languages/Panels.properties
  7. +3 −2 src/mpv5/ui/dialogs/Wizard.form
  8. +4 −3 src/mpv5/ui/dialogs/Wizard.java
  9. +1 −0  src/mpv5/ui/dialogs/subcomponents/ControlPanel_External.form
  10. +20 −1 src/mpv5/ui/dialogs/subcomponents/ControlPanel_External.java
  11. +2 −2 src/mpv5/ui/dialogs/subcomponents/ControlPanel_Templates.form
  12. +443 −443 src/mpv5/ui/dialogs/subcomponents/ControlPanel_Templates.java
  13. +105 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings1.form
  14. +108 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings1.java
  15. +234 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings2.form
  16. +219 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings2.java
  17. +233 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings3.form
  18. +319 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings3.java
  19. +119 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings4.form
  20. +278 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings4.java
  21. +105 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings5.form
  22. +100 −0 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings5.java
  23. +1 −1  src/mpv5/ui/frames/MPBabelFish.java
  24. +19 −17 src/mpv5/ui/frames/MPView.java
View
943 src/enoa/handler/TemplateHandler.java
@@ -25,352 +25,344 @@
import static mpv5.globals.Constants.*;
/**
- * This class provides {@link Template} loading and caching functionality, thread-safe
+ * This class provides {@link Template} loading and caching functionality,
+ * thread-safe
*/
public class TemplateHandler {
-
- /**
- * Return true if the Template for the currently logged in user, with the given type, and matching the targets group is loaded
- * @param group
- * @param type
- * @return
- */
- public static synchronized boolean isLoaded(Long group, int type) {
- String key = null;
- if (group != null) {
- key = mpv5.db.objects.User.getCurrentUser() + "@" + type + "@" + group;
- } else {
- key = mpv5.db.objects.User.getCurrentUser() + "@" + type + "@" + 1;
- }
-
- if (TEMPLATE_CACHE.containsKey(key)) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Return true if the Template for the currently logged in user, with the given type, and matching the targets group is loaded
- * @param target
- * @param type
- * @return
- */
- public static synchronized boolean isLoaded(Templateable target) {
- String key = null;
- if (target != null) {
- key = mpv5.db.objects.User.getCurrentUser() + "@" + target.templateType() + "@" + target.templateGroupIds();
- } else {
- key = mpv5.db.objects.User.getCurrentUser() + "@" + target.templateType() + "@" + 1;
- }
-
- if (TEMPLATE_CACHE.containsKey(key)) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Loads a template including neccesary files, target's group
- * @param target
- * @param typ
- * @return
- */
- public static synchronized Template loadTemplate(Templateable target) {
-
- int groupsids = 0;
- if (target != null) {
- groupsids = target.templateGroupIds();
- } else {
- groupsids = 1;
- }
-
- return loadTemplate(groupsids, target.templateType());
- }
-
- /**
- *
- * @param t
- * @return
- */
- public static synchronized Template loadTemplate(Template t) {
- return loadTemplate(t.__getGroupsids(), Integer.valueOf(t.__getMimetype()));
- }
-
- /**
- *
- * @param group
- * @param typ
- * @return
- */
- public static synchronized Template loadTemplate(int group, int typ) {
- return loadTemplate(Long.valueOf(group), typ);
- }
-
- /**
- * Loads a template including necessary files
- * @param target
- * @param groupsids
- * @param typ
- * @return
- */
- public static synchronized Template loadTemplate(long groupsids, int typ) {
- ReturnValue data;
- if (LocalSettings.getBooleanProperty(LocalSettings.OFFICE_USE)) {
- Integer type = new Integer(typ);
-
- if (groupsids < 0) {
- groupsids = 1;
- }
-
- String key = mpv5.db.objects.User.getCurrentUser() + "@" + type + "@" + groupsids;
- if (TEMPLATE_CACHE.containsKey(key)) {
- return TEMPLATE_CACHE.get(key);
- } else {
-
- if (type != null) {
- data = TemplateHandler.getDefinedTemplatesFor(groupsids, type);
- Template preloadedTemplate = null;
- if (data.hasData()) {
- try {
- preloadedTemplate = (Template) DatabaseObject.getObject(Context.getTemplate(), Integer.valueOf(data.getData()[data.getData().length - 1][0].toString()));
- Log.Debug(TemplateHandler.class, preloadedTemplate.getFile());
- if (preloadedTemplate.getFile().getName().endsWith("odt")) {
- if (LocalSettings.getBooleanProperty(LocalSettings.OFFICE_USE)) {
- preloadedTemplate.defineExFile(new ODTFile(preloadedTemplate.getFile().getPath()));
- Log.Debug(Template.class, "Loaded template: " + preloadedTemplate);
- mpv5.YabsViewProxy.instance().addMessage(preloadedTemplate + Messages.LOADED.toString(), Color.GREEN);
- } else {
-// Popup.notice(Messages.NOT_POSSIBLE + "\n" + Messages.OOCONNERROR);
- return null;
- }
- } else {
- preloadedTemplate.defineExFile(new PDFFile(preloadedTemplate.getFile().getPath()));
- }
- TEMPLATE_CACHE.put(key, preloadedTemplate);
- } catch (Throwable ex) {
- Log.Debug(ex);
- Log.Debug(Template.class, "Possibly invalid template: " + data.getData()[data.getData().length - 1][0].toString());
- return null;
- }
- } else {
- try {
- if (!(TEMPLATE_MISSING_NOTIFICATIONS.containsKey(type.toString()) && TEMPLATE_MISSING_NOTIFICATIONS.get(type.toString()).equals(Group.getObject(Context.getGroup(), (int) groupsids)))) {
- mpv5.YabsViewProxy.instance().addMessage(Messages.OO_NO_TEMPLATE + ": " + TemplateHandler.getName(type) + " [" + mpv5.db.objects.User.getCurrentUser() + "] [" + Group.getObject(Context.getGroup(), (int) groupsids) + "]", Color.YELLOW);
- Log.Debug(Template.class, "No template found for type: " + type + " for user: " + mpv5.db.objects.User.getCurrentUser() + " in GROUP " + Group.getObject(Context.getGroup(), (int) groupsids));
- TEMPLATE_MISSING_NOTIFICATIONS.put(type.toString(), (Group) Group.getObject(Context.getGroup(), (int) groupsids));
- }
- } catch (NodataFoundException nodataFoundException) {
- Log.Debug(Template.class, nodataFoundException.getMessage());
- }
- }
- return preloadedTemplate;
- } else {
- return null;
- }
- }
- } else {
- return null;
- }
- }
-
- private static ReturnValue getDefinedTemplatesFor(long groupsids, Integer type) {
- ReturnValue data = QueryHandler.getConnection().freeQuery(
- "SELECT templatesids FROM templatestousers LEFT OUTER JOIN templates AS templates0 ON "
- + "templates0.ids = templatestousers.templatesids WHERE templatestousers.usersids="
- + mpv5.db.objects.User.getCurrentUser().__getIDS()
- + " AND "
- + "templates0.mimetype='" + type
- + "' AND templatestousers.IDS>0 "
- + "AND templates0.groupsids = " + groupsids, MPSecurityManager.VIEW, null);
- if (!data.hasData()) {
- data = QueryHandler.getConnection().freeQuery(
- "SELECT templatesids FROM templatestousers LEFT OUTER JOIN templates AS templates0 ON "
- + "templates0.ids = templatestousers.templatesids WHERE templatestousers.usersids="
- + mpv5.db.objects.User.getCurrentUser().__getIDS()
- + " AND "
- + "templates0.mimetype='" + type
- + "' AND templatestousers.IDS>0 "
- + "AND templates0.groupsids = 1", MPSecurityManager.VIEW, null);
- }
- Log.Debug(TemplateHandler.class, "gefundene Daten: " + data.hasData());
- return data;
- }
-
- /**
- * An enum over the available template types and their String representation
- * @return
- */
- public static MPEnum[] getTypes() {
- MPEnum[] types = new MPEnum[15];
- types[0] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_BILL;
- }
-
- public String getName() {
- return Messages.TYPE_BILL.toString();
- }
- };
-
- types[1] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_OFFER;
- }
-
- public String getName() {
- return Messages.TYPE_OFFER.toString();
- }
- };
-
- types[2] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_ORDER;
- }
-
- public String getName() {
- return Messages.TYPE_ORDER.toString();
- }
- };
-
- types[3] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_CONTACT;
- }
-
- public String getName() {
- return Messages.TYPE_CONTACT.toString();
- }
- };
-
- types[4] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_DELIVERY_NOTE;
- }
-
- public String getName() {
- return Messages.TYPE_DELIVERY.toString();
- }
- };
-
- types[5] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_ORDER_CONFIRMATION;
- }
-
- public String getName() {
- return Messages.TYPE_CONFIRMATION.toString();
- }
- };
-
- types[6] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_PRODUCT;
- }
-
- public String getName() {
- return Messages.TYPE_PRODUCT.toString();
- }
- };
-
- types[7] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_SERVICE;
- }
-
- public String getName() {
- return Messages.TYPE_SERVICE.toString();
- }
- };
-
- types[8] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_REMINDER;
- }
-
- public String getName() {
- return Messages.TYPE_REMINDER.toString();
- }
- };
-
- types[9] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_JOURNAL;
- }
-
- public String getName() {
- return Messages.TYPE_JOURNAL.toString();
- }
- };
-
- types[10] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_PRODUCT_ORDER;
- }
-
- public String getName() {
- return Messages.TYPE_PRODUCT_ORDER.toString();
- }
- };
-
- types[11] = new MPEnum() {
-
- public Integer getId() {
- return TYPE_CONTACT;
- }
-
- public String getName() {
- return Messages.TYPE_CONTRACT.toString();
- }
- };
-
- types[12] = new MPEnum() {
- public Integer getId() {
- return TYPE_CONVERSATION;
- }
-
- public String getName() {
- return Messages.TYPE_CONVERSATION.toString();
- }
- };
-
- types[13] = new MPEnum() {
+ /**
+ * Return true if the Template for the currently logged in user, with the
+ * given type, and matching the targets group is loaded
+ *
+ * @param group
+ * @param type
+ * @return
+ */
+ public static synchronized boolean isLoaded(Long group, int type) {
+ String key = null;
+ if (group != null) {
+ key = mpv5.db.objects.User.getCurrentUser() + "@" + type + "@" + group;
+ } else {
+ key = mpv5.db.objects.User.getCurrentUser() + "@" + type + "@" + 1;
+ }
+
+ if (TEMPLATE_CACHE.containsKey(key)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
- public Integer getId() {
- return TYPE_MASSPRINT;
- }
+ /**
+ * Return true if the Template for the currently logged in user, with the
+ * given type, and matching the targets group is loaded
+ *
+ * @param target
+ * @param type
+ * @return
+ */
+ public static synchronized boolean isLoaded(Templateable target) {
+ String key = null;
+ if (target != null) {
+ key = mpv5.db.objects.User.getCurrentUser() + "@" + target.templateType() + "@" + target.templateGroupIds();
+ } else {
+ key = mpv5.db.objects.User.getCurrentUser() + "@" + target.templateType() + "@" + 1;
+ }
+
+ if (TEMPLATE_CACHE.containsKey(key)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
- public String getName() {
- return Messages.TYPE_MASSPRINT.toString();
- }
- };
+ /**
+ * Loads a template including neccesary files, target's group
+ *
+ * @param target
+ * @param typ
+ * @return
+ */
+ public static synchronized Template loadTemplate(Templateable target) {
+
+ int groupsids = 0;
+ if (target != null) {
+ groupsids = target.templateGroupIds();
+ } else {
+ groupsids = 1;
+ }
+
+ return loadTemplate(groupsids, target.templateType());
+ }
- types[14] = new MPEnum() {
+ /**
+ *
+ * @param t
+ * @return
+ */
+ public static synchronized Template loadTemplate(Template t) {
+ return loadTemplate(t.__getGroupsids(), Integer.valueOf(t.__getMimetype()));
+ }
- public Integer getId() {
- return TYPE_ACTIVITY;
- }
+ /**
+ *
+ * @param group
+ * @param typ
+ * @return
+ */
+ public static synchronized Template loadTemplate(int group, int typ) {
+ return loadTemplate(Long.valueOf(group), typ);
+ }
- public String getName() {
- return Messages.TYPE_ACTIVITY.toString();
- }
- };
- return types;
- }
+ /**
+ * Loads a template including necessary files
+ *
+ * @param target
+ * @param groupsids
+ * @param typ
+ * @return
+ */
+ public static synchronized Template loadTemplate(long groupsids, int typ) {
+ ReturnValue data;
+ if (LocalSettings.getBooleanProperty(LocalSettings.OFFICE_USE)) {
+ Integer type = new Integer(typ);
+
+ if (groupsids < 0) {
+ groupsids = 1;
+ }
+
+ String key = mpv5.db.objects.User.getCurrentUser() + "@" + type + "@" + groupsids;
+ if (TEMPLATE_CACHE.containsKey(key)) {
+ return TEMPLATE_CACHE.get(key);
+ } else {
+
+ if (type != null) {
+ data = TemplateHandler.getDefinedTemplatesFor(groupsids, type);
+ Template preloadedTemplate = null;
+ if (data.hasData()) {
+ try {
+ preloadedTemplate = (Template) DatabaseObject.getObject(Context.getTemplate(), Integer.valueOf(data.getData()[data.getData().length - 1][0].toString()));
+ Log.Debug(TemplateHandler.class, preloadedTemplate.getFile());
+ if (preloadedTemplate.getFile().getName().endsWith("pdf")) {
+ preloadedTemplate.defineExFile(new PDFFile(preloadedTemplate.getFile().getPath()));
+ } else {
+ if (LocalSettings.getBooleanProperty(LocalSettings.OFFICE_USE)) {
+ preloadedTemplate.defineExFile(new ODTFile(preloadedTemplate.getFile().getPath()));
+ Log.Debug(Template.class, "Loaded template: " + preloadedTemplate);
+ mpv5.YabsViewProxy.instance().addMessage(preloadedTemplate + Messages.LOADED.toString(), Color.GREEN);
+ } else {
+// Popup.notice(Messages.NOT_POSSIBLE + "\n" + Messages.OOCONNERROR);
+ return null;
+ }
+ }
+ TEMPLATE_CACHE.put(key, preloadedTemplate);
+ } catch (Throwable ex) {
+ Log.Debug(ex);
+ Log.Debug(Template.class, "Possibly invalid template: " + data.getData()[data.getData().length - 1][0].toString());
+ return null;
+ }
+ } else {
+ try {
+ if (!(TEMPLATE_MISSING_NOTIFICATIONS.containsKey(type.toString()) && TEMPLATE_MISSING_NOTIFICATIONS.get(type.toString()).equals(Group.getObject(Context.getGroup(), (int) groupsids)))) {
+ mpv5.YabsViewProxy.instance().addMessage(Messages.OO_NO_TEMPLATE + ": " + TemplateHandler.getName(type) + " [" + mpv5.db.objects.User.getCurrentUser() + "] [" + Group.getObject(Context.getGroup(), (int) groupsids) + "]", Color.YELLOW);
+ Log.Debug(Template.class, "No template found for type: " + type + " for user: " + mpv5.db.objects.User.getCurrentUser() + " in GROUP " + Group.getObject(Context.getGroup(), (int) groupsids));
+ TEMPLATE_MISSING_NOTIFICATIONS.put(type.toString(), (Group) Group.getObject(Context.getGroup(), (int) groupsids));
+ }
+ } catch (NodataFoundException nodataFoundException) {
+ Log.Debug(Template.class, nodataFoundException.getMessage());
+ }
+ }
+ return preloadedTemplate;
+ } else {
+ return null;
+ }
+ }
+ } else {
+ return null;
+ }
+ }
+
+ private static ReturnValue getDefinedTemplatesFor(long groupsids, Integer type) {
+ ReturnValue data = QueryHandler.getConnection().freeQuery(
+ "SELECT templatesids FROM templatestousers LEFT OUTER JOIN templates AS templates0 ON "
+ + "templates0.ids = templatestousers.templatesids WHERE templatestousers.usersids="
+ + mpv5.db.objects.User.getCurrentUser().__getIDS()
+ + " AND "
+ + "templates0.mimetype='" + type
+ + "' AND templatestousers.IDS>0 "
+ + "AND templates0.groupsids = " + groupsids, MPSecurityManager.VIEW, null);
+ if (!data.hasData()) {
+ data = QueryHandler.getConnection().freeQuery(
+ "SELECT templatesids FROM templatestousers LEFT OUTER JOIN templates AS templates0 ON "
+ + "templates0.ids = templatestousers.templatesids WHERE templatestousers.usersids="
+ + mpv5.db.objects.User.getCurrentUser().__getIDS()
+ + " AND "
+ + "templates0.mimetype='" + type
+ + "' AND templatestousers.IDS>0 "
+ + "AND templates0.groupsids = 1", MPSecurityManager.VIEW, null);
+ }
+ Log.Debug(TemplateHandler.class, "gefundene Daten: " + data.hasData());
+ return data;
+ }
+ /**
+ * An enum over the available template types and their String representation
+ *
+ * @return
+ */
+ public static MPEnum[] getTypes() {
+ MPEnum[] types = new MPEnum[15];
+ types[0] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_BILL;
+ }
+
+ public String getName() {
+ return Messages.TYPE_BILL.toString();
+ }
+ };
+
+ types[1] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_OFFER;
+ }
+
+ public String getName() {
+ return Messages.TYPE_OFFER.toString();
+ }
+ };
+
+ types[2] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_ORDER;
+ }
+
+ public String getName() {
+ return Messages.TYPE_ORDER.toString();
+ }
+ };
+
+ types[3] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_CONTACT;
+ }
+
+ public String getName() {
+ return Messages.TYPE_CONTACT.toString();
+ }
+ };
+
+ types[4] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_DELIVERY_NOTE;
+ }
+
+ public String getName() {
+ return Messages.TYPE_DELIVERY.toString();
+ }
+ };
+
+ types[5] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_ORDER_CONFIRMATION;
+ }
+
+ public String getName() {
+ return Messages.TYPE_CONFIRMATION.toString();
+ }
+ };
+
+ types[6] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_PRODUCT;
+ }
+
+ public String getName() {
+ return Messages.TYPE_PRODUCT.toString();
+ }
+ };
+
+ types[7] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_SERVICE;
+ }
+
+ public String getName() {
+ return Messages.TYPE_SERVICE.toString();
+ }
+ };
+
+ types[8] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_REMINDER;
+ }
+
+ public String getName() {
+ return Messages.TYPE_REMINDER.toString();
+ }
+ };
+
+ types[9] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_JOURNAL;
+ }
+
+ public String getName() {
+ return Messages.TYPE_JOURNAL.toString();
+ }
+ };
+
+ types[10] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_PRODUCT_ORDER;
+ }
+
+ public String getName() {
+ return Messages.TYPE_PRODUCT_ORDER.toString();
+ }
+ };
+
+ types[11] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_CONTACT;
+ }
+
+ public String getName() {
+ return Messages.TYPE_CONTRACT.toString();
+ }
+ };
+
+ types[12] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_CONVERSATION;
+ }
+
+ public String getName() {
+ return Messages.TYPE_CONVERSATION.toString();
+ }
+ };
+
+ types[13] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_MASSPRINT;
+ }
+
+ public String getName() {
+ return Messages.TYPE_MASSPRINT.toString();
+ }
+ };
+
+ types[14] = new MPEnum() {
+ public Integer getId() {
+ return TYPE_ACTIVITY;
+ }
+
+ public String getName() {
+ return Messages.TYPE_ACTIVITY.toString();
+ }
+ };
+ return types;
+ }
// /**
// * (P)reload the template files
// * @deprecated performance..
@@ -448,115 +440,121 @@ public String getName() {
// new Thread(runnable).start();
// }
// }
+ /**
+ * The cache of the templates
+ */
+ public static HashMap<String, Template> TEMPLATE_CACHE = new HashMap<String, Template>();
+ public static HashMap<String, Group> TEMPLATE_MISSING_NOTIFICATIONS = new HashMap<String, Group>();
- /**
- * The cache of the templates
- */
- public static HashMap<String, Template> TEMPLATE_CACHE = new HashMap<String, Template>();
- public static HashMap<String, Group> TEMPLATE_MISSING_NOTIFICATIONS = new HashMap<String, Group>();
-
- /**
- * Load a template (if not already done) and enable the given button after loading.
- * @param button
- * @param dataOwner
- */
- public static void loadTemplateFor(final JComponent button, final Templateable dataOwner) {
- loadTemplate(dataOwner.templateGroupIds(), dataOwner.templateType());
- }
-
- /**
- * Load a template for a specific GROUP rather than the dataOwners group (if not already done) and enable the given button after loading.
- * @param button
- * @param typ
- * @param groupsids
- */
- public static void loadTemplateFor(final JComponent button, final long groupsids, final int typ) {
- button.setEnabled(false);
- Runnable runnable = new Runnable() {
-
- @Override
- public void run() {
- loadTemplate(groupsids, typ);
- button.setEnabled(isLoaded(groupsids, typ));
- }
- };
- new Thread(runnable).start();
- }
-
- /**
- * Gets the String representation of the given template type
- * @param type
- * @return
- */
- public static String getName(int type) {
- MPEnum[] e = getTypes();
- for (int i = 0; i < e.length; i++) {
- MPEnum mPEnum = e[i];
- if (mPEnum.getId().intValue() == type) {
- return mPEnum.getName();
- }
- }
- return "<undefined> [" + type + "]";
- }
-
- /**
- * Load a template (if not already done) and enable the given button after loading.
- * @param jComponent
- * @param dataOwner
- * @param TYPE
- */
- public static void loadTemplateFor(final JComponent[] jComponent, final Templateable dataOwner) {
- for (int i = 0; i < jComponent.length; i++) {
- JComponent jComponent1 = jComponent[i];
- jComponent1.setEnabled(false);
- }
- Runnable runnable = new Runnable() {
-
- public void run() {
- loadTemplate(dataOwner);
- for (int i = 0; i < jComponent.length; i++) {
- JComponent jComponent1 = jComponent[i];
- jComponent1.setEnabled(isLoaded(dataOwner));
- }
- }
- };
- new Thread(runnable).start();
- }
-
- /**
- * Load a template (if not already done) and enable the given button after loading.
- * @param jComponent
- * @param typ
- * @param groupsids
- */
- public static void loadTemplateFor(final JComponent[] jComponent, final long groupsids, final int typ) {
- for (int i = 0; i < jComponent.length; i++) {
- JComponent jComponent1 = jComponent[i];
- jComponent1.setEnabled(false);
- }
- Runnable runnable = new Runnable() {
-
- @Override
- public void run() {
- loadTemplate(groupsids, typ);
- for (int i = 0; i < jComponent.length; i++) {
- JComponent jComponent1 = jComponent[i];
- jComponent1.setEnabled(isLoaded(groupsids, typ));
- }
- }
- };
- new Thread(runnable).start();
- }
+ /**
+ * Load a template (if not already done) and enable the given button after
+ * loading.
+ *
+ * @param button
+ * @param dataOwner
+ */
+ public static void loadTemplateFor(final JComponent button, final Templateable dataOwner) {
+ loadTemplate(dataOwner.templateGroupIds(), dataOwner.templateType());
+ }
- /**
- * Imports a template file
- * @param file
- * @return
- */
- public static boolean importTemplate(File file) {
- Template t = new Template();
+ /**
+ * Load a template for a specific GROUP rather than the dataOwners group (if
+ * not already done) and enable the given button after loading.
+ *
+ * @param button
+ * @param typ
+ * @param groupsids
+ */
+ public static void loadTemplateFor(final JComponent button, final long groupsids, final int typ) {
+ button.setEnabled(false);
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ loadTemplate(groupsids, typ);
+ button.setEnabled(isLoaded(groupsids, typ));
+ }
+ };
+ new Thread(runnable).start();
+ }
- return QueryHandler.instanceOf().clone(Context.getFiles(), (DataPanel) null).insertFile(file, t, new SaveString(file.getName(), true));
+ /**
+ * Gets the String representation of the given template type
+ *
+ * @param type
+ * @return
+ */
+ public static String getName(int type) {
+ MPEnum[] e = getTypes();
+ for (int i = 0; i < e.length; i++) {
+ MPEnum mPEnum = e[i];
+ if (mPEnum.getId().intValue() == type) {
+ return mPEnum.getName();
+ }
+ }
+ return "<undefined> [" + type + "]";
+ }
+
+ /**
+ * Load a template (if not already done) and enable the given button after
+ * loading.
+ *
+ * @param jComponent
+ * @param dataOwner
+ * @param TYPE
+ */
+ public static void loadTemplateFor(final JComponent[] jComponent, final Templateable dataOwner) {
+ for (int i = 0; i < jComponent.length; i++) {
+ JComponent jComponent1 = jComponent[i];
+ jComponent1.setEnabled(false);
+ }
+ Runnable runnable = new Runnable() {
+ public void run() {
+ loadTemplate(dataOwner);
+ for (int i = 0; i < jComponent.length; i++) {
+ JComponent jComponent1 = jComponent[i];
+ jComponent1.setEnabled(isLoaded(dataOwner));
+ }
+ }
+ };
+ new Thread(runnable).start();
+ }
+
+ /**
+ * Load a template (if not already done) and enable the given button after
+ * loading.
+ *
+ * @param jComponent
+ * @param typ
+ * @param groupsids
+ */
+ public static void loadTemplateFor(final JComponent[] jComponent, final long groupsids, final int typ) {
+ for (int i = 0; i < jComponent.length; i++) {
+ JComponent jComponent1 = jComponent[i];
+ jComponent1.setEnabled(false);
+ }
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ loadTemplate(groupsids, typ);
+ for (int i = 0; i < jComponent.length; i++) {
+ JComponent jComponent1 = jComponent[i];
+ jComponent1.setEnabled(isLoaded(groupsids, typ));
+ }
+ }
+ };
+ new Thread(runnable).start();
+ }
+
+ /**
+ * Imports a template file
+ *
+ * @param file
+ * @return
+ */
+ public static boolean importTemplate(File file) {
+ Template t = new Template();
+
+ return QueryHandler.instanceOf().clone(Context.getFiles(), (DataPanel) null).insertFile(file, t, new SaveString(file.getName(), true));
// User object = mpv5.db.objects.User.getCurrentUser();
//
@@ -571,34 +569,35 @@ public static boolean importTemplate(File file) {
// c.add("cname", dataOwner.__getIDS() + "@" + object.__getIDS() + "@" + mpv5.db.objects.User.getCurrentUser().__getGroupsids());
// QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).insert(c, null);
- }
-
+ }
+
/**
- * Exports all template Objects for give template-Type
- * @param Type - the templatetype
- * @return template[] - the template assoziated to the give templatetype
- */
- public static Template[] getTemplatesForType(long groupsids, int typ) {
- String key = mpv5.db.objects.User.getCurrentUser() + "@" + new Integer(typ) + "@" + groupsids;
- ReturnValue data = TemplateHandler.getDefinedTemplatesFor(groupsids, new Integer(typ));
- Iterator<Object[]> it = data.getDataIterator();
- Template[] templates = new Template[data.getData().length];
- int i = 0;
- while (it.hasNext()) {
- Object[] ret = it.next();
- try {
- templates[i++] = (Template) DatabaseObject.getObject(Context.getTemplate(), Integer.valueOf(ret[0].toString()));
- } catch (Exception ex) {
- Log.Debug(Template.class, ex);
- }
- }
- return templates;
- }
-
- /**
- * Clear the template cache
- */
- public static void clearCache() {
- TEMPLATE_CACHE.clear();
- }
+ * Exports all template Objects for give template-Type
+ *
+ * @param Type - the templatetype
+ * @return template[] - the template assoziated to the give templatetype
+ */
+ public static Template[] getTemplatesForType(long groupsids, int typ) {
+ String key = mpv5.db.objects.User.getCurrentUser() + "@" + new Integer(typ) + "@" + groupsids;
+ ReturnValue data = TemplateHandler.getDefinedTemplatesFor(groupsids, new Integer(typ));
+ Iterator<Object[]> it = data.getDataIterator();
+ Template[] templates = new Template[data.getData().length];
+ int i = 0;
+ while (it.hasNext()) {
+ Object[] ret = it.next();
+ try {
+ templates[i++] = (Template) DatabaseObject.getObject(Context.getTemplate(), Integer.valueOf(ret[0].toString()));
+ } catch (Exception ex) {
+ Log.Debug(Template.class, ex);
+ }
+ }
+ return templates;
+ }
+
+ /**
+ * Clear the template cache
+ */
+ public static void clearCache() {
+ TEMPLATE_CACHE.clear();
+ }
}
View
3  src/mpv5/db/common/QueryHandler.java
@@ -2083,13 +2083,14 @@ public synchronized QueryHandler clone(Context context, int limit, boolean inBac
* @return
*/
public synchronized QueryHandler clone(Context c, DataPanel viewToBeNotified) {
- this.viewToBeNotified = viewToBeNotified;
+
QueryHandler theClone = null;
this.context = c;
try {
theClone = (QueryHandler) this.clone();
theClone.setTable(context.getDbIdentity());
theClone.runInBackground = false;
+ theClone.viewToBeNotified = viewToBeNotified;
} catch (CloneNotSupportedException ex) {
mpv5.logging.Log.Debug(ex);//Logger.getLogger(QueryHandler.class.getName()).log(Level.SEVERE, null, ex);
}
View
3  src/mpv5/globals/Messages.java
@@ -349,7 +349,8 @@
FLUSHING_TMP_TABLE("Flush targettable for inserting"),
OVERRITE_DATABASE("This will override the actuall Database!\nIt's recommend to make a Backup befor you proceed.\nAre You sure?"),
SET_STATUS_PAID("Set to status: 'Paid'"),
- STOCK_MANAGER("Stock management");
+ STOCK_MANAGER("Stock management"),
+ PLEASE_WAIT("Please wait..");
/**
* @return the missing
View
2  src/mpv5/handler/FormFieldsHandler.java
@@ -111,7 +111,7 @@ public FormFieldsHandler(DatabaseObject obj) {
for (int i = 0; i < mapi.size(); i++) {
String[] strings = mapi.get(i);
if (strings[1] != null) {
- maps.put("company." + strings[0], strings[1].contains("[") ? VariablesHandler.parse(strings[1], obj) : strings[1]);
+ maps.put("companyinfo." + strings[0], strings[1].contains("[") ? VariablesHandler.parse(strings[1], obj) : strings[1]);
}
}
View
BIN  src/mpv5/resources/extra/invoice_de.odt
Binary file not shown
View
31 src/mpv5/resources/languages/Panels.properties
@@ -2004,7 +2004,7 @@ JournalPanel.filterinvoice.text=Unpaid Invoices
JournalPanel.filternone.text=None
JournalPanel.jPanel10.border.title=Filter
ControlPanel_External.jButton6.text=Let Yabs decide
-MPView.jMenuItem50.text=Change language from file
+MPView.jMenuItem50.text=Installation Wizard
ContactPanel.filetab.TabConstraints.tabTitle=Files
ProductOrderPanel.groupnameselect._Label=Group
ControlPanel_Formats.minstart._Label=Min. Start
@@ -2019,3 +2019,32 @@ ControlPanel_Schedule.offer1.text=Use offers at Homescreen
MPBabelFish.transid.text=live client id
MPBabelFish.transsecre.text=live client secret
MPBabelFish.jButton1.text=Go
+wizard_FirstSettings1.jPanel1.border.title=Yabs Installation - Wizard
+wizard_FirstSettings1.jTextPane1.text=Welcome to Yabs!\nThis wizard will help you through the first steps for most yabs beginners.\nTo start, you should have downloaded the following file already:\n\n- a recent language file for yabs \n\nthis file should be available from your instalation package or openyabs.org\n\nPlease click Next when you are ready.
+wizard_FirstSettings2.jPanel1.border.title=Yabs Installation - Wizard
+wizard_FirstSettings2.street._Label=Street
+wizard_FirstSettings2.zip._Label=Zip
+wizard_FirstSettings2.email._Label=Email
+wizard_FirstSettings2.country._Label=Country
+wizard_FirstSettings2.phone._Label=Phone
+wizard_FirstSettings2.city._Label=City
+wizard_FirstSettings2.firstname._Label=Firstname
+wizard_FirstSettings2.name._Label=Name
+wizard_FirstSettings2.business._Label=Business
+wizard_FirstSettings2.jPanel2.border.title=Company-Info
+wizard_FirstSettings2.jTextPane2.text=Please fill in some of your personal info. This data is only used to fill the acording fields in the templates for export, and you can change it anytime within yabs
+wizard_FirstSettings3.jTextPane1.text=Yabs will now try to connect to your local Office installation.\nPlease check the autodetected values below and edit if neccessary. Then use the Test button to test the connection.
+wizard_FirstSettings3.jPanel1.border.title=Yabs Installation - Wizard
+wizard_FirstSettings3.jPanel3.border.title=OpenOffice / LibreOffice
+wizard_FirstSettings3.jLabel3.text=-or-
+wizard_FirstSettings3.labeledTextField2._Label=Port
+wizard_FirstSettings3.labeledTextField1._Text=http://
+wizard_FirstSettings3.labeledTextField1._Label=Host
+wizard_FirstSettings3.jCheckBox3.text=Remote Server:
+wizard_FirstSettings3.labeledTextChooser2._Label=Path
+wizard_FirstSettings3.jButton3.text=Test
+wizard_FirstSettings4.jTextPane1.text=The wizard will now import your language file and assign a demo template of type "Invoice" to your user. Please specify the language file below.\n
+wizard_FirstSettings4.jPanel1.border.title=Yabs Installation - Wizard
+wizard_FirstSettings4.labeledTextChooser2._Label=Yabs language file
+wizard_FirstSettings5.jPanel1.border.title=Yabs Installation - Wizard
+wizard_FirstSettings5.jTextPane1.text=All set! Please restart Yabs now.
View
5 src/mpv5/ui/dialogs/Wizard.form
@@ -1,4 +1,4 @@
-<?xml version="1.1" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
@@ -13,6 +13,7 @@
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
@@ -106,7 +107,7 @@
<Component id="back" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cancel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
- <Component id="jScrollPane2" pref="30" max="32767" attributes="0"/>
+ <Component id="jScrollPane2" pref="29" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
View
7 src/mpv5/ui/dialogs/Wizard.java
@@ -242,9 +242,10 @@ private void backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:ev
public void run() {
try {
if (((Wizardable) content.getComponent(0)).back() && level > 0) {
- content.remove(lastpanel);
- content.validate();
- validate();
+ content.removeAll();
+ content.invalidate();
+ content.repaint();
+ invalidate();
repaint();
content.add(contentlist.get(level - 1), BorderLayout.CENTER);
level--;
View
1  src/mpv5/ui/dialogs/subcomponents/ControlPanel_External.form
@@ -196,6 +196,7 @@
</Properties>
<Events>
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="autoItemStateChanged"/>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="autoActionPerformed"/>
</Events>
</Component>
</SubComponents>
View
21 src/mpv5/ui/dialogs/subcomponents/ControlPanel_External.java
@@ -66,7 +66,7 @@ private void initComponents() {
setName("Form"); // NOI18N
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
- java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle();; // NOI18N
+ java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle();// NOI18N
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("ControlPanel_External.jPanel2.border.title"))); // NOI18N
jPanel2.setName("jPanel2"); // NOI18N
@@ -122,6 +122,11 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) {
autoItemStateChanged(evt);
}
});
+ auto.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ autoActionPerformed(evt);
+ }
+ });
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
@@ -354,6 +359,10 @@ private void autoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:eve
LocalSettings.save();
}//GEN-LAST:event_autoItemStateChanged
+ private void autoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_autoActionPerformed
+
public void setValues(PropertyStore values) {
oldvalues = values;
try {
@@ -364,6 +373,7 @@ public void setValues(PropertyStore values) {
labeledTextField1.setText(LocalSettings.getProperty(LocalSettings.OFFICE_HOST));
labeledTextField2.setText(LocalSettings.getProperty(LocalSettings.OFFICE_PORT));
labeledTextField3.setText(LocalSettings.getProperty(LocalSettings.CALCULATOR));
+ auto.setSelected(LocalSettings.getBooleanProperty(LocalSettings.OFFICE_AUTOSTART));
} catch (Exception e) {
Log.Debug(this, e);
}
@@ -415,7 +425,16 @@ private void setSettings() {
LocalSettings.setProperty(LocalSettings.OFFICE_HOST, labeledTextField1.getText());
LocalSettings.setProperty(LocalSettings.OFFICE_PORT, labeledTextField2.getText());
LocalSettings.setProperty(LocalSettings.CALCULATOR, labeledTextField3.getText());
+ LocalSettings.setProperty(LocalSettings.OFFICE_AUTOSTART, String.valueOf(auto.isSelected()));
checkOS();
+
+ if(jCheckBox2.isSelected()){
+ //turn off autostart if local server
+ LocalSettings.setProperty(LocalSettings.OFFICE_AUTOSTART, "false");
+ LocalSettings.setProperty(LocalSettings.OFFICE_HOST, "127.0.0.1");
+ LocalSettings.setProperty(LocalSettings.OFFICE_PORT, "8100");
+ }
+
LocalSettings.apply();
}
View
4 src/mpv5/ui/dialogs/subcomponents/ControlPanel_Templates.form
@@ -185,8 +185,8 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="jScrollPane4" alignment="0" pref="468" max="32767" attributes="0"/>
- <Component id="jPanel2" alignment="1" pref="468" max="32767" attributes="2"/>
+ <Component id="jScrollPane4" alignment="0" pref="477" max="32767" attributes="0"/>
+ <Component id="jPanel2" alignment="1" pref="477" max="32767" attributes="2"/>
</Group>
</DimensionLayout>
</Layout>
View
886 src/mpv5/ui/dialogs/subcomponents/ControlPanel_Templates.java
@@ -69,29 +69,29 @@
*/
public final class ControlPanel_Templates extends javax.swing.JPanel implements ControlApplet, DataPanel {
- private static final long serialVersionUID = 1L;
- /**
- * This unique name identifies this control applet
- */
- public final String UNAME = "templates";
- private Template dataOwner;
- private File lastImportedFile;
- private long lastmodified;
-
- public ControlPanel_Templates() {
- if (MPSecurityManager.checkAdminAccess()) {
- initComponents();
- type.getComboBox().setModel(new MPComboboxModel(MPComboBoxModelItem.toItems(TemplateHandler.getTypes())));
- refresh();
- groupname.setModel(new DefaultComboBoxModel(
- MPComboBoxModelItem.toItems(new DatabaseSearch(Context.getGroup()).getValuesFor(Context.getGroup().getSubID()))));
- java.util.ResourceBundle bundle1 = mpv5.i18n.LanguageManager.getBundle();
- format.setText(Template.DEFAULT_FORMAT);
- format.getTextField().setEditable(true);
- format.getTextField().setToolTipText(bundle1.getString("ControlPanel_Templates.format.toolTipText_1")); // NOI18N
- setVisible(true);
- }
- }
+ private static final long serialVersionUID = 1L;
+ /**
+ * This unique name identifies this control applet
+ */
+ public final String UNAME = "templates";
+ private Template dataOwner;
+ private File lastImportedFile;
+ private long lastmodified;
+
+ public ControlPanel_Templates() {
+ if (MPSecurityManager.checkAdminAccess()) {
+ initComponents();
+ type.getComboBox().setModel(new MPComboboxModel(MPComboBoxModelItem.toItems(TemplateHandler.getTypes())));
+ refresh();
+ groupname.setModel(new DefaultComboBoxModel(
+ MPComboBoxModelItem.toItems(new DatabaseSearch(Context.getGroup()).getValuesFor(Context.getGroup().getSubID()))));
+ java.util.ResourceBundle bundle1 = mpv5.i18n.LanguageManager.getBundle();
+ format.setText(Template.DEFAULT_FORMAT);
+ format.getTextField().setEditable(true);
+ format.getTextField().setToolTipText(bundle1.getString("ControlPanel_Templates.format.toolTipText_1")); // NOI18N
+ setVisible(true);
+ }
+ }
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@@ -440,226 +440,226 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
}// </editor-fold>//GEN-END:initComponents
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
- reset();
+ reset();
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
- if (dataOwner != null) {
- DatabaseObject dato = dataOwner;
- dato.getPanelData(this);
- if (dato.save()) {
- actionAfterSave();
- refresh();
+ if (dataOwner != null) {
+ DatabaseObject dato = dataOwner;
+ dato.getPanelData(this);
+ if (dato.save()) {
+ actionAfterSave();
+ refresh();
// TemplateHandler.cacheTemplates();
- } else {
- showRequiredFields();
- }
- }
+ } else {
+ showRequiredFields();
+ }
+ }
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
- if (dataOwner != null && dataOwner.isExisting()) {
- if (Popup.Y_N_dialog(Messages.REALLY_DELETE)) {
-
- TemplateHandler.clearCache();
- DatabaseObject dato = dataOwner;
- dato.getPanelData(this);
- dato.delete();
-
- try {
- Thread.sleep(333);
- } catch (InterruptedException ex) {
- }
- refresh();
- }
- }
+ if (dataOwner != null && dataOwner.isExisting()) {
+ if (Popup.Y_N_dialog(Messages.REALLY_DELETE)) {
+
+ TemplateHandler.clearCache();
+ DatabaseObject dato = dataOwner;
+ dato.getPanelData(this);
+ dato.delete();
+
+ try {
+ Thread.sleep(333);
+ } catch (InterruptedException ex) {
+ }
+ refresh();
+ }
+ }
}//GEN-LAST:event_jButton4ActionPerformed
private void templatesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_templatesMouseClicked
- try {
- setDataOwner((DatabaseObject) templates.getValueAt(templates.convertRowIndexToModel(templates.getSelectedRow()), 0), true);
- if (!pathtofile_.equals("")) {
- updateService.setEnabled(true);
- }
- } catch (Exception e) {
- Log.Debug(this, e.getMessage());
- }
+ try {
+ setDataOwner((DatabaseObject) templates.getValueAt(templates.convertRowIndexToModel(templates.getSelectedRow()), 0), true);
+ if (!pathtofile_.equals("")) {
+ updateService.setEnabled(true);
+ }
+ } catch (Exception e) {
+ Log.Debug(this, e.getMessage());
+ }
}//GEN-LAST:event_templatesMouseClicked
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
- try {
- DatabaseObject t = Search2.showSearchFor(Context.getItem());
- if (t != null) {
- List<String[]> vars = VariablesHandler.resolveVarsFor(t);
- List<List<String>> varsl = new ArrayList<List<String>>();
- for (int i = 0; i < vars.size(); i++) {
- String[] strings = vars.get(i);
- varsl.add(Arrays.asList(strings));
- }
- Popup.notice(varsl, Messages.VARIABLES + "\n\n" + t.toString());
- }
- } catch (Exception ex) {
- Log.Debug(ex);
- }
+ try {
+ DatabaseObject t = Search2.showSearchFor(Context.getItem());
+ if (t != null) {
+ List<String[]> vars = VariablesHandler.resolveVarsFor(t);
+ List<List<String>> varsl = new ArrayList<List<String>>();
+ for (int i = 0; i < vars.size(); i++) {
+ String[] strings = vars.get(i);
+ varsl.add(Arrays.asList(strings));
+ }
+ Popup.notice(varsl, Messages.VARIABLES + "\n\n" + t.toString());
+ }
+ } catch (Exception ex) {
+ Log.Debug(ex);
+ }
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
- test();
+ test();
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
- DialogForFile di = new DialogForFile(DialogForFile.FILES_ONLY);
- di.setFileFilter(DialogForFile.TEMPLATE_FILES);
-
- if (di.chooseFile()) {
- Template t = new Template();
- File fi = di.getFile();
- if (QueryHandler.instanceOf().clone(Context.getFiles(), this).insertFile(fi, t, new SaveString(fi.getName(), true))) {
- Popup.notice(Messages.ASSIGN_TEMPLATE);
- configureUpdateService(fi);
- }
- }
+ DialogForFile di = new DialogForFile(DialogForFile.FILES_ONLY);
+ di.setFileFilter(DialogForFile.TEMPLATE_FILES);
+
+ if (di.chooseFile()) {
+ Template t = new Template();
+ File fi = di.getFile();
+ if (QueryHandler.instanceOf().clone(Context.getFiles(), this).insertFile(fi, t, new SaveString(fi.getName(), true))) {
+ Popup.notice(Messages.ASSIGN_TEMPLATE);
+ configureUpdateService(fi);
+ }
+ }
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
- BigPopup.showPopup(this, TemplateFormatEditor.instanceOf(format.getTextField()), "", true);
+ BigPopup.showPopup(this, TemplateFormatEditor.instanceOf(format.getTextField()), "", true);
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
- if (dataOwner != null && dataOwner.isExisting()) {
- try {
- mpv5.YabsViewProxy.instance().showFilesaveDialogFor(dataOwner.getFile());
+ if (dataOwner != null && dataOwner.isExisting()) {
+ try {
+ mpv5.YabsViewProxy.instance().showFilesaveDialogFor(dataOwner.getFile());
- DialogForFile d = mpv5.YabsViewProxy.instance().getFiledialog();
- File nFile = d.saveFile(dataOwner.getFile());
- if (nFile != null) {
- configureUpdateService(nFile);
- updateService.setSelected(true);
- }
- } catch (Exception e) {
- Log.Debug(e);
- }
- }
+ DialogForFile d = mpv5.YabsViewProxy.instance().getFiledialog();
+ File nFile = d.saveFile(dataOwner.getFile());
+ if (nFile != null) {
+ configureUpdateService(nFile);
+ updateService.setSelected(true);
+ }
+ } catch (Exception e) {
+ Log.Debug(e);
+ }
+ }
}//GEN-LAST:event_jButton9ActionPerformed
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
- if (dataOwner != null && dataOwner.isExisting()) {
- Template tpl = (Template) templates.getValueAt(templates.convertRowIndexToModel(templates.getSelectedRow()), 0);
- if (Popup.Y_N_dialog(Messages.REALLY_CHANGE.toString(), tpl.__getCname())) {
- DialogForFile di = new DialogForFile(DialogForFile.FILES_ONLY);
- di.setFileFilter(DialogForFile.TEMPLATE_FILES);
- if (di.chooseFile()) {
- File fi = di.getFile();
- QueryHandler.instanceOf().clone(Context.getFiles(), this).updateFile(fi, tpl.__getFilename());
- tpl.setDescription(tpl.__getDescription() + "\n - Updated: " + new Date());
- tpl.save(true);
- TemplateHandler.clearCache();
-
- try {
- Thread.sleep(333);
- } catch (InterruptedException ex) {
- }
- refresh();
- lastImportedFile = fi;
- updateService.setEnabled(true);
- try {
- pathtofile.setText(fi.getCanonicalPath().toString());
- } catch (IOException ex) {
- Log.Debug(this, ex);
- }
- lastmodified = fi.lastModified();
- }
- }
- }
- }//GEN-LAST:event_jButton10ActionPerformed
-
- private void updateServiceItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_updateServiceItemStateChanged
-
- final DataPanel x = this;
- final Template tpl = dataOwner;
- FileMonitor.FileChangeListener filecl = new FileMonitor.FileChangeListener() {
- public void fileChanged(String fileName) {
- QueryHandler.instanceOf().clone(Context.getFiles(), x).updateFile(new File(fileName), tpl.__getFilename());
+ if (dataOwner != null && dataOwner.isExisting()) {
+ Template tpl = (Template) templates.getValueAt(templates.convertRowIndexToModel(templates.getSelectedRow()), 0);
+ if (Popup.Y_N_dialog(Messages.REALLY_CHANGE.toString(), tpl.__getCname())) {
+ DialogForFile di = new DialogForFile(DialogForFile.FILES_ONLY);
+ di.setFileFilter(DialogForFile.TEMPLATE_FILES);
+ if (di.chooseFile()) {
+ File fi = di.getFile();
+ QueryHandler.instanceOf().clone(Context.getFiles(), this).updateFile(fi, tpl.__getFilename());
tpl.setDescription(tpl.__getDescription() + "\n - Updated: " + new Date());
tpl.save(true);
TemplateHandler.clearCache();
try {
- Thread.sleep(333);
+ Thread.sleep(333);
} catch (InterruptedException ex) {
}
refresh();
- }
- };
+ lastImportedFile = fi;
+ updateService.setEnabled(true);
+ try {
+ pathtofile.setText(fi.getCanonicalPath().toString());
+ } catch (IOException ex) {
+ Log.Debug(this, ex);
+ }
+ lastmodified = fi.lastModified();
+ }
+ }
+ }
+ }//GEN-LAST:event_jButton10ActionPerformed
- String file = null;
- if (lastImportedFile != null) {
- try {
- file = lastImportedFile.getCanonicalPath();
- } catch (IOException ex) {
- Log.Debug(ex);
- }
- } else if (!pathtofile.getText().equals("") && new File(pathtofile.getText()).canRead()) {
- file = pathtofile.getText();
- }
- if (updateService.isSelected() && file != null) {
- FileMonitor.getInstance().addFileChangeListener(filecl, file, 1000l);
- } else {
- FileMonitor.getInstance().removeFileChangeListener(filecl, file);
- }
- lastImportedFile = null;
+ private void updateServiceItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_updateServiceItemStateChanged
+
+ final DataPanel x = this;
+ final Template tpl = dataOwner;
+ FileMonitor.FileChangeListener filecl = new FileMonitor.FileChangeListener() {
+ public void fileChanged(String fileName) {
+ QueryHandler.instanceOf().clone(Context.getFiles(), x).updateFile(new File(fileName), tpl.__getFilename());
+ tpl.setDescription(tpl.__getDescription() + "\n - Updated: " + new Date());
+ tpl.save(true);
+ TemplateHandler.clearCache();
+
+ try {
+ Thread.sleep(333);
+ } catch (InterruptedException ex) {
+ }
+ refresh();
+ }
+ };
+
+ String file = null;
+ if (lastImportedFile != null) {
+ try {
+ file = lastImportedFile.getCanonicalPath();
+ } catch (IOException ex) {
+ Log.Debug(ex);
+ }
+ } else if (!pathtofile.getText().equals("") && new File(pathtofile.getText()).canRead()) {
+ file = pathtofile.getText();
+ }
+ if (updateService.isSelected() && file != null) {
+ FileMonitor.getInstance().addFileChangeListener(filecl, file, 1000l);
+ } else {
+ FileMonitor.getInstance().removeFileChangeListener(filecl, file);
+ }
+ lastImportedFile = null;
}//GEN-LAST:event_updateServiceItemStateChanged
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
- if (dataOwner != null && dataOwner.isExisting()) {
- try {
+ if (dataOwner != null && dataOwner.isExisting()) {
+ try {
// LOAPanel lp = new LOAPanel();
// File f = dataOwner.getFile();
// YabsViewProxy.instance().addOrShowTab(lp, dataOwner.__getCname());
// lp.loadODT(f);
- updateService.setSelected(false);
- updateService.setSelected(true);
- if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
- Desktop.getDesktop().open(dataOwner.getFile());
- } else if (LocalSettings.getBooleanProperty(LocalSettings.OFFICE_USE)) {
- FileExecutor.run(LocalSettings.getProperty(LocalSettings.OFFICE_HOME) + File.separator + dataOwner.getFile().getPath());
- }
- } catch (Exception e) {
- Log.Debug(e);
- }
- }
+ updateService.setSelected(false);
+ updateService.setSelected(true);
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
+ Desktop.getDesktop().open(dataOwner.getFile());
+ } else if (LocalSettings.getBooleanProperty(LocalSettings.OFFICE_USE)) {
+ FileExecutor.run(LocalSettings.getProperty(LocalSettings.OFFICE_HOME) + File.separator + dataOwner.getFile().getPath());
+ }
+ } catch (Exception e) {
+ Log.Debug(e);
+ }
+ }
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
- PrintService[] services3 = PrintServiceLookup.lookupPrintServices(null, null);
- List<String> l = new ArrayList<String>();
- for (int i = 0; i < services3.length; i++) {
- PrintService printService = services3[i];
- l.add(printService.getName());
- }
- Popup.notice(l, Messages.PRINTER_NAMES);
+ PrintService[] services3 = PrintServiceLookup.lookupPrintServices(null, null);
+ List<String> l = new ArrayList<String>();
+ for (int i = 0; i < services3.length; i++) {
+ PrintService printService = services3[i];
+ l.add(printService.getName());
+ }
+ Popup.notice(l, Messages.PRINTER_NAMES);
}//GEN-LAST:event_jButton11ActionPerformed
- public void setValues(PropertyStore values) {
- }
+ public void setValues(PropertyStore values) {
+ }
- public String getUname() {
- return UNAME;
- }
+ public String getUname() {
+ return UNAME;
+ }
- public void reset() {
- if (dataOwner != null) {
- DatabaseObject dato = dataOwner;
+ public void reset() {
+ if (dataOwner != null) {
+ DatabaseObject dato = dataOwner;
- dato.getPanelData(this);
- dato.reset();
- setDataOwner(dato, true);
- }
- }
+ dato.getPanelData(this);
+ dato.reset();
+ setDataOwner(dato, true);
+ }
+ }
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextArea descr;
private mpv5.ui.beans.LabeledTextField format;
@@ -695,125 +695,125 @@ public void reset() {
private mpv5.ui.beans.LabeledCombobox type;
private javax.swing.JCheckBox updateService;
// End of variables declaration//GEN-END:variables
- public String description_ = "";
- public String filename_ = "";
- public String cname_;
- public String format_;
- public int intsize_;
- public String mimetype_;
- public int intaddedby_ = 4343;
- public int ids_;
- public int groupsids_;
- public int compsids_;
- public String printer_;
- public java.util.Date dateadded_ = new java.util.Date();
- public boolean isupdateenabled_ = false;
- public String pathtofile_ = "";
- public long lastmodified_;
-
- public boolean collectData() {
- if (groupname.getSelectedItem() != null) {
- groupsids_ = Integer.valueOf(((MPComboBoxModelItem) groupname.getSelectedItem()).getId());
- } else {
- groupsids_ = 1;
- }
-
- description_ = descr.getText();
- cname_ = fullname.getText();
- mimetype_ = String.valueOf(type.getSelectedItem().getId());
- format_ = format.getText();
- printer_ = printern.getText();
- pathtofile_ = pathtofile.getText();
- lastmodified_ = lastmodified;
- isupdateenabled_ = updateService.isSelected();
-
- return true;
- }
-
- public void exposeData() {
-
- try {
- groupname.setSelectedIndex(MPComboBoxModelItem.getItemID(String.valueOf(groupsids_), groupname.getModel()));
- fullname.setText(cname_);
- descr.setText(description_);
- try {
- type.setSelectedItem(Integer.valueOf(mimetype_));
- } catch (NumberFormatException numberFormatException) {
- }
- format.setText(format_);
- printern.setText(printer_);
-
- DefaultListModel m = new DefaultListModel();
- ArrayList<DatabaseObject> li = DatabaseObject.getObjects(Context.getUser());
-
- QueryCriteria c = new QueryCriteria("templatesids", dataOwner.__getIDS());
- Object[][] data = QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).select("usersids", c);
-
- List<Integer> l = new ArrayList<Integer>();
- for (int i = 0; i < li.size(); i++) {
- User databaseObject = (User) li.get(i);
-
- for (int j = 0; j < data.length; j++) {
- int id = Integer.valueOf(data[j][0].toString());
- if (id == databaseObject.__getIDS().intValue()) {
- l.add(Integer.valueOf(i));
- }
- }
- m.addElement(databaseObject);
- }
-
- jList1.setModel(m);
-
- int[] ix = new int[l.size()];
- for (int i = 0; i < l.size(); i++) {
- Integer integer = l.get(i);
- ix[i] = integer.intValue();
- }
-
- jList1.setSelectedIndices(ix);
- pathtofile.setText(dataOwner.getFile().getPath());
- lastImportedFile = null;
- lastmodified = lastmodified_;
- updateService.setSelected(isupdateenabled_);
-
- } catch (Exception e) {
- Log.Debug(this, e);
- if (Popup.Y_N_dialog("There was a problem loading the template, delete?")) {
- dataOwner.delete();
- }
- }
- }
-
- public DatabaseObject getDataOwner() {
- return dataOwner;
- }
-
- public void setDataOwner(DatabaseObject object, boolean p) {
- dataOwner = (Template) object;
- if (p) {
- dataOwner.setPanelData(this);
- this.exposeData();
- }
- }
-
- public void refresh() {
-
- ArrayList<DatabaseObject> temps;
- try {
- temps = DatabaseObject.getObjects(Context.getTemplate());
- Object[][] data = new Object[temps.size()][3];
-
- for (int i = 0; i < temps.size(); i++) {
- Template t = (Template) temps.get(i);
- data[i][0] = t;
- data[i][1] = t.__getMimetype();
- data[i][2] = Group.getObject(Context.getGroup(), t.__getGroupsids());
- }
-
- templates.setModel(new MPTableModel(data, Headers.TEMPLATES.getValue()));
- } catch (NodataFoundException ex) {
- Log.Debug(this, ex.getMessage());
- }
+ public String description_ = "";
+ public String filename_ = "";
+ public String cname_;
+ public String format_;
+ public int intsize_;
+ public String mimetype_;
+ public int intaddedby_ = 4343;
+ public int ids_;
+ public int groupsids_;
+ public int compsids_;
+ public String printer_;
+ public java.util.Date dateadded_ = new java.util.Date();
+ public boolean isupdateenabled_ = false;
+ public String pathtofile_ = "";
+ public long lastmodified_;
+
+ public boolean collectData() {
+ if (groupname.getSelectedItem() != null) {
+ groupsids_ = Integer.valueOf(((MPComboBoxModelItem) groupname.getSelectedItem()).getId());
+ } else {
+ groupsids_ = 1;
+ }
+
+ description_ = descr.getText();
+ cname_ = fullname.getText();
+ mimetype_ = String.valueOf(type.getSelectedItem().getId());
+ format_ = format.getText();
+ printer_ = printern.getText();
+ pathtofile_ = pathtofile.getText();
+ lastmodified_ = lastmodified;
+ isupdateenabled_ = updateService.isSelected();
+
+ return true;
+ }
+
+ public void exposeData() {
+
+ try {
+ groupname.setSelectedIndex(MPComboBoxModelItem.getItemID(String.valueOf(groupsids_), groupname.getModel()));
+ fullname.setText(cname_);
+ descr.setText(description_);
+ try {
+ type.setSelectedItem(Integer.valueOf(mimetype_));
+ } catch (NumberFormatException numberFormatException) {
+ }
+ format.setText(format_);
+ printern.setText(printer_);
+
+ DefaultListModel m = new DefaultListModel();
+ ArrayList<DatabaseObject> li = DatabaseObject.getObjects(Context.getUser());
+
+ QueryCriteria c = new QueryCriteria("templatesids", dataOwner.__getIDS());
+ Object[][] data = QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).select("usersids", c);
+
+ List<Integer> l = new ArrayList<Integer>();
+ for (int i = 0; i < li.size(); i++) {
+ User databaseObject = (User) li.get(i);
+
+ for (int j = 0; j < data.length; j++) {
+ int id = Integer.valueOf(data[j][0].toString());
+ if (id == databaseObject.__getIDS().intValue()) {
+ l.add(Integer.valueOf(i));
+ }
+ }
+ m.addElement(databaseObject);
+ }
+
+ jList1.setModel(m);
+
+ int[] ix = new int[l.size()];
+ for (int i = 0; i < l.size(); i++) {
+ Integer integer = l.get(i);
+ ix[i] = integer.intValue();
+ }
+
+ jList1.setSelectedIndices(ix);
+ pathtofile.setText(dataOwner.getFile().getPath());
+ lastImportedFile = null;
+ lastmodified = lastmodified_;
+ updateService.setSelected(isupdateenabled_);
+
+ } catch (Exception e) {
+ Log.Debug(this, e);
+ if (Popup.Y_N_dialog("There was a problem loading the template, delete?")) {
+ dataOwner.delete();
+ }
+ }
+ }
+
+ public DatabaseObject getDataOwner() {
+ return dataOwner;
+ }
+
+ public void setDataOwner(DatabaseObject object, boolean p) {
+ dataOwner = (Template) object;
+ if (p) {
+ dataOwner.setPanelData(this);
+ this.exposeData();
+ }
+ }
+
+ public void refresh() {
+
+ ArrayList<DatabaseObject> temps;
+ try {
+ temps = DatabaseObject.getObjects(Context.getTemplate());
+ Object[][] data = new Object[temps.size()][3];
+
+ for (int i = 0; i < temps.size(); i++) {
+ Template t = (Template) temps.get(i);
+ data[i][0] = t;
+ data[i][1] = t.__getMimetype();
+ data[i][2] = Group.getObject(Context.getGroup(), t.__getGroupsids());
+ }
+
+ templates.setModel(new MPTableModel(data, Headers.TEMPLATES.getValue()));
+ } catch (NodataFoundException ex) {
+ Log.Debug(this, ex.getMessage());
+ }
// Context c1 = Context.getTemplatesToUsers();
// c1.addReference(Context.getGroup());
// c1.addReference(Context.getTemplate());
@@ -827,155 +827,155 @@ public void refresh() {
// TableFormat.format(jTable1, 5, 80);
// TableFormat.format(jTable1, 6, 150);
- }
-
- public void paste(DatabaseObject... dbos) {
- for (DatabaseObject dbo : dbos) {
- if (dbo.getContext().equals(Context.getTemplate())) {
- setDataOwner(dbo, true);
- } else {
- mpv5.YabsViewProxy.instance().addMessage(Messages.NOT_POSSIBLE.toString() + Messages.ACTION_PASTE, Color.RED);
- }
- }
- }
-
- public void showRequiredFields() {
- TextFieldUtils.blinkerRed(fullname);
- }
-
- public void showSearchBar(boolean show) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- public Component getAndRemoveActionPanel() {
- this.remove(jPanel6);
- validate();
- return jPanel6;
- }
-
- @Override
- public void actionAfterSave() {
- Object[] selectedValues = jList1.getSelectedValues();
- Integer groups;
- if (groupname.getSelectedItem() != null) {
- groups = Integer.valueOf(((MPComboBoxModelItem) groupname.getSelectedItem()).getId());
- } else {
- groups = 1;
- }
-
- Object[][] UtT = new Object[0][0];
- QueryCriteria d = new QueryCriteria("templatesids", dataOwner.__getIDS());
- try {
- UtT = QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).select(d).getData();
- } catch (NodataFoundException ex) {
- Log.Debug(this, ex.getMessage());
- }
- for (int i = 0; i < selectedValues.length; i++) {
- User object = (User) selectedValues[i];
- boolean found = false;
-
- for (int j = 0; j < UtT.length; j++) {
- if (Integer.parseInt(UtT[j][2].toString()) == object.__getIDS()) {
- found = true;
- UtT[j][1] = "found";
- break;
- }
- }
+ }
+
+ public void paste(DatabaseObject... dbos) {
+ for (DatabaseObject dbo : dbos) {
+ if (dbo.getContext().equals(Context.getTemplate())) {
+ setDataOwner(dbo, true);
+ } else {
+ mpv5.YabsViewProxy.instance().addMessage(Messages.NOT_POSSIBLE.toString() + Messages.ACTION_PASTE, Color.RED);
+ }
+ }
+ }
+
+ public void showRequiredFields() {
+ TextFieldUtils.blinkerRed(fullname);
+ }
+
+ public void showSearchBar(boolean show) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public Component getAndRemoveActionPanel() {
+ this.remove(jPanel6);
+ validate();
+ return jPanel6;
+ }
+
+ @Override
+ public void actionAfterSave() {
+ Object[] selectedValues = jList1.getSelectedValues();
+ Integer groups;
+ if (groupname.getSelectedItem() != null) {
+ groups = Integer.valueOf(((MPComboBoxModelItem) groupname.getSelectedItem()).getId());
+ } else {
+ groups = 1;
+ }
+
+ Object[][] UtT = new Object[0][0];
+ QueryCriteria d = new QueryCriteria("templatesids", dataOwner.__getIDS());
+ try {
+ UtT = QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).select(d).getData();
+ } catch (NodataFoundException ex) {
+ Log.Debug(this, ex.getMessage());
+ }
+ for (int i = 0; i < selectedValues.length; i++) {
+ User object = (User) selectedValues[i];
+ boolean found = false;
+
+ for (int j = 0; j < UtT.length; j++) {
+ if (Integer.parseInt(UtT[j][2].toString()) == object.__getIDS()) {
+ found = true;
+ UtT[j][1] = "found";
+ break;
+ }
+ }
+
+ if (!found) {
+ QueryData c = new QueryData();
+ c.add("usersids", object.__getIDS());
+ c.add("templatesids", dataOwner.__getIDS());
+ c.add("groupsids", groups.intValue());
+ c.add("cname", dataOwner.__getIDS() + "@" + object.__getIDS() + "@" + groups);
+ QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).insert(c, null);
+ }
+ }
+
+ for (int j = 0; j < UtT.length; j++) {
+ if (!UtT[j][1].equals("found")) {
+ QueryCriteria d2 = new QueryCriteria("cname", UtT[j][1].toString());
+ QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).delete(d2);
+ }
+ }
+
+ TemplateHandler.clearCache();
+ }
+
+ @Override
+ public void actionAfterCreate() {
+ }
+
+ private void test() {
+ DatabaseObject t;
+ if (dataOwner != null) {
+ t = Search2.showSearchFor(Context.getItem());
+ if (t == null) {
+ try {
+ t = DatabaseObject.getObject(Context.getItem(), 1);
+ } catch (NodataFoundException ex) {
+ t = new Item();
+ Contact k = new Contact();
+ k.avoidNulls();
+ k.fillSampleData();
+ t.avoidNulls();
+ t.fillSampleData();
+ ((Item) t).setContactsids(k.__getIDS());
+ }
+ }
+
+ try {
+ HashMap<String, Object> hm1 = new FormFieldsHandler(t).getFormattedFormFields(null);
+// Log.Print(hm1.entrySet().toArray());
+ File f = dataOwner.getFile();
+ File f2 = FileDirectoryHandler.getTempFile("pdf");
+ Export ex = new Export(dataOwner);
+ ex.putAll(hm1);
- if (!found) {
- QueryData c = new QueryData();
- c.add("usersids", object.__getIDS());
- c.add("templatesids", dataOwner.__getIDS());
- c.add("groupsids", groups.intValue());
- c.add("cname", dataOwner.__getIDS() + "@" + object.__getIDS() + "@" + groups);
- QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).insert(c, null);
- }
- }
+ ArrayList<String[]> l = new ArrayList<String[]>();
- for (int j = 0; j < UtT.length; j++) {
- if (!UtT[j][1].equals("found")) {
- QueryCriteria d2 = new QueryCriteria("cname", UtT[j][1].toString());
- QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).delete(d2);
+ for (int i = 0; i < 20; i++) {
+ l.add(SubItem.getRandomItem().toStringArray());
}
- }
- TemplateHandler.clearCache();
- }
+ ex.put(TableHandler.KEY_TABLE + "1", l);
- @Override
- public void actionAfterCreate() {
- }
-
- private void test() {
- DatabaseObject t;
- if (dataOwner != null) {
- t = Search2.showSearchFor(Context.getItem());
- if (t == null) {
- try {
- t = DatabaseObject.getObject(Context.getItem(), 1);
- } catch (NodataFoundException ex) {
- t = new Item();
- Contact k = new Contact();
- k.avoidNulls();
- k.fillSampleData();
- t.avoidNulls();
- t.fillSampleData();
- ((Item) t).setContactsids(k.__getIDS());
- }
+ if (f.getName().endsWith("pdf")) {
+ ex.setTemplate(new PDFFile(f.getPath()));
+ } else {
+ ex.setTemplate(new ODTFile(f.getPath()));
}
- try {
- HashMap<String, Object> hm1 = new FormFieldsHandler(t).getFormattedFormFields(null);
-// Log.Print(hm1.entrySet().toArray());
- File f = dataOwner.getFile();
- File f2 = FileDirectoryHandler.getTempFile("pdf");
- Export ex = new Export(dataOwner);
- ex.putAll(hm1);
+ ex.setTargetFile(f2);
- ArrayList<String[]> l = new ArrayList<String[]>();
+ new Job(ex, new PreviewPanel()).execute();
+ } catch (Exception ex1) {
+ Log.Debug(ex1);
+ Popup.error(ex1);
+ }
+ }
+ }
- for (int i = 0; i < 20; i++) {
- l.add(SubItem.getRandomItem().toStringArray());
- }
+ public void actionBeforeCreate() {
+ }
- ex.put(TableHandler.KEY_TABLE + "1", l);
+ public void actionBeforeSave() {
+ }
- if (f.getName().endsWith("odt")) {
- ex.setTemplate(new ODTFile(f.getPath()));
- } else {
- ex.setTemplate(new PDFFile(f.getPath()));
- }
+ public void mail() {
+ }
- ex.setTargetFile(f2);
+ public void print() {
+ }
- new Job(ex, new PreviewPanel()).execute();
- } catch (Exception ex1) {
- Log.Debug(ex1);
- Popup.error(ex1);
- }
- }
- }
-
- public void actionBeforeCreate() {
- }
-
- public void actionBeforeSave() {
- }
-
- public void mail() {
- }
-
- public void print() {
- }
-
- private void configureUpdateService(File fi) {
- lastImportedFile = fi;
- updateService.setEnabled(true);
- try {
- pathtofile.setText(fi.getCanonicalPath().toString());
- } catch (IOException ex) {
- Log.Debug(this, ex);
- }
- lastmodified = fi.lastModified();
- }
+ private void configureUpdateService(File fi) {
+ lastImportedFile = fi;
+ updateService.setEnabled(true);
+ try {
+ pathtofile.setText(fi.getCanonicalPath().toString());
+ } catch (IOException ex) {
+ Log.Debug(this, ex);
+ }
+ lastmodified = fi.lastModified();
+ }
}
View
105 src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings1.form
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.6" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+ <Properties>
+ <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="ff" green="ff" red="ff" type="rgb"/>
+ </Property>
+ <Property name="name" type="java.lang.String" value="Form" noResource="true"/>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_formBundle" type="java.lang.String" value="mpv5/resources/languages/Panels"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-35,0,0,1,-43"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Properties>
+ <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="ff" green="ff" red="ff" type="rgb"/>
+ </Property>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="Yabs Installation - Wizard">
+ <ResourceString PropertyName="titleX" bundle="mpv5/resources/languages/Panels.properties" key="wizard_FirstSettings1.jPanel1.border.title" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
+ </TitledBorder>
+ </Border>
+ </Property>
+ <Property name="name" type="java.lang.String" value="jPanel1" noResource="true"/>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="3" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel2">