⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jobqueuepanel.java

📁 发送传真的program,发送传真的program,发送传真的program.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/** * JHylaFax - A java client for HylaFAX. * * Copyright (C) 2005 by Steffen Pingel <steffenp@gmx.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */package net.sf.jhylafax;import static net.sf.jhylafax.JHylaFAX.i18n;import java.awt.event.ActionEvent;import java.io.File;import java.util.ArrayList;import java.util.Date;import java.util.List;import javax.swing.Action;import javax.swing.JOptionPane;import javax.swing.table.AbstractTableModel;import javax.swing.table.TableModel;import net.sf.jhylafax.DetailsDialog.Property;import net.sf.jhylafax.JobHelper.FileStat;import net.sf.jhylafax.fax.FaxJob;import org.xnap.commons.gui.Builder;import org.xnap.commons.gui.Dialogs;import org.xnap.commons.gui.action.AbstractXNapAction;import org.xnap.commons.gui.util.DoubleClickListener;/** * A panel that displays a list of jobs. Used for "sendq", "pollq" and "doneq". *   * @author Steffen Pingel */public class JobQueuePanel extends AbstractQueuePanel {		private DetailsAction detailsAction;	private EditJobAction editAction;	private JobTableModel jobTableModel;	private RemoveJobAction removeAction;	private ResumeJobAction resumeAction;	private RetryJobAction retryAction;	private SuspendJobAction suspendAction;	private ViewJobAction viewAction;		public JobQueuePanel(String queueName) {		super(queueName);				removeAction = new RemoveJobAction();		suspendAction = new SuspendJobAction();		resumeAction = new ResumeJobAction();		retryAction = new RetryJobAction();		detailsAction = new DetailsAction();		editAction = new EditJobAction();		viewAction = new ViewJobAction();				// TODO: should not hard code queue names here		if (queueName.equals("doneq")) {			getButtonPanel().add(Builder.createButton(viewAction));			getButtonPanel().add(Builder.createButton(removeAction));			getTablePopupMenu().add(Builder.createMenuItem(viewAction));			getTablePopupMenu().add(Builder.createMenuItem(detailsAction));			getTable().addMouseListener(new DoubleClickListener(viewAction));		}		else { // "sendq" / "pollq" (?)			getButtonPanel().add(Builder.createButton(editAction));			getButtonPanel().add(Builder.createButton(removeAction));			getButtonPanel().add(Builder.createButton(suspendAction));			getButtonPanel().add(Builder.createButton(resumeAction));			getButtonPanel().add(Builder.createButton(viewAction));						getTablePopupMenu().add(Builder.createMenuItem(editAction));			getTablePopupMenu().add(Builder.createMenuItem(removeAction));			getTablePopupMenu().add(Builder.createMenuItem(detailsAction));			getTablePopupMenu().addSeparator();			getTablePopupMenu().add(Builder.createMenuItem(retryAction));			getTablePopupMenu().addSeparator();			getTablePopupMenu().add(Builder.createMenuItem(suspendAction));			getTablePopupMenu().add(Builder.createMenuItem(resumeAction));			getTablePopupMenu().addSeparator();			getTablePopupMenu().add(Builder.createMenuItem(viewAction));					getTable().addMouseListener(new DoubleClickListener(editAction));		}				updateLabels();		updateActions();	}		@Override	public FileStat getSelectedFile()	{		return null;	}	public FaxJob getSelectedJob()	{		int row = getSelectedRow();		return (row == -1) ? null : jobTableModel.getJob(row); 	}		@Override	protected TableModel getTableModel()	{		if (jobTableModel == null) {			jobTableModel = new JobTableModel();		}		return jobTableModel;	}		protected void initializeTableLayout() {		getTableLayout().setColumnProperties(0, "id", 20);		getTableLayout().setColumnProperties(1, "priority", 20);		getTableLayout().setColumnProperties(2, "result", 20);		getTableLayout().setColumnProperties(3, "permissions", 40);		getTableLayout().setColumnProperties(4, "owner", 40);		getTableLayout().setColumnProperties(5, "sender", 80);		getTableLayout().setColumnProperties(6, "clientMachine", 80);		getTableLayout().setColumnProperties(7, "resolution", 40);		getTableLayout().setColumnProperties(8, "number", 80);		getTableLayout().setColumnProperties(9, "time", 60);		getTableLayout().setColumnProperties(10, "pages", 20);		getTableLayout().setColumnProperties(11, "dials", 20);		getTableLayout().setColumnProperties(12, "error", 100);		getTableLayout().setColumnProperties(13, "state", 18);		getTableLayout().setColumnProperties(14, "cid", 40);		getTableLayout().setColumnProperties(15, "tag", 40);	}	public void setData(List<FaxJob> data) {		jobTableModel.setData(data);	}	@Override	public void updateActions() {		FaxJob job = getSelectedJob();		viewAction.setEnabled(job != null);		boolean isEditable = (job != null) && job.getID() != -1;		editAction.setEnabled(isEditable);		removeAction.setEnabled(isEditable);		suspendAction.setEnabled(job != null && job.getState() != FaxJob.State.SUSPENDED);		resumeAction.setEnabled(job != null && job.getState() == FaxJob.State.SUSPENDED);		retryAction.setEnabled(job != null);	}	@Override	public void updateLabels() {		super.updateLabels();				removeAction.updateLabels();		suspendAction.updateLabels();		resumeAction.updateLabels();		retryAction.updateLabels();		detailsAction.updateLabels();		editAction.updateLabels();		viewAction.updateLabels();				getTableLayout().setColumnNames(new String[] {				i18n.tr("ID"),				i18n.tr("Priority"), 				i18n.tr("Result"),				i18n.tr("Permission"),				i18n.tr("Owner"),				i18n.tr("Sender"), 				i18n.tr("Client Machine"), 				i18n.tr("Resolution"),				i18n.tr("Number"),				i18n.tr("Time"),				i18n.tr("Pages"),				i18n.tr("Dials"),								i18n.tr("Last Error"),				i18n.tr("State"),				i18n.tr("CID"),				i18n.tr("Tag"),}); 	}	private class EditJobAction extends AbstractXNapAction {				public EditJobAction() {			putValue(ICON_FILENAME, "edit.png");		}		public void actionPerformed(ActionEvent e)		{			// a double click could be triggered despite of the disabled state			if (!isEnabled()) {				return;			}			FaxJob job = getSelectedJob();			EditDialog dialog = new EditDialog(JHylaFAX.getInstance(), job);			dialog.setLocationRelativeTo(JHylaFAX.getInstance());			dialog.setVisible(true);		}		public void updateLabels() {			putValue(Action.NAME, i18n.tr("Edit..."));		}	}	private class DetailsAction extends AbstractXNapAction {				public DetailsAction() {			//putValue(ICON_FILENAME, "redo.png");		}		public void actionPerformed(ActionEvent e)		{			FaxJob job = getSelectedJob();			List<Property> data = new ArrayList<Property>();			data.add(new Property(i18n.tr("Assigned modem"), job.getAssignedModem()));			data.add(new Property(i18n.tr("Client-specefied dial string"), job.getClientDialString()));			data.add(new Property(i18n.tr("Client machine name"), job.getClientMachineName()));			data.add(new Property(i18n.tr("Scheduling priority"), job.getClientSchedulingPriority()));			data.add(new Property(i18n.tr("Communication identifier"), job.getCommunicationIdentifier()));			data.add(new Property(i18n.tr("Page chopping threshold"), job.getChoppingThreshold()));			data.add(new Property(i18n.tr("Client-specified minimum signalling rate"), job.getClientMinimumSignallingRate()));			data.add(new Property(i18n.tr("Client-specified tag"), job.getTag()));			data.add(new Property(i18n.tr("Client-specified tagline format"), job.getTaglineFormat()));			data.add(new Property(i18n.tr("# of consecutive failed dials"), job.getConsecutiveFailedDials()));			data.add(new Property(i18n.tr("# of consecutive failed tries"), job.getConsecutiveFailedTries()));			data.add(new Property(i18n.tr("Desired data format"), job.getDesiredDataFormat()));			data.add(new Property(i18n.tr("Desired use of ECM"), job.getDesiredECM()));			data.add(new Property(i18n.tr("Desired minimum scanline time"), job.getDesiredMinScanline()));			data.add(new Property(i18n.tr("Desired signalling rate"), job.getDesiredSignallingRate()));			data.add(new Property(i18n.tr("Destination company name"), job.getDestinationCompanyName()));			data.add(new Property(i18n.tr("Destination geographic location"), job.getDestinationLocation()));			data.add(new Property(i18n.tr("Destination password"), job.getDestinationPassword()));			data.add(new Property(i18n.tr("Destination sub-address"), job.getDestinationSubAddress()));			data.add(new Property(i18n.tr("# of attempted dials"), job.getDialsAttempted()));			data.add(new Property(i18n.tr("Group identifier"), job.getGroupID()));			data.add(new Property(i18n.tr("Horizontal resolution"), job.getHorizontalResolution()));			data.add(new Property(i18n.tr("ID"), job.getID()));			data.add(new Property(i18n.tr("Job done operation"), job.getJobDoneOperation()));			data.add(new Property(i18n.tr("Job type"), job.getJobType()));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -