Skip to content
This repository has been archived by the owner on Feb 20, 2022. It is now read-only.

Commit

Permalink
simplified code
Browse files Browse the repository at this point in the history
  • Loading branch information
anti43 committed Jan 29, 2013
1 parent 0f03630 commit 10c12e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/mpv5/resources/languages/Panels.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ 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_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 installation 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private void initComponents() {
setLayout(new java.awt.BorderLayout());

jPanel1.setBackground(new java.awt.Color(255, 255, 255));
java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle();// NOI18N
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("mpv5/resources/languages/Panels"); // NOI18N
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("wizard_FirstSettings1.jPanel1.border.title"))); // NOI18N
jPanel1.setName("jPanel1"); // NOI18N

Expand Down
49 changes: 13 additions & 36 deletions src/mpv5/ui/dialogs/subcomponents/wizard_FirstSettings4.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import mpv5.db.common.DatabaseObject;
import mpv5.db.common.NodataFoundException;
import mpv5.db.common.QueryCriteria;
import mpv5.db.common.QueryCriteria2;
import mpv5.db.common.QueryData;
import mpv5.db.common.QueryHandler;
import mpv5.db.common.QueryParameter;
import mpv5.db.common.SaveString;
import mpv5.db.objects.Template;
import mpv5.db.objects.User;
Expand All @@ -44,7 +46,6 @@ public class wizard_FirstSettings4 extends javax.swing.JPanel implements Wizarda
private WizardMaster master;
private PropertyStore nactions;
private List<JToolBar> nbars;


public wizard_FirstSettings4(WizardMaster w) {
this.master = w;
Expand Down Expand Up @@ -139,14 +140,13 @@ public boolean next() {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
YabsViewProxy.instance().setWaiting(false);
}
}else{

} else {
}
try {
File template = new File(Main.class.getResource("/mpv5/resources/extra/invoice_de.odt").toURI());
if (template != null) {
String m = String.valueOf(new Date().getTime());

Template t = new Template();
File fi = template;
if (QueryHandler.instanceOf().clone(Context.getFiles(), this).insertFile(fi, t, new SaveString(fi.getName() + m, true))) {
Expand All @@ -157,7 +157,7 @@ public boolean next() {
Logger.getLogger(wizard_FirstSettings4.class.getName()).log(Level.SEVERE, null, ex);
}


return true;
}

Expand All @@ -167,45 +167,22 @@ public void refresh() {
int id = Integer.valueOf(xx.freeQuery(
"select ids from templates order by dateadded desc ", MPSecurityManager.VIEW, null).getFirstEntry().toString());
Template t = (Template) DatabaseObject.getObject(Context.getTemplate(), id);

t.setGroupsids(1);
t.setCname("Invoice_DE_from_wizard.odt" );
t.setCname("Invoice_DE_from_wizard.odt");
t.setMimetype(String.valueOf(Constants.TYPE_BILL));
t.setFormat("1,2,4,5,6");
t.setDescription("Wizard insert");
t.save(true);
Object[][] UtT = new Object[0][0];
QueryCriteria d = new QueryCriteria("templatesids", t.__getIDS());
try {
UtT = QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).select(d).getData();
} catch (NodataFoundException ex) {
Log.Debug(this, ex.getMessage());
}

User object = User.getCurrentUser();
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;
}
}
QueryData c = new QueryData();
c.add("usersids", object.__getIDS());
c.add("templatesids", t.__getIDS());
c.add("groupsids", 1);
c.add("cname", t.__getIDS() + "@" + object.__getIDS() + "@" + 1);
QueryHandler.instanceOf().clone(Context.getTemplatesToUsers()).insert(c, null);

if (!found) {
QueryData c = new QueryData();
c.add("usersids", object.__getIDS());
c.add("templatesids", t.__getIDS());
c.add("groupsids", 1);
c.add("cname", t.__getIDS() + "@" + object.__getIDS() + "@" + 1);
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();
} catch (Exception ex) {
Logger.getLogger(wizard_FirstSettings4.class.getName()).log(Level.SEVERE, null, ex);
Expand Down

0 comments on commit 10c12e0

Please sign in to comment.