Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void remove(int offs, int len) throws BadLocationException {

if (model.checkText(text)) {
super.remove(offs, len);
model.onTextChange(getText(0, getLength()));
model.onTextChange();
} else {
Toolkit.getDefaultToolkit().beep();
}
Expand Down Expand Up @@ -126,7 +126,7 @@ public void insertString(int offs, String str, AttributeSet a)

if (model.checkText(text)) {
super.insertString(offs, str, a);
model.onTextChange(getText(0, getLength()));
model.onTextChange();
} else {
Toolkit.getDefaultToolkit().beep();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public void addLayoutComponent(Component comp, Object constraints) {
/**
* @deprecated replaced by <code>addLayoutComponent(Component, Object)</code>.
*/
@Deprecated
public void addLayoutComponent(String name, Component comp) {
throw new IllegalArgumentException("dont use this deprecated method please");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void insertString(int offs, String str, AttributeSet a)

if (((VField) getModel()).checkText(text)) {
scanedtext.append(str);
((VField) getModel()).onTextChange(scanedtext.toString());
((VField) getModel()).onTextChange();
progress = (progress + 1) % PROGRESS_BAR.length();
super.setModelText(PROGRESS_BAR.substring(0, progress + 1));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public void addLayoutComponent(Component comp, Object constraints) {
/**
* @deprecated replaced by <code>addLayoutComponent(Component, Object)</code>.
*/
@Deprecated
public void addLayoutComponent(String name, Component comp) {
throw new IllegalArgumentException("dont use this deprecated method please");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void remove(int offs, int len) throws BadLocationException {

if (model.checkText(text)) {
super.remove(offs, len);
model.onTextChange(getText(0, getLength()));
model.onTextChange();
} else {
Toolkit.getDefaultToolkit().beep();
}
Expand Down Expand Up @@ -138,7 +138,7 @@ public void insertString(int offs, String str, AttributeSet a)

if (model.checkText(text)) {
super.insertString(offs, str, a);
model.onTextChange(getText(0, getLength()));
model.onTextChange();
} else {
Toolkit.getDefaultToolkit().beep();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void addColumn(int position) {
headerLabel ="col" + (model.getColumnCount());
column.setHeaderValue(headerLabel);
table.getColumnModel().addColumn(column);
model.addColumn(headerLabel, position);
model.addColumn(headerLabel);
// save columns order
TableColumn[] newTableColumns = new TableColumn[model.getAccessibleColumnCount()];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ private class ChangeAction extends AbstractAction {

private ChangeAction() {
super(VlibProperties.getString("aspell-dialog-change"));
putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_C));
putValue(ACCELERATOR_KEY, new Integer(KeyEvent.VK_C));
putValue(MNEMONIC_KEY, KeyEvent.VK_C);
putValue(ACCELERATOR_KEY, KeyEvent.VK_C);
}

public void actionPerformed(ActionEvent event) {
Expand All @@ -206,8 +206,8 @@ private class ChangeAllAction extends AbstractAction {

private ChangeAllAction() {
super(VlibProperties.getString("aspell-dialog-change-all"));
putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_L));
putValue(ACCELERATOR_KEY, new Integer(KeyEvent.VK_L));
putValue(MNEMONIC_KEY, KeyEvent.VK_L);
putValue(ACCELERATOR_KEY, KeyEvent.VK_L);
}

public void actionPerformed(ActionEvent event) {
Expand All @@ -224,8 +224,8 @@ private class IgnoreAction extends AbstractAction {

private IgnoreAction() {
super(VlibProperties.getString("aspell-dialog-ignore"));
putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_I));
putValue(ACCELERATOR_KEY, new Integer(KeyEvent.VK_I));
putValue(MNEMONIC_KEY, KeyEvent.VK_I);
putValue(ACCELERATOR_KEY, KeyEvent.VK_I);
}

public void actionPerformed(ActionEvent event) {
Expand All @@ -242,8 +242,8 @@ private class IgnoreAllAction extends AbstractAction {

private IgnoreAllAction() {
super(VlibProperties.getString("aspell-dialog-ignore-all"));
putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_G));
putValue(ACCELERATOR_KEY, new Integer(KeyEvent.VK_G));
putValue(MNEMONIC_KEY, KeyEvent.VK_G);
putValue(ACCELERATOR_KEY, KeyEvent.VK_G);
}

public void actionPerformed( ActionEvent event ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ public int getReturnCode() {
}

/**
* @deprecated Use closeWindow() or close(int code) instead.
* @deprecated Use closeWindow() or close(int code) instead.
*/
@Deprecated
public void close() {
closeWindow();
}
Expand Down Expand Up @@ -332,8 +333,9 @@ public void run() {

/**
* Builds the display structure
* @deprecated do not use anymore
* @deprecated do not use anymore
*/
@Deprecated
public void build() {
}

Expand Down Expand Up @@ -637,6 +639,7 @@ public Action getUndoAction() {
* @deprecated Use method #performAsyncAction(KopiAction action) without
* boolean parameter because this parameter was ignored.
*/
@Deprecated
public void performAction(final org.kopi.galite.visual.Action action, boolean block) {
performAsyncAction(action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void startApplication() {
try {
Executable module;

module = Module.Companion.startForm(connection, form, "initial form");
module = Module.Companion.startForm(form);
if (module instanceof VWindow) {
((VWindow) module).addModelCloseListener(new ModelCloseListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ abstract class FileHandler {
* Tests if the [pathname] of the file has the extension .PDF
*/
override fun accept(pathname: File?): Boolean {
return pathname != null && pathname.name.toUpperCase().endsWith(".PDF")
return pathname != null && pathname.name.uppercase().endsWith(".PDF")
}

/**
Expand Down
5 changes: 3 additions & 2 deletions galite-core/src/main/kotlin/org/kopi/galite/visual/Message.kt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remplace updateParams par listeParams

Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ object Message {
* @param params The message parameters.
* @return The formatted message.
*/
@Suppress("UNCHECKED_CAST")
fun getMessage(source: String = VISUAL_KOPI_MESSAGES_LOCALIZATION_RESOURCE,
ident: String,
params: Any? = null): String {
val params = if (params is Array<*>?) params as Array<Any?>? else arrayOf(params)
val listeParams = if (params is Array<*>?) params as Array<Any?>? else arrayOf(params)

val manager = if (ApplicationContext.isApplicationContextInitialized) {
ApplicationContext.getLocalizationManager()
Expand All @@ -72,7 +73,7 @@ object Message {
return try {
// Within a String, "''" represents a single quote in java.text.MessageFormat.
val format = manager!!.getMessageLocalizer(source, ident).getText().replace("'", "''")
ExtendedMessageFormat.formatMessage(format, params)
ExtendedMessageFormat.formatMessage(format, listeParams)
} catch (e: InconsistencyException) {
System.err.println("ERROR: " + e.message)
"!$ident!"
Expand Down

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remplace updateParams par listeParams

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object MessageCode {
@Suppress("UNCHECKED_CAST")
@JvmOverloads
fun getMessage(key: String, params: Any? = null, withKey: Boolean = true): String {
val params = if (params is Array<*>?) params as Array<Any?>? else arrayOf(params)
val listeParams = if (params is Array<*>?) params as Array<Any?>? else arrayOf(params)

if (!keyPattern.matcher(key).matches()) {
throw InconsistencyException("Malformed message key '$key'")
Expand All @@ -75,7 +75,7 @@ object MessageCode {
// Within a String, "''" represents a single quote in java.text.MessageFormat.
val format = manager.getMessageLocalizer(src, ident).getText().replace("'", "''")
val messageFormat = ExtendedMessageFormat(format, ApplicationContext.getDefaultLocale())
(if (withKey) "$key: " else "") + messageFormat.formatMessage(params)
(if (withKey) "$key: " else "") + messageFormat.formatMessage(listeParams)
} catch (e: InconsistencyException) {
ApplicationContext.reportTrouble(
"localize MessageCode",
Expand Down
19 changes: 7 additions & 12 deletions galite-core/src/main/kotlin/org/kopi/galite/visual/Module.kt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changer :
ApplicationContext.reportTrouble(
"Form loading",
"Module.startForm(Connection ctxt, " +
"String object, String description, ImageIcon icon)",
t.message,
t
)
à
ApplicationContext.reportTrouble(
"Form loading",
"Module.startForm(String object, ImageIcon icon)",
t.message,
t
)

Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@

package org.kopi.galite.visual

import kotlin.jvm.Throws

import org.kopi.galite.visual.base.Image
import org.kopi.galite.database.Connection
import org.kopi.galite.util.base.InconsistencyException
import org.kopi.galite.visual.base.Image
import org.kopi.galite.visual.dsl.common.Window
import org.kopi.galite.visual.l10n.LocalizationManager
import org.kopi.galite.visual.l10n.ModuleLocalizer
import org.kopi.galite.util.base.InconsistencyException

/**
* Represents an Module.
Expand Down Expand Up @@ -96,7 +94,7 @@ class Module(val id: Int,
* @param context the context where to look for application
*/
fun run(context: Connection) {
startForm(context, objectName, description, smallIcon)
startForm(objectName, smallIcon)
}

override fun toString(): String = shortname
Expand Down Expand Up @@ -139,8 +137,8 @@ class Module(val id: Int,

companion object {
fun getExecutable(objectName: String?): Executable {
return try {
val instance = Class.forName(objectName).kotlin.objectInstance ?: Class.forName(objectName).newInstance()
try {
val instance = Class.forName(objectName).kotlin.objectInstance ?: Class.forName(objectName).getDeclaredConstructor().newInstance()
return if(instance is Window) {
instance.model
} else {
Expand All @@ -157,9 +155,7 @@ class Module(val id: Int,

@JvmOverloads
@Throws(VException::class)
fun startForm(ctxt: Connection,
objectName: String?,
description: String,
fun startForm(objectName: String?,
icon: Image? = null): Executable? {
return try {
if (ApplicationContext.getDefaults()!!.isDebugModeEnabled) {
Expand All @@ -180,8 +176,7 @@ class Module(val id: Int,
} catch (t: Throwable) {
ApplicationContext.reportTrouble(
"Form loading",
"Module.startForm(Connection ctxt, " +
"String object, String description, ImageIcon icon)",
"Module.startForm(String object, ImageIcon icon)",
t.message,
t
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ class RootMenu(id: Int, name: String) {
* Creates the module tree for the given root module.
* @param modules The accessible modules.
* @param root The root module.
* @param force Should we force module accessibility ?
* @param forceModuleAccessibility Should we force module accessibility ?
* @param isSuperUser Is the connected user is a super user ?
* @return The local root tree node.
*/
internal fun createTree(modules: Array<Module>,
root: Module,
force: Boolean,
forceModuleAccessibility: Boolean,
isSuperUser: Boolean): DefaultMutableTreeNode? {
var force = force
var force = forceModuleAccessibility

if (root.accessibility == Module.ACS_TRUE || isSuperUser) {
force = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,21 @@ object VDatabaseUtils {
val query1 = References.slice(References.table, References.column, References.action)
.select { References.reference eq queryTable.tableName }
.orderBy(References.action to SortOrder.DESC)
val action = query1.forEach { query1Row ->
query1.forEach { query1Row ->
val auxTable = object : Table(query1Row[References.table]) {
var id = integer("ID")
val column = integer(query1Row[References.column])
}
when (query1Row[References.action][0]) {
'R' -> transaction {
val query2 = auxTable.slice(auxTable.id)
auxTable.slice(auxTable.id)
.select { auxTable.column eq id }
if (query2.toList()[1] != null) {
throw VExecFailedException(
MessageCode.getMessage("VIS-00021", arrayOf<Any>(
query1Row[References.column],
query1Row[References.table]
))
)
}
throw VExecFailedException(
MessageCode.getMessage("VIS-00021", arrayOf<Any>(
query1Row[References.column],
query1Row[References.table]
))
)
}

'C' -> transaction {
Expand All @@ -71,8 +69,7 @@ object VDatabaseUtils {
it[auxTable.column] = 0
}
}
else -> throw InconsistencyException()

else -> throw InconsistencyException("Unrecognized action for table ${query1Row[References.table]} and column ${query1Row[References.column]}: ${query1Row[References.action]}")
}
}
}
Expand All @@ -85,23 +82,21 @@ object VDatabaseUtils {
val query1 = References.slice(References.table, References.column, References.action)
.select { References.reference eq table }
.orderBy(References.action to SortOrder.DESC)
val action = query1.forEach { query1Row ->
query1.forEach { query1Row ->
val auxTable = object : Table(query1Row[References.table]) {
var id = integer("ID")
val column = integer(query1Row[References.column])
}
when (query1Row[References.action][0]) {
'R' -> transaction {
val query2 = auxTable.slice(auxTable.id)
.select { auxTable.column eq id }
if (query2.toList()[1] != null) {
auxTable.slice(auxTable.id)
.select { auxTable.column eq id }
throw VExecFailedException(
MessageCode.getMessage("VIS-00021", arrayOf<Any>(
query1Row[References.column],
query1Row[References.table]
))
)
}
}

'C' -> transaction {
Expand All @@ -118,8 +113,7 @@ object VDatabaseUtils {
it[auxTable.column] = 0
}
}
else -> throw InconsistencyException()

else -> throw InconsistencyException("Unrecognized action for table ${query1Row[References.table]} and column ${query1Row[References.column]}: ${query1Row[References.action]}")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ open class VHelpGenerator {
}
printer.println("</TD><TD>")
if (accMod != 0) {
if (accMod == InputEvent.SHIFT_MASK) {
if (accMod == InputEvent.SHIFT_DOWN_MASK) {
printer.print("Shift-")
}
}
Expand Down
Loading