• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can't print in UNIX

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm new to this forum and was wondering if anyone could help me. my following code is the final slide of a GUI I created and prints the user's details fine in Windows, however, it won't in UNIX, has anyone ever experinced this before or does my code need tweaking. I'e left out all the import stuff at the top, hope that's not what is killing me;well here it is:
/**
* Controller for the third slide of the wizard ("Step 3 of 3").
*/
public class RbsCreationReportSlideController extends DefaultSlideController
implements IComplexValueEditorProvider, IEnumEditorContentProvider, IReportParticularRbsStatus
{
protected Table tTable = null;
protected TableModel tmTableModel = null;
private int iIncrementalActionCounter = -1;
protected RbsCreationReportSlideView view = null;
// This is the time stamp for the attempted creation of the rbs(s)
private Timestamp time = null;
protected String getHelpId() {
return "ARW_RBS_CREATION_REPORT_DATA_SLIDE";
}
protected void init() {
Trace.enter(this, "init");
// this is the last slide of the wizard
super.initialise(null, null);
// CIC Sets a need to be Restored flag.
super.ifSessionFailsTryToRestoreIt();
this.view = (RbsCreationReportSlideView)super.getView();
ColumnFactory cfColumnFactory = new ColumnFactory();
cfColumnFactory.subscribeEnumEditorContentProvider(this);
cfColumnFactory.subscribeComplexValueEditorProvider(this);
tmTableModel = new TableModel(cfColumnFactory, this);
view.validate();
// create table first to make it possible to initialize column editors
tTable = new Table(tmTableModel);
// The table in the Creation report has three columns. These are :
// Rbs name, RNC name, Rbs ID and Rbs status.
tmTableModel.addColumn(RbsCreationReportDataColumns.RBS_NAME,
ValueDisplayType.STRING, true, false);
tmTableModel.addColumn(RbsCreationReportDataColumns.RNC_NAME,
ValueDisplayType.STRING, true, false);
tmTableModel.addColumn(RbsCreationReportDataColumns.RBS_ID,
ValueDisplayType.LONG, true, false);
tmTableModel.addColumn(RbsCreationReportDataColumns.RBS_STATUS,
ValueDisplayType.ENUM, true, false);
// now we can create table, and pass it to view
view.setTable(tTable, "RBS_CREATION_REPORT_TABLE_CAPTION");
// Only allow single row selection for this table.
this.tTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
this.setUpActionListeners();
Trace.exit(this);
}
/**
* changeSlideState
*
* ???
*
* @param iSlideControllerState
*/
public void changeSlideState(int iSlideControllerState) {
Trace.enter(this, "changeSlideState");
super.changeSlideState(iSlideControllerState);
switch (iSlideControllerState) {
case SlideControllerState.READY_TO_RETRIEVE_DATA :
String strTemplateName = (String)super.getParameter( "TEMPLATE_NAME" );
tmTableModel.clearRows();
// get rbss from parameters storage
// they have been put there by the previous slide
// and display them
Vector vTemp = (Vector)super.getParameter( "RBS_WRAPPER_LIST" );
if ( vTemp != null ) {
for ( int i=0; i<vTemp.size(); i++ ) {
tmTableModel.addRow( (RbsDataTranslator)vTemp.get(i) );
}
}
tmTableModel.markReadonlyRows();
this.time = new Timestamp(System.currentTimeMillis());

// create request handler
RequestHandler rhHandler = this.createRequestHandler();
// create preparational request
PrepareCreationCorbaCall pccCall = new PrepareCreationCorbaCall( this, strTemplateName );
// add it first
rhHandler.addRequest( pccCall );
// sort out those who might be created
Vector vRbssToCreate = new Vector();
if ( vTemp != null ) {
for ( int i=0; i<vTemp.size(); i++ ) {
RbsDataTranslator rdtTemp = (RbsDataTranslator)vTemp.get(i);
if ( rdtTemp.isEditable() ) {
rdtTemp.setRbsStatus( RbsStatus.PROCESSING );
// add new request to group
CreateRbsCorbaCall ccCreateRbs =
new CreateRbsCorbaCall( this, rdtTemp );
rhHandler.addRequest( ccCreateRbs );
}
}
}
if ( rhHandler.getNumberOfRegisteredRequests() > 1 ) {
// there is new rbss so we might add them
// set unconditional request to close sessions
StopCSSessionsCorbaCall scsscCall = new StopCSSessionsCorbaCall( this );
rhHandler.setUnconditionalFinalRequest( scsscCall );
// start requests
rhHandler.start();
}
break;
case SlideControllerState.READY_TO_UPDATE_DATA :
break;
case SlideControllerState.DATA_UPDATED :
showNextSlide();
break;
case SlideControllerState.DATA_RETRIEVED :
break;
default:
break; // do nothing if type is unknown
}
Trace.exit(this);
}
/**
* setUpActionListeners
*
* Sets up action listeners for the print and details buttons as well
* as listeners for mouse clicked event on the slide tale.
*
*/
private void setUpActionListeners() {
view.detailsButton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// We want to deal with the situation when a details button
// is pressed and the Details dialog is launched containing
// the report on the RBS creation.
showDetailsDialog();
}
});
view.printButton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
// This will be updated later.
printReportTable();
}
});
// This code enables the remove button when one of the rows
// in the slide is selected and it disables the remove button
// when a row is unselected and there are no more rows selected
// on the table.
ListSelectionModel rowSM = this.tTable.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
// if there are no selected rows.
if (lsm.isSelectionEmpty()) {
view.detailsButton.setEnabled(false);
//view.printButton.setEnabled(false);
} else {
/* Disable until the functionality is properly in place.
view.printButton.setEnabled(true);
*/
//view.printButton.setEnabled(true);
view.detailsButton.setEnabled(true);
} // end if
} // end valueChanged method.
});
} // End setUpActionListeners method
/**
* actionPerformed
*
*
* @param iUserControlType
* @param objParameter
*/
public boolean actionPerformed(int iUserControlType, Object objParameter) {
Trace.enter(this, "actionPerformed");
tTable.closeCellEditors(true);
switch (iUserControlType) {
case UserControlType.PREVIOUS_BTN :
//disable the details and print button on exit from the slide.
view.detailsButton.setEnabled(false);
view.printButton.setEnabled(true);
default : // ignore
break;
}
Trace.exit(this);
return true;
}
/**
* Called by GUILIB when the user presses the Previous button in a slide
* in the wizard; forwards to actionPerformed() implemented by the derived
* controller.
*/
protected boolean previous() {
Trace.enter(this, "previous");
boolean r = this.actionPerformed(UserControlType.PREVIOUS_BTN, null);
Trace.exit(this);
return r;
}
private void storeWrappedData() {
Trace.enter(this, "storeWrappedData");
// store rbss
Vector vRecords = tmTableModel.getRows();
super.setParameter("RBS_WRAPPER_LIST", vRecords);
}

