Added i18n lib and added paging on mongo and meta backends.
This commit is contained in:
parent
fe5842768f
commit
efcbdbd519
45 changed files with 1767 additions and 28 deletions
|
|
@ -30,7 +30,7 @@
|
|||
<groupId>net.forwardfire.vasc.demo</groupId>
|
||||
<artifactId>vasc-demo-tech-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<!-- <type>war</type> -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
|
|
@ -67,6 +67,16 @@
|
|||
<artifactId>vasc-backend-jdbc</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.test</groupId>
|
||||
<artifactId>vasc-test-i18n</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jdesktop.bsaf</groupId>
|
||||
<artifactId>bsaf</artifactId>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ public class TechUI extends SingleFrameApplication {
|
|||
|
||||
static public void main(String[] args) {
|
||||
Application.launch(TechUI.class, args);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,6 +27,17 @@ import java.awt.Dimension;
|
|||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JPanel;
|
||||
|
|
@ -47,6 +58,8 @@ import net.forwardfire.vasc.demo.tech.ui.VascManager;
|
|||
import net.forwardfire.vasc.frontends.swing.SwingPanelIntegration;
|
||||
import net.forwardfire.vasc.frontends.swing.SwingPanelTabbed;
|
||||
import net.forwardfire.vasc.impl.DefaultVascFactory;
|
||||
import net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle_en;
|
||||
import net.forwardfire.vasc.test.i18n.VascBundleCheckEntryKeys;
|
||||
|
||||
public class JMainPanel extends JPanel {
|
||||
|
||||
|
|
@ -123,7 +136,7 @@ public class JMainPanel extends JPanel {
|
|||
if (vascNode != null) {
|
||||
if (vascNode.type == VascTreeNodeType.ENTRY) {
|
||||
VascEntry ee = vascManager.getVascController().getVascEntryController().getVascEntryById(vascNode.id).clone();
|
||||
DefaultVascFactory.fillVascEntryFrontend(ee, vascManager.getVascController(), DefaultVascFactory.getDefaultVascFrontendData(null));
|
||||
DefaultVascFactory.fillVascEntryFrontend(ee, vascManager.getVascController(), DefaultVascFactory.getDefaultVascFrontendData("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle",new Locale("en")));
|
||||
spi.createNewVascView(ee);
|
||||
}
|
||||
}
|
||||
|
|
@ -260,10 +273,85 @@ public class JMainPanel extends JPanel {
|
|||
root.add(entries);
|
||||
|
||||
SwingUtilities.updateComponentTreeUI(vascTree);
|
||||
|
||||
|
||||
// todo move
|
||||
Map<String,String> keys = new HashMap<String,String>(300);
|
||||
VascBundleCheckEntryKeys checker = new VascBundleCheckEntryKeys(ResourceBundle.getBundle("net.forwardfire.vasc.lib.i18n.bundle.RootApplicationBundle"));
|
||||
for (String veId:vascManager.getVascController().getVascEntryController().getVascEntryIds()) {
|
||||
VascEntry ve = vascManager.getVascController().getVascEntryController().getVascEntryById(veId);
|
||||
keys.putAll(checker.generateMissingKeys(ve));
|
||||
}
|
||||
if (keys.isEmpty()==false) {
|
||||
Properties p = new Properties();
|
||||
File dataDir = new File("auto/data");
|
||||
|
||||
if (dataDir.exists()==false) {
|
||||
dataDir.mkdirs();
|
||||
}
|
||||
File resourceFile = new File("auto/data/vasc-bundle.properties");
|
||||
if (resourceFile.exists()) {
|
||||
readPropertiesFile(p,resourceFile);
|
||||
}
|
||||
for (String key:keys.keySet()) {
|
||||
p.put(key, keys.get(key));
|
||||
}
|
||||
writePropertiesFile(p,resourceFile);
|
||||
|
||||
new RootApplicationBundle_en().reload();
|
||||
RootApplicationBundle_en.clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
public JTabbedPane getTabPane() {
|
||||
return tabPane;
|
||||
}
|
||||
|
||||
protected void writePropertiesFile(Properties p,File file) {
|
||||
try {
|
||||
writePropertiesStream(p,new FileOutputStream(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void readPropertiesFile(Properties p,File file) {
|
||||
try {
|
||||
readPropertiesStream(p,new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load resource file error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void writePropertiesStream(Properties p,OutputStream out) {
|
||||
try {
|
||||
p.store(out, "Saved by vasc auto i18n.");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
|
||||
} finally {
|
||||
if (out!=null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void readPropertiesStream(Properties p,InputStream in) {
|
||||
try {
|
||||
p.load(in);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not load properties error: "+e.getMessage(),e);
|
||||
} finally {
|
||||
if (in!=null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
# bundle list to merge and load
|
||||
bundle1.uri=net.forwardfire.vasc.demo.tech.ui.resources.TechUI
|
||||
|
||||
bundle2.uri=auto/data/vasc-bundle.properties
|
||||
bundle2.type=FILE
|
||||
bundle2.optional=true
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue