IDEMPIERE-4723 - Clean up dead code in compiere/print (#1039)
* IDEMPIERE-4723 - Clean up dead code in compiere/print * IDEMPIERE-4723 - Clean up dead code in compiere/print
This commit is contained in:
parent
83c4b16882
commit
5c675536cd
|
@ -63,14 +63,6 @@ public class ArchiveEngine
|
||||||
String aa = aaClient;
|
String aa = aaClient;
|
||||||
if (aa == null)
|
if (aa == null)
|
||||||
aa = MClient.AUTOARCHIVE_None;
|
aa = MClient.AUTOARCHIVE_None;
|
||||||
/* String aaRole = null; // role.getAutoArchive(); // TODO
|
|
||||||
if (aaRole != null)
|
|
||||||
{
|
|
||||||
if (aaRole.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
|
|
||||||
aa = aaRole;
|
|
||||||
else if (aaRole.equals(MClient.AUTOARCHIVE_Documents) && !aaClient.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
|
|
||||||
aa = aaRole;
|
|
||||||
}*/
|
|
||||||
// Nothing to Archive
|
// Nothing to Archive
|
||||||
if (aa.equals(MClient.AUTOARCHIVE_None))
|
if (aa.equals(MClient.AUTOARCHIVE_None))
|
||||||
return null;
|
return null;
|
||||||
|
@ -113,14 +105,6 @@ public class ArchiveEngine
|
||||||
String aa = aaClient;
|
String aa = aaClient;
|
||||||
if (aa == null)
|
if (aa == null)
|
||||||
aa = MClient.AUTOARCHIVE_None;
|
aa = MClient.AUTOARCHIVE_None;
|
||||||
/* String aaRole = null; // role.getAutoArchive(); // TODO
|
|
||||||
if (aaRole != null)
|
|
||||||
{
|
|
||||||
if (aaRole.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
|
|
||||||
aa = aaRole;
|
|
||||||
else if (aaRole.equals(MClient.AUTOARCHIVE_Documents) && !aaClient.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
|
|
||||||
aa = aaRole;
|
|
||||||
}*/
|
|
||||||
// Nothing to Archive
|
// Nothing to Archive
|
||||||
if (aa.equals(MClient.AUTOARCHIVE_None))
|
if (aa.equals(MClient.AUTOARCHIVE_None))
|
||||||
return;
|
return;
|
||||||
|
@ -207,10 +191,4 @@ public class ArchiveEngine
|
||||||
if (s_engine == null)
|
if (s_engine == null)
|
||||||
s_engine = this;
|
s_engine = this;
|
||||||
} // ArchiveEngine
|
} // ArchiveEngine
|
||||||
|
|
||||||
/** The base document */
|
|
||||||
// private PDFDocument m_document = Document.createBlank();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // ArchiveEngine
|
} // ArchiveEngine
|
||||||
|
|
|
@ -218,7 +218,6 @@ public class CPaper extends Paper
|
||||||
{
|
{
|
||||||
MediaPrintableArea area = new MediaPrintableArea ((float)getImageableX()/72, (float)getImageableY()/72,
|
MediaPrintableArea area = new MediaPrintableArea ((float)getImageableX()/72, (float)getImageableY()/72,
|
||||||
(float)getImageableWidth()/72, (float)getImageableHeight()/72, MediaPrintableArea.INCH);
|
(float)getImageableWidth()/72, (float)getImageableHeight()/72, MediaPrintableArea.INCH);
|
||||||
// log.fine( "CPaper.getMediaPrintableArea", area.toString(MediaPrintableArea.INCH, "\""));
|
|
||||||
return area;
|
return area;
|
||||||
} // getMediaPrintableArea
|
} // getMediaPrintableArea
|
||||||
|
|
||||||
|
@ -274,10 +273,6 @@ public class CPaper extends Paper
|
||||||
pratts.add(OrientationRequested.LANDSCAPE);
|
pratts.add(OrientationRequested.LANDSCAPE);
|
||||||
else
|
else
|
||||||
pratts.add(OrientationRequested.PORTRAIT);
|
pratts.add(OrientationRequested.PORTRAIT);
|
||||||
// media = na-legal
|
|
||||||
//Commented Lines By AA Goodwill: Custom Paper Support
|
|
||||||
//pratts.add(getMediaSizeName());
|
|
||||||
//End Of AA Goodwill
|
|
||||||
|
|
||||||
return pratts;
|
return pratts;
|
||||||
} // getPrintRequestAttributes
|
} // getPrintRequestAttributes
|
||||||
|
|
|
@ -346,7 +346,6 @@ public class DataEngine
|
||||||
int FieldLength = rs.getInt(5);
|
int FieldLength = rs.getInt(5);
|
||||||
boolean IsMandatory = "Y".equals(rs.getString(6));
|
boolean IsMandatory = "Y".equals(rs.getString(6));
|
||||||
boolean IsKey = "Y".equals(rs.getString(7));
|
boolean IsKey = "Y".equals(rs.getString(7));
|
||||||
//boolean IsParent = "Y".equals(rs.getString(8));
|
|
||||||
// SQL GroupBy
|
// SQL GroupBy
|
||||||
boolean IsGroupFunction = "Y".equals(rs.getString(9));
|
boolean IsGroupFunction = "Y".equals(rs.getString(9));
|
||||||
if (IsGroupFunction)
|
if (IsGroupFunction)
|
||||||
|
@ -377,7 +376,7 @@ public class DataEngine
|
||||||
|
|
||||||
// General Info
|
// General Info
|
||||||
boolean IsPrinted = "Y".equals(rs.getString(15));
|
boolean IsPrinted = "Y".equals(rs.getString(15));
|
||||||
//int SortNo = rs.getInt(16);
|
|
||||||
boolean isPageBreak = "Y".equals(rs.getString(17));
|
boolean isPageBreak = "Y".equals(rs.getString(17));
|
||||||
|
|
||||||
String formatPattern = rs.getString(25);
|
String formatPattern = rs.getString(25);
|
||||||
|
@ -430,8 +429,7 @@ public class DataEngine
|
||||||
synonymNext();
|
synonymNext();
|
||||||
}
|
}
|
||||||
// -- Parent, TableDir (and unqualified Search) --
|
// -- Parent, TableDir (and unqualified Search) --
|
||||||
else if ( /* (IsParent && DisplayType.isLookup(AD_Reference_ID)) || <-- IDEMPIERE-71 Carlos Ruiz - globalqss */
|
else if ( AD_Reference_ID == DisplayType.TableDir
|
||||||
AD_Reference_ID == DisplayType.TableDir
|
|
||||||
|| (AD_Reference_ID == DisplayType.Search && AD_Reference_Value_ID == 0)
|
|| (AD_Reference_ID == DisplayType.Search && AD_Reference_Value_ID == 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -1003,7 +1001,6 @@ public class DataEngine
|
||||||
{
|
{
|
||||||
if (pdc.getColumnName().endsWith("_ID"))
|
if (pdc.getColumnName().endsWith("_ID"))
|
||||||
{
|
{
|
||||||
// int id = rs.getInt(pdc.getColumnIDName());
|
|
||||||
int id = rs.getInt(counter++);
|
int id = rs.getInt(counter++);
|
||||||
if (!rs.wasNull())
|
if (!rs.wasNull())
|
||||||
{
|
{
|
||||||
|
@ -1014,7 +1011,6 @@ public class DataEngine
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// String id = rs.getString(pdc.getColumnIDName());
|
|
||||||
String id = rs.getString(counter++);
|
String id = rs.getString(counter++);
|
||||||
if (!rs.wasNull())
|
if (!rs.wasNull())
|
||||||
{
|
{
|
||||||
|
@ -1383,14 +1379,10 @@ public class DataEngine
|
||||||
{
|
{
|
||||||
org.compiere.Adempiere.startup(true);
|
org.compiere.Adempiere.startup(true);
|
||||||
|
|
||||||
// DataEngine de = new DataEngine(null);
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
DataEngine de = new DataEngine(Language.getLanguage("de_DE"));
|
DataEngine de = new DataEngine(Language.getLanguage("de_DE"));
|
||||||
MQuery query = new MQuery();
|
MQuery query = new MQuery();
|
||||||
query.addRestriction("AD_Table_ID", MQuery.LESS, 105);
|
query.addRestriction("AD_Table_ID", MQuery.LESS, 105);
|
||||||
// PrintData pd = de.load_fromTable(100, query, null, null, false);
|
|
||||||
// pd.dump();
|
|
||||||
// pd.createXML(new javax.xml.transform.stream.StreamResult(System.out));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // DataEngine
|
} // DataEngine
|
||||||
|
|
|
@ -221,7 +221,6 @@ public class MPrintColor extends X_AD_PrintColor implements ImmutablePOSupport
|
||||||
}
|
}
|
||||||
if (code == null)
|
if (code == null)
|
||||||
m_cacheColor = Color.black;
|
m_cacheColor = Color.black;
|
||||||
// log.fine( "MPrintColor.getColor " + code, m_cacheColor);
|
|
||||||
return m_cacheColor;
|
return m_cacheColor;
|
||||||
} // getColor
|
} // getColor
|
||||||
|
|
||||||
|
@ -295,17 +294,6 @@ public class MPrintColor extends X_AD_PrintColor implements ImmutablePOSupport
|
||||||
System.out.println(names[i] + " = " + colors[i] + " RGB=" + colors[i].getRGB()
|
System.out.println(names[i] + " = " + colors[i] + " RGB=" + colors[i].getRGB()
|
||||||
+ " -> " + new Color(colors[i].getRGB(), false)
|
+ " -> " + new Color(colors[i].getRGB(), false)
|
||||||
+ " -> " + new Color(colors[i].getRGB(), true));
|
+ " -> " + new Color(colors[i].getRGB(), true));
|
||||||
/**
|
|
||||||
// Create Colors
|
|
||||||
for (int i = 0; i < colors.length; i++)
|
|
||||||
create(colors[i], names[i]);
|
|
||||||
create(whiteGray, "Gray white");
|
|
||||||
create(darkGreen, "Green dark");
|
|
||||||
create(blackGreen, "Green black");
|
|
||||||
create(blackBlue, "Blue black");
|
|
||||||
create(brown, "Brown");
|
|
||||||
create(darkBrown, "Brown dark");
|
|
||||||
**/
|
|
||||||
|
|
||||||
// Read All Colors
|
// Read All Colors
|
||||||
int[] IDs = PO.getAllIDs ("AD_PrintColor", null, null);
|
int[] IDs = PO.getAllIDs ("AD_PrintColor", null, null);
|
||||||
|
|
|
@ -121,7 +121,6 @@ public class MPrintFont extends X_AD_PrintFont implements ImmutablePOSupport
|
||||||
}
|
}
|
||||||
if (code == null)
|
if (code == null)
|
||||||
m_cacheFont = new Font (null); // family=dialog,name=Dialog,style=plain,size=12
|
m_cacheFont = new Font (null); // family=dialog,name=Dialog,style=plain,size=12
|
||||||
// log.fine( "MPrintFont.getFont " + code, m_cacheFont);
|
|
||||||
return m_cacheFont;
|
return m_cacheFont;
|
||||||
} // getFont
|
} // getFont
|
||||||
|
|
||||||
|
@ -279,24 +278,6 @@ public class MPrintFont extends X_AD_PrintFont implements ImmutablePOSupport
|
||||||
MPrintFont pf = new MPrintFont(Env.getCtx(), 100, null);
|
MPrintFont pf = new MPrintFont(Env.getCtx(), 100, null);
|
||||||
dump( pf.getFont() );
|
dump( pf.getFont() );
|
||||||
|
|
||||||
String[] systemLocical = new String[] {"Dialog", "DialogInput", "Monospaced", "Serif", "SansSerif"};
|
|
||||||
for (int i = 0; i < systemLocical.length; i++)
|
|
||||||
{
|
|
||||||
// create(new Font(systemLocical[i], Font.BOLD, 13));
|
|
||||||
// create(new Font(systemLocical[i], Font.PLAIN, 11));
|
|
||||||
// create(new Font(systemLocical[i], Font.BOLD, 11));
|
|
||||||
// create(new Font(systemLocical[i], Font.ITALIC, 11));
|
|
||||||
// create(new Font(systemLocical[i], Font.PLAIN, 10));
|
|
||||||
// create(new Font(systemLocical[i], Font.BOLD, 10));
|
|
||||||
// create(new Font(systemLocical[i], Font.ITALIC, 10));
|
|
||||||
// create(new Font(systemLocical[i], Font.PLAIN, 9));
|
|
||||||
// create(new Font(systemLocical[i], Font.BOLD, 9));
|
|
||||||
// create(new Font(systemLocical[i], Font.ITALIC, 9));
|
|
||||||
// create(new Font(systemLocical[i], Font.PLAIN, 8));
|
|
||||||
// create(new Font(systemLocical[i], Font.BOLD, 8));
|
|
||||||
// create(new Font(systemLocical[i], Font.ITALIC, 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read All Fonts
|
// Read All Fonts
|
||||||
int[] IDs = PO.getAllIDs ("AD_PrintFont", null, null);
|
int[] IDs = PO.getAllIDs ("AD_PrintFont", null, null);
|
||||||
for (int i = 0; i < IDs.length; i++)
|
for (int i = 0; i < IDs.length; i++)
|
||||||
|
|
|
@ -169,7 +169,6 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
|
||||||
if (language != null)
|
if (language != null)
|
||||||
{
|
{
|
||||||
m_language = language;
|
m_language = language;
|
||||||
// log.fine("setLanguage - " + language);
|
|
||||||
}
|
}
|
||||||
m_translationViewLanguage = null;
|
m_translationViewLanguage = null;
|
||||||
} // getLanguage
|
} // getLanguage
|
||||||
|
@ -516,8 +515,6 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
|
||||||
*/
|
*/
|
||||||
protected Object loadSpecial (ResultSet rs, int index) throws SQLException
|
protected Object loadSpecial (ResultSet rs, int index) throws SQLException
|
||||||
{
|
{
|
||||||
// CreateCopy
|
|
||||||
// log.config(p_info.getColumnName(index));
|
|
||||||
return null;
|
return null;
|
||||||
} // loadSpecial
|
} // loadSpecial
|
||||||
|
|
||||||
|
@ -530,11 +527,6 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
|
||||||
*/
|
*/
|
||||||
protected String saveNewSpecial (Object value, int index)
|
protected String saveNewSpecial (Object value, int index)
|
||||||
{
|
{
|
||||||
// CreateCopy
|
|
||||||
// String colName = p_info.getColumnName(index);
|
|
||||||
// String colClass = p_info.getColumnClass(index).toString();
|
|
||||||
// String colValue = value == null ? "null" : value.getClass().toString();
|
|
||||||
// log.log(Level.SEVERE, "Unknown class for column " + colName + " (" + colClass + ") - Value=" + colValue);
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return "NULL";
|
return "NULL";
|
||||||
return value.toString();
|
return value.toString();
|
||||||
|
@ -780,7 +772,6 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
|
||||||
|
|
||||||
// Save & complete
|
// Save & complete
|
||||||
pf.saveEx();
|
pf.saveEx();
|
||||||
// pf.dump();
|
|
||||||
pf.setItems (createItems(ctx, pf));
|
pf.setItems (createItems(ctx, pf));
|
||||||
//
|
//
|
||||||
return pf;
|
return pf;
|
||||||
|
@ -856,7 +847,6 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
|
||||||
|
|
||||||
// Save & complete
|
// Save & complete
|
||||||
pf.saveEx();
|
pf.saveEx();
|
||||||
// pf.dump();
|
|
||||||
pf.setItems (createItems(ctx, pf));
|
pf.setItems (createItems(ctx, pf));
|
||||||
//
|
//
|
||||||
return pf;
|
return pf;
|
||||||
|
@ -1363,26 +1353,4 @@ public class MPrintFormat extends X_AD_PrintFormat implements ImmutablePOSupport
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Test
|
|
||||||
* @param args arga
|
|
||||||
*/
|
|
||||||
static public void main (String[] args)
|
|
||||||
{
|
|
||||||
org.compiere.Adempiere.startup(true);
|
|
||||||
/**
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 496); // Order
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 497);
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 516); // Invoice
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 495);
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 500); // Shipment
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 501);
|
|
||||||
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 498); // Check
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 499);
|
|
||||||
MPrintFormat.createFromTable(Env.getCtx(), 498); // Remittance
|
|
||||||
**/
|
|
||||||
} // main
|
|
||||||
|
|
||||||
|
|
||||||
} // MPrintFormat
|
} // MPrintFormat
|
||||||
|
|
|
@ -757,7 +757,6 @@ public class MPrintFormatItem extends X_AD_PrintFormatItem implements ImmutableP
|
||||||
{
|
{
|
||||||
// Set Translation from Element
|
// Set Translation from Element
|
||||||
if (newRecord
|
if (newRecord
|
||||||
// && MClient.get(getCtx()).isMultiLingualDocument()
|
|
||||||
&& getPrintName() != null && getPrintName().length() > 0)
|
&& getPrintName() != null && getPrintName().length() > 0)
|
||||||
{
|
{
|
||||||
String sql = "UPDATE AD_PrintFormatItem_Trl "
|
String sql = "UPDATE AD_PrintFormatItem_Trl "
|
||||||
|
|
|
@ -26,7 +26,6 @@ import javax.print.attribute.standard.MediaSize;
|
||||||
import javax.print.attribute.standard.MediaSizeName;
|
import javax.print.attribute.standard.MediaSizeName;
|
||||||
|
|
||||||
import org.adempiere.exceptions.AdempiereException;
|
import org.adempiere.exceptions.AdempiereException;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.model.X_AD_PrintPaper;
|
import org.compiere.model.X_AD_PrintPaper;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -324,25 +323,4 @@ public class MPrintPaper extends X_AD_PrintPaper implements ImmutablePOSupport
|
||||||
}
|
}
|
||||||
} // CMediaSizeName
|
} // CMediaSizeName
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Test
|
|
||||||
* @param args args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
org.compiere.Adempiere.startupEnvironment(true);
|
|
||||||
|
|
||||||
// create ("Standard Landscape", true);
|
|
||||||
// create ("Standard Portrait", false);
|
|
||||||
|
|
||||||
// Read All Papers
|
|
||||||
int[] IDs = PO.getAllIDs ("AD_PrintPaper", null, null);
|
|
||||||
for (int i = 0; i < IDs.length; i++)
|
|
||||||
{
|
|
||||||
System.out.println("--");
|
|
||||||
MPrintPaper pp = new MPrintPaper(Env.getCtx(), IDs[i], null);
|
|
||||||
pp.dump();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} // MPrintPaper
|
} // MPrintPaper
|
||||||
|
|
|
@ -66,7 +66,6 @@ public class MPrintTableFormat extends X_AD_PrintTableFormat implements Immutabl
|
||||||
super (ctx, AD_PrintTableFormat_ID, trxName);
|
super (ctx, AD_PrintTableFormat_ID, trxName);
|
||||||
if (AD_PrintTableFormat_ID == 0)
|
if (AD_PrintTableFormat_ID == 0)
|
||||||
{
|
{
|
||||||
// setName (null);
|
|
||||||
setIsDefault (false);
|
setIsDefault (false);
|
||||||
setIsPaintHeaderLines (true); // Y
|
setIsPaintHeaderLines (true); // Y
|
||||||
setIsPaintBoundaryLines (false);
|
setIsPaintBoundaryLines (false);
|
||||||
|
|
|
@ -531,7 +531,6 @@ public class PrintData implements Serializable
|
||||||
log.log(Level.SEVERE, "Element not PrintData(Element) " + o.getClass().getName());
|
log.log(Level.SEVERE, "Element not PrintData(Element) " + o.getClass().getName());
|
||||||
}
|
}
|
||||||
// As Data is stored sparse, there might be lots of NULL values
|
// As Data is stored sparse, there might be lots of NULL values
|
||||||
// log.log(Level.SEVERE, "PrintData.getIndex - Element not found - " + name);
|
|
||||||
return -1;
|
return -1;
|
||||||
} // getIndex
|
} // getIndex
|
||||||
|
|
||||||
|
@ -582,7 +581,6 @@ public class PrintData implements Serializable
|
||||||
log.log(Level.SEVERE, "Element not PrintData(Element) " + o.getClass().getName());
|
log.log(Level.SEVERE, "Element not PrintData(Element) " + o.getClass().getName());
|
||||||
}
|
}
|
||||||
// As Data is stored sparse, there might be lots of NULL values
|
// As Data is stored sparse, there might be lots of NULL values
|
||||||
// log.log(Level.SEVERE, "PrintData.getIndex - Element not found - " + name);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print Format Utilities.
|
* Print Format Utilities.
|
||||||
|
@ -140,30 +139,11 @@ public class PrintFormatUtil
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
if (counter == 0) {
|
if (counter == 0) {
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("None"
|
if (log.isLoggable(Level.FINE)) log.fine("None");
|
||||||
/**
|
|
||||||
+ " - " + sql
|
|
||||||
+ " - AD_PrintFormat_ID=" + pf.getAD_PrintFormat_ID()
|
|
||||||
+ " - AD_Table_ID=" + pf.getAD_Table_ID()
|
|
||||||
*/
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Added=" + counter);
|
if (log.isLoggable(Level.FINE)) log.fine("Added=" + counter);
|
||||||
}
|
}
|
||||||
return counter;
|
return counter;
|
||||||
} // addMissingColumns
|
} // addMissingColumns
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* Main
|
|
||||||
* @param args arguments
|
|
||||||
*/
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
org.compiere.Adempiere.startupEnvironment(true);
|
|
||||||
//
|
|
||||||
PrintFormatUtil pfu = new PrintFormatUtil (Env.getCtx());
|
|
||||||
pfu.addMissingColumns((String)null);
|
|
||||||
} // main
|
|
||||||
|
|
||||||
} // PrintFormatUtils
|
} // PrintFormatUtils
|
||||||
|
|
|
@ -28,7 +28,6 @@ import static org.compiere.model.SystemIDs.PRINTFORMAT_PAYSELECTION_REMITTANCE__
|
||||||
|
|
||||||
import java.awt.print.PageFormat;
|
import java.awt.print.PageFormat;
|
||||||
import java.awt.print.Pageable;
|
import java.awt.print.Pageable;
|
||||||
import java.awt.print.PrinterException;
|
|
||||||
import java.awt.print.PrinterJob;
|
import java.awt.print.PrinterJob;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -47,7 +46,6 @@ import javax.print.attribute.standard.JobName;
|
||||||
import javax.print.attribute.standard.JobPriority;
|
import javax.print.attribute.standard.JobPriority;
|
||||||
import javax.print.attribute.standard.OrientationRequested;
|
import javax.print.attribute.standard.OrientationRequested;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import org.compiere.util.CLogMgt;
|
import org.compiere.util.CLogMgt;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
@ -143,7 +141,6 @@ public class PrintUtil
|
||||||
printerName = Ini.getProperty(Ini.P_PRINTER);
|
printerName = Ini.getProperty(Ini.P_PRINTER);
|
||||||
if (printerName != null && printerName.length() != 0)
|
if (printerName != null && printerName.length() != 0)
|
||||||
{
|
{
|
||||||
// System.out.println("CPrinter.getPrinterJob - searching " + printerName);
|
|
||||||
PrintService[] services = getAllPrintServices();
|
PrintService[] services = getAllPrintServices();
|
||||||
for (int i = 0; i < services.length; i++)
|
for (int i = 0; i < services.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -151,10 +148,8 @@ public class PrintUtil
|
||||||
if (printerName.equals(serviceName))
|
if (printerName.equals(serviceName))
|
||||||
{
|
{
|
||||||
ps = services[i];
|
ps = services[i];
|
||||||
// System.out.println("CPrinter.getPrinterJob - found " + printerName);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// System.out.println("CPrinter.getPrinterJob - not: " + serviceName);
|
|
||||||
}
|
}
|
||||||
} // find printer service
|
} // find printer service
|
||||||
|
|
||||||
|
@ -432,116 +427,6 @@ public class PrintUtil
|
||||||
}
|
}
|
||||||
} // dump
|
} // dump
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Print Services
|
|
||||||
*/
|
|
||||||
private static void testPS()
|
|
||||||
{
|
|
||||||
PrintService ps = getDefaultPrintService();
|
|
||||||
ServiceUIFactory factory = ps.getServiceUIFactory();
|
|
||||||
System.out.println(factory);
|
|
||||||
if (factory != null)
|
|
||||||
{
|
|
||||||
System.out.println("Factory");
|
|
||||||
JPanel p0 = (JPanel) factory.getUI(ServiceUIFactory.ABOUT_UIROLE, ServiceUIFactory.JDIALOG_UI);
|
|
||||||
p0.setVisible(true);
|
|
||||||
JPanel p1 = (JPanel) factory.getUI(ServiceUIFactory.ADMIN_UIROLE, ServiceUIFactory.JDIALOG_UI);
|
|
||||||
p1.setVisible(true);
|
|
||||||
JPanel p2 = (JPanel) factory.getUI(ServiceUIFactory.MAIN_UIROLE, ServiceUIFactory.JDIALOG_UI);
|
|
||||||
p2.setVisible(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
System.out.println("1----------");
|
|
||||||
PrinterJob pj = PrinterJob.getPrinterJob();
|
|
||||||
PrintRequestAttributeSet pratts = getDefaultPrintRequestAttributes();
|
|
||||||
// Page Dialog
|
|
||||||
PageFormat pf = pj.pageDialog(pratts);
|
|
||||||
System.out.println("Pratts Size = " + pratts.size());
|
|
||||||
Attribute[] atts = pratts.toArray();
|
|
||||||
for (int i = 0; i < atts.length; i++)
|
|
||||||
System.out.println(atts[i].getName() + " = " + atts[i] + " - " + atts[i].getCategory());
|
|
||||||
System.out.println("PageFormat h=" + pf.getHeight() + ",w=" + pf.getWidth() + " - x=" + pf.getImageableX() + ",y=" + pf.getImageableY() + " - ih=" + pf.getImageableHeight() + ",iw=" + pf.getImageableWidth()
|
|
||||||
+ " - Orient=" + pf.getOrientation());
|
|
||||||
ps = pj.getPrintService();
|
|
||||||
System.out.println("PrintService = " + ps.getName());
|
|
||||||
|
|
||||||
// Print Dialog
|
|
||||||
System.out.println("2----------");
|
|
||||||
pj.printDialog(pratts);
|
|
||||||
System.out.println("Pratts Size = " + pratts.size());
|
|
||||||
atts = pratts.toArray();
|
|
||||||
for (int i = 0; i < atts.length; i++)
|
|
||||||
System.out.println(atts[i].getName() + " = " + atts[i] + " - " + atts[i].getCategory());
|
|
||||||
pf = pj.defaultPage();
|
|
||||||
System.out.println("PageFormat h=" + pf.getHeight() + ",w=" + pf.getWidth() + " - x=" + pf.getImageableX() + ",y=" + pf.getImageableY() + " - ih=" + pf.getImageableHeight() + ",iw=" + pf.getImageableWidth()
|
|
||||||
+ " - Orient=" + pf.getOrientation());
|
|
||||||
ps = pj.getPrintService();
|
|
||||||
System.out.println("PrintService= " + ps.getName());
|
|
||||||
|
|
||||||
System.out.println("3----------");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
pj.setPrintService(ps);
|
|
||||||
}
|
|
||||||
catch (PrinterException pe)
|
|
||||||
{
|
|
||||||
System.out.println(pe);
|
|
||||||
}
|
|
||||||
pf = pj.validatePage(pf);
|
|
||||||
System.out.println("PageFormat h=" + pf.getHeight() + ",w=" + pf.getWidth() + " - x=" + pf.getImageableX() + ",y=" + pf.getImageableY() + " - ih=" + pf.getImageableHeight() + ",iw=" + pf.getImageableWidth()
|
|
||||||
+ " - Orient=" + pf.getOrientation());
|
|
||||||
ps = pj.getPrintService();
|
|
||||||
System.out.println("PrintService= " + ps.getName());
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("4----------");
|
|
||||||
pj.printDialog();
|
|
||||||
} // testPS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test Stream Print Services
|
|
||||||
*/
|
|
||||||
/*private static void testSPS()
|
|
||||||
{
|
|
||||||
// dump (DocFlavor.INPUT_STREAM.GIF, DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
|
|
||||||
// dump (DocFlavor.SERVICE_FORMATTED.PAGEABLE, DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
|
|
||||||
// dump (DocFlavor.INPUT_STREAM.GIF, DocFlavor.BYTE_ARRAY.PDF.getMimeType());
|
|
||||||
// dump (DocFlavor.SERVICE_FORMATTED.PAGEABLE, DocFlavor.BYTE_ARRAY.GIF.getMediaSubtype());
|
|
||||||
// dump (DocFlavor.SERVICE_FORMATTED.PAGEABLE, DocFlavor.BYTE_ARRAY.JPEG.getMediaSubtype());
|
|
||||||
|
|
||||||
// dump (DocFlavor.SERVICE_FORMATTED.PAGEABLE); // lists devices able to output pageable
|
|
||||||
// dump (DocFlavor.SERVICE_FORMATTED.PRINTABLE);
|
|
||||||
// dump (DocFlavor.INPUT_STREAM.TEXT_PLAIN_HOST);
|
|
||||||
// dump (DocFlavor.INPUT_STREAM.POSTSCRIPT);
|
|
||||||
|
|
||||||
|
|
||||||
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
|
|
||||||
PrintService[] pss =
|
|
||||||
PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PAGEABLE, pras);
|
|
||||||
for (int i = 0; i < pss.length; i++)
|
|
||||||
{
|
|
||||||
PrintService ps = pss[i];
|
|
||||||
String name = ps.getName();
|
|
||||||
if (name.indexOf("PDF") != -1 || name.indexOf("Acrobat") != -1)
|
|
||||||
{
|
|
||||||
System.out.println("----");
|
|
||||||
System.out.println(ps);
|
|
||||||
Class<?>[] cat = ps.getSupportedAttributeCategories();
|
|
||||||
for (int j = 0; j < cat.length; j++)
|
|
||||||
{
|
|
||||||
System.out.println("- " + cat[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// dump (null, DocFlavor.BYTE_ARRAY.PDF.getMimeType()); // lists PDF output
|
|
||||||
// dump (null, DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMediaType()); // lists PS output
|
|
||||||
|
|
||||||
// dump(null, null);
|
|
||||||
} // testSPS*/
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Create Print Form & Print Formats for a new Client.
|
* Create Print Form & Print Formats for a new Client.
|
||||||
* - Order, Invoice, etc.
|
* - Order, Invoice, etc.
|
||||||
|
@ -587,7 +472,7 @@ public class PrintUtil
|
||||||
updatePrintFormatHeader(Remittance_PrintFormat_ID, RemittanceLine_PrintFormat_ID, trxName);
|
updatePrintFormatHeader(Remittance_PrintFormat_ID, RemittanceLine_PrintFormat_ID, trxName);
|
||||||
|
|
||||||
// TODO: MPrintForm
|
// TODO: MPrintForm
|
||||||
// MPrintForm form = new MPrintForm();
|
|
||||||
int AD_PrintForm_ID = DB.getNextID (AD_Client_ID, "AD_PrintForm", null);
|
int AD_PrintForm_ID = DB.getNextID (AD_Client_ID, "AD_PrintForm", null);
|
||||||
String sql = "INSERT INTO AD_PrintForm(AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_PrintForm_ID,"
|
String sql = "INSERT INTO AD_PrintForm(AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_PrintForm_ID,"
|
||||||
+ "Name,Order_PrintFormat_ID,Invoice_PrintFormat_ID,Remittance_PrintFormat_ID,Shipment_PrintFormat_ID)"
|
+ "Name,Order_PrintFormat_ID,Invoice_PrintFormat_ID,Remittance_PrintFormat_ID,Shipment_PrintFormat_ID)"
|
||||||
|
@ -620,24 +505,4 @@ public class PrintUtil
|
||||||
int no = DB.executeUpdate(sb.toString(), trxName);
|
int no = DB.executeUpdate(sb.toString(), trxName);
|
||||||
} // updatePrintFormatHeader
|
} // updatePrintFormatHeader
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test
|
|
||||||
* @param args arg
|
|
||||||
*/
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
// org.compiere.Adempiere.startupClient();
|
|
||||||
// setupPrintForm (11);
|
|
||||||
// setupPrintForm (1000000);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
testPS(); // Print Services
|
|
||||||
// testSPS(); // Stream Print Services
|
|
||||||
|
|
||||||
// dumpSPS(null, null);
|
|
||||||
} // main
|
|
||||||
|
|
||||||
} // PrintUtil
|
} // PrintUtil
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.compiere.print;
|
||||||
|
|
||||||
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY;
|
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_INVENTORY;
|
||||||
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_MOVEMENT;
|
import static org.compiere.model.SystemIDs.PROCESS_RPT_M_MOVEMENT;
|
||||||
import static org.compiere.model.SystemIDs.TABLE_AD_TABLE;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
@ -466,7 +465,6 @@ public class ReportEngine implements PrintServiceAttributeListener
|
||||||
if (log.isLoggable(Level.INFO)) log.info("Copy " + (m_info.getCopies()-1));
|
if (log.isLoggable(Level.INFO)) log.info("Copy " + (m_info.getCopies()-1));
|
||||||
prats.add(new Copies(m_info.getCopies()-1));
|
prats.add(new Copies(m_info.getCopies()-1));
|
||||||
job = getPrinterJob(m_info.getPrinterName());
|
job = getPrinterJob(m_info.getPrinterName());
|
||||||
// job.getPrintService().addPrintServiceAttributeListener(this);
|
|
||||||
job.setPageable (m_layout.getPageable(true)); // Copy
|
job.setPageable (m_layout.getPageable(true)); // Copy
|
||||||
PrintUtil.print(job, prats, false, false);
|
PrintUtil.print(job, prats, false, false);
|
||||||
}
|
}
|
||||||
|
@ -496,7 +494,6 @@ PrintServiceAttributeSet - length=1
|
||||||
queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
**/
|
**/
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("attributeUpdate - " + psae);
|
if (log.isLoggable(Level.FINE)) log.fine("attributeUpdate - " + psae);
|
||||||
// PrintUtil.dump (psae.getAttributes());
|
|
||||||
} // attributeUpdate
|
} // attributeUpdate
|
||||||
|
|
||||||
|
|
||||||
|
@ -1866,12 +1863,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
/** Inventory Move = 11 */
|
/** Inventory Move = 11 */
|
||||||
public static final int MOVEMENT = 11;
|
public static final int MOVEMENT = 11;
|
||||||
|
|
||||||
|
|
||||||
// private static final String[] DOC_TABLES = new String[] {
|
|
||||||
// "C_Order_Header_v", "M_InOut_Header_v", "C_Invoice_Header_v", "C_Project_Header_v",
|
|
||||||
// "C_RfQResponse_v",
|
|
||||||
// "C_PaySelection_Check_v", "C_PaySelection_Check_v",
|
|
||||||
// "C_DunningRunEntry_v","PP_Order_Header_v","DD_Order_Header_v" };
|
|
||||||
private static final String[] DOC_BASETABLES = new String[] {
|
private static final String[] DOC_BASETABLES = new String[] {
|
||||||
"C_Order", "M_InOut", "C_Invoice", "C_Project",
|
"C_Order", "M_InOut", "C_Invoice", "C_Project",
|
||||||
"C_RfQResponse",
|
"C_RfQResponse",
|
||||||
|
@ -2122,7 +2113,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
// query
|
// query
|
||||||
MQuery query = new MQuery(format.getAD_Table_ID());
|
MQuery query = new MQuery(format.getAD_Table_ID());
|
||||||
query.addRestriction(DOC_IDS[type], MQuery.EQUAL, Record_ID);
|
query.addRestriction(DOC_IDS[type], MQuery.EQUAL, Record_ID);
|
||||||
// log.config( "ReportCtrl.startDocumentPrint - " + format, query + " - " + language.getAD_Language());
|
|
||||||
//
|
//
|
||||||
if (DocumentNo == null || DocumentNo.length() == 0)
|
if (DocumentNo == null || DocumentNo.length() == 0)
|
||||||
DocumentNo = "DocPrint";
|
DocumentNo = "DocPrint";
|
||||||
|
@ -2218,7 +2209,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
// if (i == 1 && ADialog.ask(0, null, what[0] == INVOICE ? "PrintOnlyRecentInvoice?" : "PrintOnlyRecentShipment?")) break;
|
|
||||||
what[1] = rs.getInt(1);
|
what[1] = rs.getInt(1);
|
||||||
}
|
}
|
||||||
else // No Document Found
|
else // No Document Found
|
||||||
|
@ -2258,38 +2248,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
log.log(Level.SEVERE, "Updated records=" + no + " - should be just one");
|
log.log(Level.SEVERE, "Updated records=" + no + " - should be just one");
|
||||||
}
|
}
|
||||||
} // printConfirm
|
} // printConfirm
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
* Test
|
|
||||||
* @param args args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
org.compiere.Adempiere.startupEnvironment(true);
|
|
||||||
//
|
|
||||||
int AD_Table_ID = TABLE_AD_TABLE;
|
|
||||||
MQuery q = new MQuery("AD_Table");
|
|
||||||
q.addRestriction("AD_Table_ID", "<", 108);
|
|
||||||
//
|
|
||||||
MPrintFormat f = MPrintFormat.createFromTable(Env.getCtx(), AD_Table_ID);
|
|
||||||
PrintInfo i = new PrintInfo("test", AD_Table_ID, 108, 0);
|
|
||||||
i.setAD_Table_ID(AD_Table_ID);
|
|
||||||
ReportEngine re = new ReportEngine(Env.getCtx(), f, q, i);
|
|
||||||
re.layout();
|
|
||||||
/**
|
|
||||||
re.createCSV(new File("C:\\Temp\\test.csv"), ',', Language.getLanguage());
|
|
||||||
re.createHTML(new File("C:\\Temp\\test.html"), false, Language.getLanguage());
|
|
||||||
re.createXML(new File("C:\\Temp\\test.xml"));
|
|
||||||
re.createPS(new File ("C:\\Temp\\test.ps"));
|
|
||||||
re.createPDF(new File("C:\\Temp\\test.pdf"));
|
|
||||||
/****/
|
|
||||||
re.print();
|
|
||||||
// re.print(true, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
|
|
||||||
// re.print(true, 1, false, "HP LaserJet 3300 Series PCL 6"); // Dialog
|
|
||||||
// re.print(false, 1, false, "Epson Stylus COLOR 900 ESC/P 2"); // Dialog
|
|
||||||
System.exit(0);
|
|
||||||
} // main
|
|
||||||
|
|
||||||
public void setWhereExtended(String whereExtended) {
|
public void setWhereExtended(String whereExtended) {
|
||||||
m_whereExtended = whereExtended;
|
m_whereExtended = whereExtended;
|
||||||
|
|
Loading…
Reference in New Issue