public boolean isDataConsistent() {
Trace.enter(this, "isDataConsistent");
Trace.exit(this);
return true;
}

public Object editValueForComplexCell(String strColumnId,
Object objValue) {
Trace.enter(this, "editValueForComplexCell");
/* NodeDataTranslator ndtCurrent =
(NodeDataTranslator)tmTableModel.getRow(tTable.getSelectedRow());
Object[][] objParams = {
{ "PARENT", this },
{ "UID", ndtCurrent.getValueByColumnId(NodeDataColumns.USER_UID) },
{ "PWD", ndtCurrent.getValueByColumnId(
NodeDataColumns.USER_PASSWORD) }
};
startDialog(true, "USER_DETAILS_DIALOG_TITLE", null,
UidDialogView.class, UidDialogController.class, objParams);
*/
Trace.exit(this);
return objValue;
}
/**
* provideEnumInfoForCell
*
* ???
*
* @param strColumnId
* @param iRow
* @return EnumInfoItem[]
*/
public EnumInfoItem[] provideEnumInfoForCell(String strColumnId, int iRow) {
Trace.enter(this, "provideEnumInfoForCell");
EnumInfoItem[] eiiResult = new EnumInfoItem[0];
if ( strColumnId.equals( RbsCreationReportDataColumns.RBS_STATUS ) ) {
eiiResult = new EnumInfoItem[5];
eiiResult[0] = new EnumInfoItem( getLocalizedString("SUCCESSFUL"), new Integer( RbsStatus.SUCCESSFUL ) );
eiiResult[1] = new EnumInfoItem( getLocalizedString("UNSUCCESSFUL"), new Integer( RbsStatus.UNSUCCESSFUL ) );
eiiResult[2] = new EnumInfoItem( "", new Integer( RbsStatus.PROCESSING ) );
eiiResult[3] = new EnumInfoItem( getLocalizedString("SIDE_EFFECTS"), new Integer( RbsStatus.SIDE_EFFECTS ) );
eiiResult[4] = new EnumInfoItem( getLocalizedString("CANCELLED"), new Integer( RbsStatus.CANCELLED ) );
}
Trace.exit(this);
return eiiResult;
}
/**
* getSlideIndex
*
* Returns the slide sequence number.
*
* @return Int representing the sequence number for this particular slide.
*/
protected int getSlideIndex() {
Trace.enter(this, "getSlideIndex");
Trace.exit(this);
return 5;
}
public void respondToCreateRBSSuccessful( ) {
}
public void respondToCreateRBSFailure( ) {
}
public void respondToCreateRBSCancelled( ) {
}

