From a460bed9d0647b329cba44bba17f91e66325ad46 Mon Sep 17 00:00:00 2001 From: fer_luck Date: Sun, 29 Apr 2007 04:33:35 +0000 Subject: [PATCH] This code commit is related to: Feature request: 1707462 Description: Change VFormat on runtime and add a mask that uppercases any char. Patch: 1646656 Description: Truncated characters for pt_BR lang files. Converted the truncated files to unicode hex format. --- base/src/org/compiere/model/GridField.java | 11 +++++ base/src/org/compiere/model/GridTab.java | 12 ++++- base/src/org/compiere/model/GridTable.java | 20 ++++++++ .../src/org/compiere/apps/ALoginRes_pt.java | 29 ++++++------ .../src/org/compiere/grid/GridController.java | 12 +++++ .../src/org/compiere/grid/ed/MDocString.java | 16 ++++++- client/src/org/compiere/grid/ed/VString.java | 32 +++++++++++++ dbPort/src/org/compiere/db/DBRes_pt.java | 18 ++++---- looks/src/org/compiere/plaf/PlafRes_pt.java | 46 ++++++++++--------- looks/src/org/compiere/util/IniRes_pt.java | 10 ++-- 10 files changed, 156 insertions(+), 50 deletions(-) diff --git a/base/src/org/compiere/model/GridField.java b/base/src/org/compiere/model/GridField.java index d318f3199d..def80bb471 100644 --- a/base/src/org/compiere/model/GridField.java +++ b/base/src/org/compiere/model/GridField.java @@ -1546,4 +1546,15 @@ public class GridField Env.setContext(m_vo.ctx, m_vo.WindowNo, m_vo.ColumnName, m_backupValue); } } + + /** + * Feature Request [1707462] + * Enable user to change VFormat on runtime + * @param strNewFormat VFormat mask + * @author fer_luck + */ + public void setVFormat(String strNewFormat){ + m_vo.VFormat = strNewFormat; + } //setVFormat + } // MField diff --git a/base/src/org/compiere/model/GridTab.java b/base/src/org/compiere/model/GridTab.java index 15aefa0016..205d7d9d0e 100644 --- a/base/src/org/compiere/model/GridTab.java +++ b/base/src/org/compiere/model/GridTab.java @@ -2506,5 +2506,15 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable m_listenerList.add(DataStatusListener.class, l); } - + /** + * Feature Request [1707462] + * Enable runtime change of VFormat + * @param Identifier field ident + * @param strNewFormat new mask + * @author fer_luck + */ + public void setFieldVFormat (String identifier, String strNewFormat) + { + m_mTable.setFieldVFormat(identifier, strNewFormat); + } // setFieldVFormat } // MTab diff --git a/base/src/org/compiere/model/GridTable.java b/base/src/org/compiere/model/GridTable.java index 52eb2509d7..14555b3869 100644 --- a/base/src/org/compiere/model/GridTable.java +++ b/base/src/org/compiere/model/GridTable.java @@ -3072,4 +3072,24 @@ public class GridTable extends AbstractTableModel } // Loader + /** + * Feature Request [1707462] + * Enable runtime change of VFormat + * @param Identifier field ident + * @param strNewFormat new mask + * @author fer_luck + */ + protected void setFieldVFormat (String identifier, String strNewFormat) + { + int cols = m_fields.size(); + for (int i = 0; i < cols; i++) + { + GridField field = (GridField)m_fields.get(i); + if (identifier.equalsIgnoreCase(field.getColumnName())){ + field.setVFormat(strNewFormat); + m_fields.set(i, field); + break; + } + } + } // setFieldVFormat } diff --git a/client/src/org/compiere/apps/ALoginRes_pt.java b/client/src/org/compiere/apps/ALoginRes_pt.java index d4ad2eb371..3208594ee2 100644 --- a/client/src/org/compiere/apps/ALoginRes_pt.java +++ b/client/src/org/compiere/apps/ALoginRes_pt.java @@ -26,13 +26,14 @@ import java.util.*; */ public final class ALoginRes_pt extends ListResourceBundle { - // TODO Run native2ascii to convert to plain ASCII !! /** Translation Content */ + //Characters encoded to UTF8 Hex, so no more problems with svn commits + //Fernando Lucktemberg - CenturuyOn Consultoria static final Object[][] contents = new String[][] { - { "Connection", "Conex�o" }, - { "Defaults", "Padr�es" }, + { "Connection", "Conex\u00e3o" }, + { "Defaults", "Padr\u00f5es" }, { "Login", "Adempiere Login" }, { "File", "Arquivo" }, { "Exit", "Sair" }, @@ -40,29 +41,29 @@ public final class ALoginRes_pt extends ListResourceBundle { "About", "Sobre" }, { "Host", "Servidor" }, { "Database", "Banco de Dados" }, - { "User", "ID Usu�rio" }, - { "EnterUser", "Entre com o ID Usu�rio da Aplica��o" }, + { "User", "Usu\u00e1rio" }, + { "EnterUser", "Entre com o Usu\u00e1rio da Aplica\u00e7\u00e3o" }, { "Password", "Senha" }, - { "EnterPassword", "Entre com a Senha da Aplica��o" }, + { "EnterPassword", "Entre com a senha da Aplica\u00e7\u00e3o" }, { "Language", "Idioma" }, { "SelectLanguage", "Selecione o idioma" }, { "Role", "Regra" }, { "Client", "Cliente" }, - { "Organization", "Organiza��o" }, + { "Organization", "Organiza\u00e7\u00e3o" }, { "Date", "Data" }, - { "Warehouse", "Dep�sito" }, + { "Warehouse", "Dep\u00f3sito" }, { "Printer", "Impressora" }, { "Connected", "Conectado" }, - { "NotConnected", "N�o conectado" }, - { "DatabaseNotFound", "Banco de Dados n�o encontrado" }, - { "UserPwdError", "Usu�rio/Senha inv�lidos" }, - { "RoleNotFound", "Regra n�o encontrada/incorreta" }, + { "NotConnected", "N\u00e3o conectado" }, + { "DatabaseNotFound", "Banco de Dados n\u00e3o encontrado" }, + { "UserPwdError", "Usu\u00e1rio/Senha inv\u00e1lidos" }, + { "RoleNotFound", "Regra n\u00e3o encontrada/incorreta" }, { "Authorized", "Autorizado" }, { "Ok", "Ok" }, { "Cancel", "Cancelar" }, - { "VersionConflict", "Conflito de Vers�es:" }, + { "VersionConflict", "Conflito de Vers\u00f5es:" }, { "VersionInfo", "Servidor <> Cliente" }, - { "PleaseUpgrade", "Favor executar o programa de atualiza��o" } + { "PleaseUpgrade", "Favor executar o programa de atualizao" } }; /** diff --git a/client/src/org/compiere/grid/GridController.java b/client/src/org/compiere/grid/GridController.java index 460f9c87ea..95b915f5db 100644 --- a/client/src/org/compiere/grid/GridController.java +++ b/client/src/org/compiere/grid/GridController.java @@ -890,6 +890,18 @@ public class GridController extends CPanel { if (!comp.isVisible()) comp.setVisible(true); // visibility + /** + * Feature Request [1707462] + * Enable runtime change of VFormat + * @author fer_luck + */ + if (comp instanceof VString){ + VString vs = (VString)comp; + if(!vs.getVFormat().equals(mField.getVFormat()) && mField.getVFormat() != null){ + vs.setVFormat(mField.getVFormat()); + } + } + //End Feature Request [1707462] if (comp instanceof VEditor) { VEditor ve = (VEditor)comp; diff --git a/client/src/org/compiere/grid/ed/MDocString.java b/client/src/org/compiere/grid/ed/MDocString.java index f04c2b0cf4..6020151b6f 100644 --- a/client/src/org/compiere/grid/ed/MDocString.java +++ b/client/src/org/compiere/grid/ed/MDocString.java @@ -40,6 +40,7 @@ import org.compiere.util.*; * A any Letters & Digits NO space converted to upper case * c any Letters & Digits or space * C any Letters & Digits or space converted to upper case + * Z any character converted to upper case * * @see VString * @author Jorg Janke @@ -105,6 +106,11 @@ public final class MDocString extends PlainDocument implements CaretListener m_mask = m_mask.replace('O', SPACE); // O any Letter a..Z or space converted to upper case m_mask = m_mask.replace('0', SPACE); // 0 Digits 0..9 NO space m_mask = m_mask.replace('9', SPACE); // 9 Digits 0..9 or space + /** + * Feature Request [1707462] + * Convert any to Uppercase + */ + m_mask = m_mask.replace('Z', SPACE); // Z any character converted to upper case // Check Caret if (m_tc == null || m_tc.getCaret() instanceof VOvrCaret) @@ -135,7 +141,7 @@ public final class MDocString extends PlainDocument implements CaretListener } /** Formating required **/ - log.finest("Offset=" + offset + log.finest("Offsret=" + offset + ", String=" + string + ", MaxLength=" + m_maxLength + ", Format=" + m_VFormat + ", Mask=" + m_mask + ", Text=" + getText() + ", Length=" + getText().length()); @@ -248,6 +254,14 @@ public final class MDocString extends PlainDocument implements CaretListener case SPACE: // any character break; // + /** + * Feature Request [1707462] + * Convert any to Uppercase + */ + case 'Z': // Z any character converted to upper case + string = string.toUpperCase(); + break; + // ---- default: // other return; } // switch diff --git a/client/src/org/compiere/grid/ed/VString.java b/client/src/org/compiere/grid/ed/VString.java index b67e0ad0a5..5b104e00d1 100644 --- a/client/src/org/compiere/grid/ed/VString.java +++ b/client/src/org/compiere/grid/ed/VString.java @@ -20,6 +20,7 @@ import java.awt.*; import java.awt.event.*; import java.beans.*; import javax.swing.*; +import javax.swing.event.CaretListener; import org.adempiere.plaf.AdempierePLAF; import org.compiere.model.*; @@ -257,6 +258,26 @@ public final class VString extends CTextField ValuePreference.addMenu (this, popupMenu); } // setField + /** + * Feature Request [1707462] + * Set VFormat + * @param strMask mask + * @author fer_luck + */ + public void setVFormat (String strMask) + { + m_VFormat = strMask; + //Get the actual caret from the field, if there's no + //caret then just catch the exception and continue + //creating the new caret. + try{ + CaretListener [] cl = this.getCaretListeners(); + this.removeCaretListener(cl[0]); + } catch(ClassCastException ex ){ + log.fine("VString.setVFormat - No caret Listeners"); + } + setDocument(new MDocString(m_VFormat, m_fieldLength, this)); + } // setVFormat /** * Set Text (optionally obscured) @@ -297,6 +318,17 @@ public final class VString extends CTextField return text; } // getText + /** + * Feature Request [1707462] + * Get VFormat + * @return strMask mask + * @author fer_luck + */ + public String getVFormat () + { + return this.m_VFormat; + } // getVFormat + /** * Focus Gained. * Enabled with Obscure diff --git a/dbPort/src/org/compiere/db/DBRes_pt.java b/dbPort/src/org/compiere/db/DBRes_pt.java index e78610d607..9657c6cfd2 100644 --- a/dbPort/src/org/compiere/db/DBRes_pt.java +++ b/dbPort/src/org/compiere/db/DBRes_pt.java @@ -27,31 +27,33 @@ import java.util.*; public class DBRes_pt extends ListResourceBundle { /** Data */ + //Characters encoded to UTF8 Hex, so no more problems with svn commits + //Fernando Lucktemberg - CenturuyOn Consultoria static final Object[][] contents = new String[][] { - { "CConnectionDialog", "Adempiere Conexão" }, + { "CConnectionDialog", "Adempiere Conex\u00e3o" }, { "Name", "Nome" }, - { "AppsHost", "Servidor de Aplicação" }, - { "AppsPort", "Porta TCP da Aplicação" }, - { "TestApps", "Testar Aplicação" }, + { "AppsHost", "Servidor de Aplica\u00e7\u00e3o" }, + { "AppsPort", "Porta TCP da Aplica\u00e7\u00e3o" }, + { "TestApps", "Testar Aplica\u00e7\u00e3o" }, { "DBHost", "Servidor do Banco de Dado" }, { "DBPort", "Porta TCP do Banco de Dados" }, { "DBName", "Nome do Banco de Dados" }, - { "DBUidPwd", "Usuário / Senha" }, + { "DBUidPwd", "Usu\u00e1rio / Senha" }, { "ViaFirewall", "via Firewall" }, { "FWHost", "Servidor de Firewall" }, { "FWPort", "Porta TCP do Firewall" }, { "TestConnection", "Testar Banco de Dados" }, { "Type", "Tipo de Banco de Dados" }, - { "BequeathConnection", "Conexão Bequeath" }, + { "BequeathConnection", "Conex\u00e3o Bequeath" }, { "Overwrite", "Sobrescrever" }, { "ConnectionProfile", "Connection" }, { "LAN", "LAN" }, { "TerminalServer", "Terminal Server" }, { "VPN", "VPN" }, { "WAN", "WAN" }, - { "ConnectionError", "Erro de Conexão" }, - { "ServerNotActive", "Servidor não Ativo" } + { "ConnectionError", "Erro de Conex\u00e3o" }, + { "ServerNotActive", "Servidor n\u00e3o Ativo" } }; /** diff --git a/looks/src/org/compiere/plaf/PlafRes_pt.java b/looks/src/org/compiere/plaf/PlafRes_pt.java index 48e4b1b79c..9e31b9b473 100644 --- a/looks/src/org/compiere/plaf/PlafRes_pt.java +++ b/looks/src/org/compiere/plaf/PlafRes_pt.java @@ -27,11 +27,13 @@ import java.util.ListResourceBundle; public class PlafRes_pt extends ListResourceBundle { /** The data */ + //Characters encoded to UTF8 Hex, so no more problems with svn commits + //Fernando Lucktemberg - CenturuyOn Consultoria static final Object[][] contents = new String[][] { { "BackColType", "Tipo da Cor de Fundo" }, { "BackColType_Flat", "Plano" }, - { "BackColType_Gradient", "D�grad�" }, + { "BackColType_Gradient", "Degrad\u00ea" }, { "BackColType_Lines", "Linhas" }, { "BackColType_Texture", "Textura" }, // @@ -39,9 +41,9 @@ public class PlafRes_pt extends ListResourceBundle { "LookAndFeel", "Look & Feel" }, { "Theme", "Tema" }, { "EditAdempiereTheme", "Editar Tema Adempiere" }, - { "SetDefault", "Fundo Padr�o" }, + { "SetDefault", "Fundo Padr\u00e3o" }, { "SetDefaultColor", "Cor de Fundo" }, - { "ColorBlind", "Defici�ncia de Cor" }, + { "ColorBlind", "Defici\u00eancia de Cor" }, { "Example", "Exemplo" }, { "Reset", "Reinicializar" }, { "OK", "OK" }, @@ -52,31 +54,31 @@ public class PlafRes_pt extends ListResourceBundle { "AdempiereColors", "Cores Adempiere" }, { "AdempiereFonts", "Fontes Adempiere" }, { "Primary1Info", "Sombra, Separador" }, - { "Primary1", "Prim�rio 1" }, + { "Primary1", "Prim\u00e1rio 1" }, { "Primary2Info", "Linha de Foco, Menu Selecionado" }, - { "Primary2", "Prim�rio 2" }, + { "Primary2", "Prim\u00e1rio 2" }, { "Primary3Info", "Linha da Tabele Selecionada, Texto Selecionado, Fundo Dicas" }, - { "Primary3", "Prim�rio 3" }, + { "Primary3", "Prim\u00e1rio 3" }, { "Secondary1Info", "Bordas de Linhas" }, - { "Secondary1", "Secund�rio 1" }, + { "Secondary1", "Secund\u00e1rio 1" }, { "Secondary2Info", "Tabs Inativas, Campos Pressed, Borda Inativa + Texto" }, - { "Secondary2", "Secund�rio 2" }, + { "Secondary2", "Secund\u00e1rio 2" }, { "Secondary3Info", "�rea de Fundo" }, - { "Secondary3", "Secund�rio 3" }, + { "Secondary3", "Secund\u00e1rio 3" }, // { "ControlFontInfo", "Controle de Fonte" }, - { "ControlFont", "R�tulo da Fonte" }, + { "ControlFont", "R\u00f3tulo da Fonte" }, { "SystemFontInfo", "Tool Tip, Tree nodes" }, { "SystemFont", "System Font" }, - { "UserFontInfo", "Entrada de Dados pelo Usu�rio" }, + { "UserFontInfo", "Entrada de Dados pelo Usu\u00e1rio" }, { "UserFont", "Fonte dos Campos" }, -// { "SmallFontInfo", "Relat�rios" }, +// { "SmallFontInfo", "Relat\u00f3rios" }, { "SmallFont", "Fonte pequena" }, - { "WindowTitleFont", "Fonte do T�tulo" }, + { "WindowTitleFont", "Fonte do T\u00edtulo" }, { "MenuFont", "Fonte do Menu" }, // { "MandatoryInfo", "Fundo de Campos Obrigat�rios" }, - { "Mandatory", "Obrigat�rio" }, + { "Mandatory", "Obrigat\u00f3rio" }, { "ErrorInfo", "Fundo de Campo de Erro" }, { "Error", "Erro" }, { "InfoInfo", "Fundo de Campos Informativos" }, @@ -95,9 +97,9 @@ public class PlafRes_pt extends ListResourceBundle { "FontChooser", "Selecionar Fonte" }, { "Fonts", "Fontes" }, { "Plain", "Plano" }, - { "Italic", "It�lico" }, + { "Italic", "It\u00e1lico" }, { "Bold", "Negrito" }, - { "BoldItalic", "Negrito & It�lico" }, + { "BoldItalic", "Negrito & It\u00e1lico" }, { "Name", "Nome" }, { "Size", "Tamanho" }, { "Style", "Estilo" }, @@ -106,17 +108,17 @@ public class PlafRes_pt extends ListResourceBundle // { "AdempiereColorEditor", "Adempiere: Editor de Cores" }, { "AdempiereType", "Tipo de Cor" }, - { "GradientUpperColor", "Cor D�grad� Superior" }, - { "GradientLowerColor", "Cor D�grad� Inferior" }, - { "GradientStart", "In�cio do D�grad�" }, - { "GradientDistance", "Dist�ncia do D�grad�" }, + { "GradientUpperColor", "Cor Degrad\u00ea Superior" }, + { "GradientLowerColor", "Cor Degrad\u00ea Inferior" }, + { "GradientStart", "In\u00edcio do Degrad\u00ea" }, + { "GradientDistance", "Dist\u00e2ncia do Degrad\u00ea" }, { "TextureURL", "URL Textura" }, { "TextureAlpha", "Alfa Textura" }, - { "TextureTaintColor", "Colora��o da Textura" }, + { "TextureTaintColor", "Colora\u00e7\u00e3o da Textura" }, { "LineColor", "Cor da Linha" }, { "LineBackColor", "Cores de Fundo" }, { "LineWidth", "Largura da Linha" }, - { "LineDistance", "Dist�ncia das linhas" }, + { "LineDistance", "Dist\u00e2ncia das linhas" }, { "FlatColor", "Cores Planas" } }; diff --git a/looks/src/org/compiere/util/IniRes_pt.java b/looks/src/org/compiere/util/IniRes_pt.java index 7fedc11e82..399b760995 100644 --- a/looks/src/org/compiere/util/IniRes_pt.java +++ b/looks/src/org/compiere/util/IniRes_pt.java @@ -27,14 +27,16 @@ import java.util.ListResourceBundle; public class IniRes_pt extends ListResourceBundle { /** Translation Content */ + //Characters encoded to UTF8 Hex, so no more problems with svn commits + //Fernando Lucktemberg - CenturuyOn Consultoria static final Object[][] contents = new String[][] { - { "Adempiere_License", "Acordo de Licen�a" }, - { "Do_you_accept", "Voc� aceita os termos da Licen�a ?" }, - { "No", "N�o" }, + { "Adempiere_License", "Acordo de Licen\u00e7a" }, + { "Do_you_accept", "Voc\u00ea aceita os termos da Licen\u00e7a ?" }, + { "No", "Licen\u00e7a" }, { "Yes_I_Understand", "Sim, eu Entendi e Aceito" }, { "license_htm", "org/adempiere/license.htm" }, - { "License_rejected", "Licen�a rejeitada ou expirada" } + { "License_rejected", "Licen\u00e7a rejeitada ou expirada" } }; /**