Skip to content
Permalink
Browse files

First pass at creating UI for localization

Most of the periphrial UI components are in place, but a few minor
things still need doing.
  • Loading branch information...
LadyCailin committed Aug 6, 2019
1 parent baae127 commit 44351ec862853156ed23eb22f70f5b3d063097eb
@@ -15,5 +15,8 @@
<!-- Ignore type name check for package "com.laytonsmith.core.events drivers" since event driver classes use a different format -->
<suppress checks="TypeName" files="com[\\/]laytonsmith[\\/]core[\\/]events[\\/]drivers.*\.java$"/>

<!-- It's too difficult to manage checkstyle for half generated files, so just exclude them. -->
<suppress checks=".*" files="com[\\/]laytonsmith[\\/]tools[\\/]docgen[\\/]localization[\\/]LocalizationUI.java$"/>


</suppressions>
@@ -17,4 +17,11 @@
public AbstractCommandLineTool() {
}

@Override
public boolean noExitOnReturn() {
return false;
}



}
@@ -25,4 +25,12 @@
*/
void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception;

/**
* Whether or not to call System.exit(0) when the program completes. If this returns true, then the tool is
* expected to clean up, System.exit will not be called. False (which is the default for
* {@link AbstractCommandLineTool} causes it to exit on completion.
* @return
*/
boolean noExitOnReturn();

}
@@ -799,8 +799,11 @@ public static void main(String[] args) throws Exception {
e.printStackTrace(System.err);
}
} else if(dynamicTools.containsKey(mode)) {
dynamicTools.get(mode).execute(parsedArgs);
System.exit(0);
CommandLineTool tool = dynamicTools.get(mode);
tool.execute(parsedArgs);
if(!tool.noExitOnReturn()) {
System.exit(0);
}
} else {
throw new Error("Should not have gotten here");
}
@@ -1,6 +1,7 @@
package com.laytonsmith.tools;

import com.laytonsmith.PureUtilities.Common.UIUtils;
import com.laytonsmith.tools.docgen.localization.LocalizationUI;
import com.laytonsmith.tools.pnviewer.PNViewer;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
@@ -29,6 +30,10 @@ public UILauncher() {
uis.add(new UI("Persistence Network Viewer", "Allows easier visualization of the Persistence Network", () -> {
PNViewer.main(args);
}));
uis.add(new UI("Localization (L10n) UI", "Provides an easy to use UI to correctly edit localization files",
() -> {
LocalizationUI.launch(null);
}));

initComponents();

@@ -3,7 +3,7 @@
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.laytonsmith.tools.docgen.sitedeploy;
package com.laytonsmith.tools.docgen.localization;

import com.laytonsmith.PureUtilities.ArgumentParser;
import com.laytonsmith.PureUtilities.Common.StringUtils;
@@ -68,7 +68,7 @@ public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exce
}

@tool("l10n-ui")
public static class LocalizationUI extends AbstractCommandLineTool {
public static class LocalizationUITool extends AbstractCommandLineTool {

private static final String DATABASE = "database";

@@ -87,8 +87,13 @@ public ArgumentParser getArgumentParser() {

@Override
public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception {
throw new UnsupportedOperationException("Not supported yet.");
String database = parsedArgs.getStringArgument(DATABASE);
LocalizationUI.launch(database);
}

@Override
public boolean noExitOnReturn() {
return true;
}
}
}
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
<SubComponents>
<Menu class="javax.swing.JMenu" name="jMenu1">
<Properties>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="loadMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Load..."/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveMenu">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+S"/>
</Property>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu2">
<Properties>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="helpMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Help..."/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="aboutMenu">
<Properties>
<Property name="text" type="java.lang.String" value="About..."/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
<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="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<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="false"/>
<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"/>
</AuxValues>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="994" max="32767" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="1789" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="java.awt.Label" name="statusLabel">
<Properties>
<Property name="text" type="java.lang.String" value="label1"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

0 comments on commit 44351ec

Please sign in to comment.
You can’t perform that action at this time.