/**
* respondParticularRbsStatus
*
* This method is defined in the interface IReportParticularRbsStatus.
* It is called by the CreateRbsCorbaCall.
*
* @param strRbsName
* @param IRbsId
* @param rsResult
* @param iRbsStatus
*/
public void respondParticularRbsStatus( String strRbsName, int iRbsId, Object rResult, int iRbsStatus ) {
// we assume that rbs name is unique for all
// the rows represented by wizard, so we can use it as a key
// find reported rbs
Vector vTemp = (Vector)super.getParameter( "RBS_WRAPPER_LIST" );
/****
* Retrieve the current time and present this as the approximate time
* for the attempted creation of the Rbs.
*/
long milliSecondsTime = System.currentTimeMillis(); // in milliseconds.
this.time = new Timestamp(milliSecondsTime);

if ( vTemp != null ) {
for ( int i=0; i<vTemp.size(); i++ ) {
RbsDataTranslator rdtTemp = (RbsDataTranslator)vTemp.get(i);
String sRbsName = (String)rdtTemp.getValueByColumnId( RbsCreationReportDataColumns.RBS_NAME );
if ( sRbsName.equals( strRbsName ) ) {
// we've got one
// set new rbs id
if ( iRbsId != -1 ) {
rdtTemp.setValueByColumnId( RbsCreationReportDataColumns.RBS_ID, (Object)new Integer( iRbsId ) );
}
// set report
rdtTemp.setValueByColumnId( RbsCreationReportDataColumns.RBS_REPORT, rResult );
// set it's new status
rdtTemp.setRbsStatus( iRbsStatus );
tmTableModel.colorizeRow( i, java.awt.Color.gray, false );
// refresh table view
tmTableModel.refreshView();
return;
}
}
}

}
/**
* showDetailsDialog
*
* This method is called when a row is selected on slide 3 and the Details
* button is pressed. This dialog will then provide details about the
* successful or unsuccessful creation on a slected RBS.
*
*/
public void showDetailsDialog() {
Trace.enter(this, "showDetailsDialog");

// check which OS the user is on
PrintStream stdout = System.out;
Properties props = System.getProperties();
stdout.println(props.getProperty("os.arch"));
stdout.println(props.getProperty("os.name"));
stdout.println(props.getProperty("os.version"));

// Array to store a list of selected rows
int[] selectedRows = tTable.getSelectedRows();
// Will hold all the creation reports for the seleced RBSs
String[] creationReport = new String[selectedRows.length];
// Temporary storage for the each row.
IVisualToActualValueTranslator temp = null;
Integer statusReport = null;
int rbsID = 0;
String rbsName = null;
FDN rncRef = null;
String extraInfo = "";
// Construct Header for Rbs Details.
String line = "-----------------------------------------------";
String title1 = "\n" + line + "\n" + " RBS Creation Details ";
String title2 = /*"\\" + selectedRows.length + ")" +*/ "\n" + line + "\n";
// Go through each of the selected rows and add their reports to the
// creation report.
// For all the rows selected by the operator.
for (int i=0; i < selectedRows.length; i ++) {
temp = this.tmTableModel.getRow(selectedRows[i]);
statusReport = (Integer)(temp.getValueByColumnId(RbsCreationReportDataColumns.RBS_STATUS));
rncRef = (FDN) (temp.getValueByColumnId(RbsCreationReportDataColumns.RNC_NAME));
// If the creation report status is successful we will not get a detailed
// report from the server. In this case we will print out the rnc name
// the rbs name and the rbs identifier.
if (statusReport.intValue() != RbsStatus.UNSUCCESSFUL && statusReport.intValue() != RbsStatus.CANCELLED
&& statusReport.intValue() != RbsStatus.SIDE_EFFECTS ) {
rbsID = ((Integer)(temp.getValueByColumnId(RbsCreationReportDataColumns.RBS_ID))).intValue();
rbsName = (String)(temp.getValueByColumnId(RbsCreationReportDataColumns.RBS_NAME));
creationReport[i] = "[" + "creationAttemptTime= "+ time.toString() + "]" + "\n";
creationReport[i] = creationReport[i] + "[" + "rncName=" + rncRef.toString() +"]" + "\n";
creationReport[i] = creationReport[i] + "[" + "rbsName=" + rbsName + "]" + "\n";
creationReport[i] = creationReport[i] + "[" + "rbsID=" + rbsID +"]" +"\n";
}
// otherwise prepare to print out the full creation report obtained from
// the server with the RNC name and time of creation added.
else {
if (statusReport.intValue() == RbsStatus.SIDE_EFFECTS){
extraInfo = "Creation failed due to an unexpected server fault. The job could not be undone. The created MOs and new references might need to be manually deleted from the MIB before a reattempt will succeed.";
}
creationReport[i] = extraInfo + "\n" + "[" + "creationAttemptTime= "+ time.toString() + "]" + "\n";
creationReport[i] = creationReport[i] + "[" + rncRef.toString() + "]" + "\n";
creationReport[i] = creationReport[i] + (String)(temp.getValueByColumnId(RbsCreationReportDataColumns.RBS_REPORT));
}
// Add header information to the report that will be printed in the
// Details dialog window.
creationReport[i] = title1 + "(" + getStatusReportString(statusReport) + ")" /*+ " (" + (i+1)*/ + title2 + creationReport[i];
}
Object[][] objParams = {
{ "PARENT", this },
{ "CREATION_REPORT", creationReport }
};
view.startDialog( !this.getApplication().isUnitTestMode(), "RBS_CREATION_DETAILS_DIALOG", null, new DetailsDialogView(),
new DetailsDialogController(), objParams);
Trace.exit(this);
}
/**
* getStatusReportString
*
* Method returns the String description of the RBS creation status.
*
* @param x this is a Long value representing the status of the RBS
* creation
* @return string value of the RBS creation status.
*/
public String getStatusReportString(Integer x) {
if (x.intValue() == RbsStatus.PROCESSING) {
return "PROCESSING";
} else if (x.intValue() == RbsStatus.SUCCESSFUL) {
return "SUCCESSFUL";
} else if ( x.intValue() == RbsStatus.UNSUCCESSFUL) {
return "UNSUCCESSFUL";
} else if ( x.intValue() == RbsStatus.CANCELLED) {
return "CANCELLED";
} else return "PROCESSING";
}

/**
* printReportTable
*
* This method prints whole table for this slide.
* As it stands this method will produce a printout of the table for this
* slide that will look like a screen print.
* At this point GUI lib's print functionality does not allow the printing
* of a string. It only allows printing of an active graphic component.
*
*/
public void printReportTable() {
Trace.enter(this, "printReportTable");
// This line will allow the whole table on this slide to be printed
// like a screen shot.
Printout printout = new Printout(this.tTable, "Status of RBS Configurations");
// Print the report
printout.print();
Trace.exit(this);
}
/**
* afterVisible
*
* Over ride the afterVisible method which is defined in the
* the AbstractController class.
* Call the afterVisible Method from the parent class and also
* disable the Cancel button on this slide.
*
*/
public void afterVisible() {
super.afterVisible();
// Disable the Cancel button on entry to this slide
super.setCancelEnabled(false);
}
public void operatorDoesNotWantToRestoreBrokenConnection() {
updateRbssWithFailureMessage( getLocalizedString( "OPERATOR_DID_NOT_WANT_TO_RESTORE_SESSION" ) );
}
public void respondCloseNoRetryAction( String strDescription, String strOrigMessage ) {
updateRbssWithFailureMessage( getLocalizedString( "OPERATOR_DID_NOT_WANT_TO_RETRY" ) + strDescription + "\n\n" + strOrigMessage );
}
private void updateRbssWithFailureMessage( String strFailure ) {
for ( int i=0; i < tmTableModel.getRowCount(); i++ ) {
RbsDataTranslator rdtTemp = (RbsDataTranslator)tmTableModel.getRow( i );
Integer rbsStatus = (Integer)rdtTemp.getValueByColumnId(RbsCreationReportDataColumns.RBS_STATUS);
if ( rbsStatus.intValue() == RbsStatus.PROCESSING || rbsStatus.intValue() == RbsStatus.UNSUCCESSFUL || rbsStatus.intValue() == RbsStatus.CANCELLED ) {
rdtTemp.setValueByColumnId( RbsCreationReportDataColumns.RBS_REPORT, strFailure );
// set it's new status
rdtTemp.setRbsStatus( RbsStatus.UNSUCCESSFUL );
}
}
}
} // End of RbsCreationReportSlideController
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Can you print from the Unix machine at all?
2. Can you print from Java at all? Create a simple Java program that just prints out a page with String on it and try it. If it works, it may clue you in to what you are doing wrong.
3. In the future, use the UBB CODE tag (under the text area where you edit your post) to preserve the formatting of your code.
 
Aidan Lyons
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, I can print from my unix machine, the GUI creates a file called out.ps, but it won't print it! sorry about the formatting of the code.
cheers
aidan

1. Can you print from the Unix machine at all?
2. Can you print from Java at all? Create a simple Java program that just prints out a page with String on it and try it. If it works, it may clue you in to what you are doing wrong.
3. In the future, use the UBB CODE tag (under the text area where you edit your post) to preserve the formatting of your code.
 
eat bricks! HA! And here's another one! And a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic