/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Comment which describes the contents of this file.
*
* Add Access To Printer handling
*/
/*
* Window for Edit -> Add Access to a Printer
*/
// ensure that pmButton hashtable gets cleaned up
frame.setClearButtonsOnClose(true);
setLayout(new BorderLayout());
// Build the Frame
centerPanel();
southPanel();
/*
* let's try doing this in Show...
*
* // default button is always OK, for now...
* frame.getRootPane().setDefaultButton(okButton);
*
* okButton.setAsDefaultButton();
*/
// handle Esc as cancel
this.registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}},
// enable the pmFrame to set focus to our default comp on activation
// following is test code, I think...
public void keyPressed(KeyEvent k) {
}
public void keyReleased(KeyEvent k) {
}
}
});
}
public void centerPanel() {
// Build center panel
GridBagConstraints c = new GridBagConstraints();
// define center constraints
c.gridheight = 1;
c.gridwidth = 1;
// build center components
// Create
c.gridx = 0;
// Build the labels
c.gridy = 0;
c.gridy = 1;
c.gridy = 2;
c.gridy = 3;
// Build the text fields
// Common constraints
c.gridx = 1;
c.ipadx = 15;
c.gridy = 0;
c.gridy = 1;
c.gridy = 2;
// Add Choice Menus - ComboBox
c.gridy = 3;
}
boolean getHostOk = true;
throw new pmIncompleteFormException(
}
throw new pmIncompleteFormException(
}
throw new pmIncompleteFormException(
}
throw new pmIncompleteFormException(
}
try {
getHostOk = false;
}
} catch (Exception e) {
"CLNT: pmAccess:createAccess:getLocalHostName exception");
throw new pmGuiException(
"Could.not.get.local.hostname " + e));
}
if (!getHostOk) {
"CLNT: pmAccess:createAccess:Server name required.");
throw new pmMustBeRemoteServerException(
}
boolean exist;
try {
} catch (Exception e) {
throw new pmGuiException(e.toString());
}
if (exist) {
throw new pmPrinterExistsException();
}
try {
}
} catch (pmUserCancelledException e) {
throw new pmUserCancelledException(
"User.cancelled.login."));
} catch (pmGuiException e) {
throw new pmLoginFailedException();
} catch (Exception e) {
throw new pmLoginFailedException();
}
}
// Check for confirmation option
|| (mytop.getConfirmOption() == false)) {
// Set the printer attributes
if (defaultp.isSelected())
newpr.setIsDefaultPrinter(true);
boolean failed = false;
try {
} catch (Exception e) {
failed = true;
"CLNT:pmAccess:addRemotePrinter caught:" + e);
}
gatherLogs();
dumpLogs("CLNT:pmAccess:createAccess()");
if (failed)
throw new pmAddAccessFailedException(errorLog);
}
}
public void clearAccessInput() {
try {
if (defaultp.isSelected())
} catch (Exception e) {
// ignore???
// throw new pmGuiException("pmAccess: Error clearAccessInput: " + e);
}
}
public boolean confirmAction() {
if (mytop.getConfirmOption() == true) {
"Continue.creating.access.for.this.printer?"));
d.setVisible(true);
m.setVisible(true);
return false;
}
}
return true;
}
void gatherLogs() {
}
}
// returns true if success, false otherwise
boolean doAction() {
boolean rv = false;
try {
createAccess();
rv = true; // only if it didn't throw!
} catch (pmIncompleteFormException ix) {
pmMessageDialog m = new pmMessageDialog(
ix.getMessage(),
"AddAccessFailed");
m.setVisible(true);
} catch (pmPrinterExistsException ex) {
pmMessageDialog m = new pmMessageDialog(
m.setVisible(true);
} catch (pmMustBeRemoteServerException rx) {
pmMessageDialog m = new pmMessageDialog(
"The.server.must.be.a.remote.server."),
"RemoteServer");
m.setVisible(true);
} catch (pmLoginFailedException lx) {
pmMessageDialog m = new pmMessageDialog(
"LoginFailed");
m.setVisible(true);
} catch (pmAddAccessFailedException ax) {
pmMessageDialog m = new pmMessageDialog(
ax.getMessage(),
"AddAccessFailed");
m.setVisible(true);
} catch (pmUserCancelledException cx) {
"CLNT:pmAccess:createAccess: User cancelled namespace login");
} catch (pmGuiException gx) {
pmMessageDialog m = new pmMessageDialog(
gx.getMessage());
m.setVisible(true);
} finally {
// clearAccessInput();
}
return rv;
}
public void pmScreendispose() {
}
public void actionokButton() {
if (doAction() == true) {
frame.setVisible(false);
// frame.dispose();
} else {
}
}
public void actionapplyButton() {
if (doAction() == true) {
}
}
public void actionresetButton() {
}
public void actioncancelButton() {
frame.setVisible(false);
// frame.dispose();
}
public void actionhelpButton() {
}
public void Show() {
frame.setVisible(true);
}
}