Skip to content

Commit

Permalink
Merge pull request #1 from TheInfiniteKind/master
Browse files Browse the repository at this point in the history
Updated for Moneydance 2015
  • Loading branch information
stant committed Mar 6, 2015
2 parents c717320 + 7912d8c commit 1b19b71
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 193 deletions.
4 changes: 3 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
<property name="publickey" value="public.key"/>
<property name="privatekeyid" value="99"/>
</target>

<target name="-post-jar">
<property file="user.properties" />
<echo message="Using private key: ${privatekey}"/>
<jar destfile="${dist.jar}" update="true">
<zipfileset src="externals/swing-layout/swing-layout-1.0.3.jar"/>
</jar>
Expand Down
Binary file modified externals/moneydance/extadmin.jar
Binary file not shown.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
package com.moneydance.modules.features.mdcsvimporter;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
*
* @author stan
*/


public class CustomTableCellRenderer extends DefaultTableCellRenderer {

int forRow = -1;
int forCol = -1;

public void setForRowCol( int row, int col )
{
forRow = row;
forCol = col;
}

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
{
JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

//Get the status for the current row.
PreviewImportTblModel tableModel = (PreviewImportTblModel) table.getModel();
if ( (row == forRow || forRow < 0) && (col == forCol || forCol < 0) )
{
lbl.setBackground( Color.RED );
}
else
{
//lbl.setBackground( javax.swing.UIManager.getColor( "Table.dropCellBackground" ) );
lbl.setBackground( Color.WHITE );
}
//Return the JLabel which renders the cell.
return lbl;
}
}
package com.moneydance.modules.features.mdcsvimporter;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
*
* @author stan
*/


public class CustomTableCellRenderer extends DefaultTableCellRenderer {

int forRow = -1;
int forCol = -1;

public void setForRowCol( int row, int col )
{
forRow = row;
forCol = col;
}

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
{
JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

//Get the status for the current row.
PreviewImportTblModel tableModel = (PreviewImportTblModel) table.getModel();
if ( (row == forRow || forRow < 0) && (col == forCol || forCol < 0) )
{
lbl.setBackground( Color.RED );
}
else
{
//lbl.setBackground( javax.swing.UIManager.getColor( "Table.dropCellBackground" ) );
lbl.setBackground( Color.WHITE );
}
//Return the JLabel which renders the cell.
return lbl;
}
}
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
*/
package com.moneydance.modules.features.mdcsvimporter;

import com.moneydance.apps.md.model.Account;
import com.moneydance.apps.md.model.RootAccount;
import com.infinitekind.moneydance.model.*;
import com.moneydance.apps.md.view.gui.MoneydanceGUI;
import com.moneydance.apps.md.view.gui.OnlineManager;
import static com.moneydance.modules.features.mdcsvimporter.TransactionReader.importDialog;
Expand All @@ -33,8 +32,6 @@
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
Expand Down Expand Up @@ -130,7 +127,7 @@ public void changedUpdate( DocumentEvent e )
skipDuringInit = false;
this.setModal( false );
this.addEscapeListener( this );
TransactionReader.init( customReaderDialog, this, main.getRootAccount() );
TransactionReader.init( customReaderDialog, this, main.getAccountBook() );
}

public static void addEscapeListener(final JDialog win) {
Expand Down Expand Up @@ -337,10 +334,10 @@ else if ( runArgsHM.size() > 0 )

private void fillAccountCombo( Main main )
{
RootAccount rootAccount = main.getRootAccount();
AccountBook book = main.getAccountBook();
comboAccount.removeAllItems();

fillAccountCombo_( rootAccount );
fillAccountCombo_(book.getRootAccount());

if ( comboAccount.getItemCount() > 0 )
{
Expand Down Expand Up @@ -867,7 +864,7 @@ private void btnProcessActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRS

Account account = (Account) comboAccount.getSelectedItem();
System.err.println( "starting transReader.parse..." );
transReader.parse( main, csvData, account, main.getRootAccount() );
transReader.parse( main, csvData, account, main.getAccountBook() );
csvReader.close();
System.out.println( "finished transReader.parse" );

Expand Down Expand Up @@ -1045,7 +1042,7 @@ private void PreviewImportBtnActionPerformed(java.awt.event.ActionEvent evt) {//
//System.err.println( "starting transReader.parse..." );
//transReader.parse( main, csvData, account, main.getRootAccount() );

transReader.setRootAccount( main.getRootAccount() );
transReader.setAccountBook(main.getAccountBook());

PreviewImportWin previewImportWin = new PreviewImportWin();
previewImportWin.myInit( this, transReader, csvData, csvReader );
Expand Down Expand Up @@ -1313,7 +1310,7 @@ protected void fileChanged()
// moving TransactionReader.customReaderDialog = customReaderDialog;

setLabel( "FindAReader", "Find Reader" );
TransactionReader[] fileFormats = TransactionReader.getCompatibleReaders( GET_COMPATIBLE_READERS, selectedFile, this, main.getRootAccount() );
TransactionReader[] fileFormats = TransactionReader.getCompatibleReaders( GET_COMPATIBLE_READERS, selectedFile, this, main.getAccountBook() );

comboFileFormat.removeAllItems();
for ( TransactionReader reader : fileFormats )
Expand Down Expand Up @@ -1422,7 +1419,7 @@ protected void fileChanged2()
// moving TransactionReader.customReaderDialog = customReaderDialog;

setLabel( "FindAReader", "Find Reader" );
TransactionReader[] fileFormats = TransactionReader.getCompatibleReaders( GET_ALL_READERS, selectedFile, this, main.getRootAccount() );
TransactionReader[] fileFormats = TransactionReader.getCompatibleReaders( GET_ALL_READERS, selectedFile, this, main.getAccountBook() );

comboFileFormat.removeAllItems();
for ( TransactionReader reader : fileFormats )
Expand Down
9 changes: 4 additions & 5 deletions src/com/moneydance/modules/features/mdcsvimporter/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
*/
package com.moneydance.modules.features.mdcsvimporter;

import com.infinitekind.moneydance.model.AccountBook;
import com.moneydance.apps.md.controller.FeatureModule;
import com.moneydance.apps.md.controller.FeatureModuleContext;
import com.moneydance.apps.md.model.RootAccount;
import java.awt.Image;
import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -50,8 +50,7 @@ public class Main
{
try
{
image = ImageIO.read(
Main.class.getResourceAsStream( "import.png" ) );
image = ImageIO.read( Main.class.getResourceAsStream( "import.png" ) );
}
catch ( IOException x )
{
Expand Down Expand Up @@ -88,10 +87,10 @@ public void init()
context.registerFeature( this, "import", image, "Import File" );
}

RootAccount getRootAccount()
AccountBook getAccountBook()
{
FeatureModuleContext context = getContext();
return context.getRootAccount();
return context.getCurrentAccountBook();
}

JFrame getMoneydanceWindow()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
package com.moneydance.modules.features.mdcsvimporter;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
*
* @author stan
*/


public class PreviewImportTblModel extends AbstractTableModel
{
private ArrayList<String>colNames;
private String[][] data;

public PreviewImportTblModel( ArrayList<String> colNamesArg, String[][] dataArg )
{
colNames = colNamesArg;
data = dataArg;

System.err.println( "row count =" + data.length );
System.err.println( "col count =" + data[0].length );
}

public int getColumnCount() { return data[0].length; }
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col)
{
//System.err.println( "getValueAt row =" + row + " col =" + col );
try {
if ( data[row][col] == "" )
{
//System.err.println( "NOT EXISTS getValueAt row =" + row + " col =" + col );
}
}
catch( Exception ex )
{
return "";
}
return data[row][col];
}

public String getColumnName(int col) {
return colNames.get( col );
}

/*
public int getColumnCount() { return 10; }
public int getRowCount() { return 10;}
public Object getValueAt(int row, int col) { return new Integer(row*col); }
*/
}
package com.moneydance.modules.features.mdcsvimporter;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
*
* @author stan
*/


public class PreviewImportTblModel extends AbstractTableModel
{
private ArrayList<String>colNames;
private String[][] data;

public PreviewImportTblModel( ArrayList<String> colNamesArg, String[][] dataArg )
{
colNames = colNamesArg;
data = dataArg;

System.err.println( "row count =" + data.length );
System.err.println( "col count =" + data[0].length );
}

public int getColumnCount() { return data[0].length; }
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col)
{
//System.err.println( "getValueAt row =" + row + " col =" + col );
try {
if ( data[row][col] == "" )
{
//System.err.println( "NOT EXISTS getValueAt row =" + row + " col =" + col );
}
}
catch( Exception ex )
{
return "";
}
return data[row][col];
}

public String getColumnName(int col) {
return colNames.get( col );
}

/*
public int getColumnCount() { return 10; }
public int getRowCount() { return 10;}
public Object getValueAt(int row, int col) { return new Integer(row*col); }
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void myInit( ImportDialog importDialog, TransactionReader transReaderArg,
for ( ; fieldIndex < maxFieldIndex; fieldIndex ++ )
{
String dataTypeExpecting = transReader.getCustomReaderData().getDataTypesList().get( fieldIndex );
System.err.println( "dataTypeExpecting =" + dataTypeExpecting + "= fieldIndex = " + fieldIndex );
//System.err.println( "dataTypeExpecting =" + dataTypeExpecting + "= fieldIndex = " + fieldIndex );

if ( dataTypeExpecting.equalsIgnoreCase( DATA_TYPE_IGNORE_REST ) )
{
Expand Down
Loading

0 comments on commit 1b19b71

Please sign in to comment.