System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FileNameForm));\r
this.octopusIDSelector1 = new OctopusClient.OctopusIDSelector();\r
this.buttonCancel = new System.Windows.Forms.Button();\r
- this.buttonRendben = new System.Windows.Forms.Button();\r
+ this.buttonOK = new System.Windows.Forms.Button();\r
this.SuspendLayout();\r
// \r
// octopusIDSelector1\r
// \r
// buttonRendben\r
// \r
- this.buttonRendben.Enabled = false;\r
- this.buttonRendben.Location = new System.Drawing.Point(195, 356);\r
- this.buttonRendben.Name = "buttonRendben";\r
- this.buttonRendben.Size = new System.Drawing.Size(75, 23);\r
- this.buttonRendben.TabIndex = 7;\r
- this.buttonRendben.Text = "Rendben";\r
- this.buttonRendben.UseVisualStyleBackColor = true;\r
- this.buttonRendben.Click += new System.EventHandler(this.buttonRendben_Click);\r
+ this.buttonOK.Enabled = false;\r
+ this.buttonOK.Location = new System.Drawing.Point(195, 356);\r
+ this.buttonOK.Name = "buttonRendben";\r
+ this.buttonOK.Size = new System.Drawing.Size(75, 23);\r
+ this.buttonOK.TabIndex = 7;\r
+ this.buttonOK.Text = "Rendben";\r
+ this.buttonOK.UseVisualStyleBackColor = true;\r
+ this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);\r
// \r
// FileNameForm\r
// \r
- this.AcceptButton = this.buttonRendben;\r
+ this.AcceptButton = this.buttonOK;\r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
this.BackColor = System.Drawing.Color.White;\r
this.CancelButton = this.buttonCancel;\r
this.ClientSize = new System.Drawing.Size(276, 383);\r
this.ControlBox = false;\r
- this.Controls.Add(this.buttonRendben);\r
+ this.Controls.Add(this.buttonOK);\r
this.Controls.Add(this.buttonCancel);\r
this.Controls.Add(this.octopusIDSelector1);\r
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;\r
this.Name = "FileNameForm";\r
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;\r
this.Text = "File Name";\r
- this.Load += new System.EventHandler(this.FileNameForm_Load);\r
this.ResumeLayout(false);\r
\r
}\r
#endregion\r
private OctopusClient.OctopusIDSelector octopusIDSelector1;\r
private System.Windows.Forms.Button buttonCancel;\r
- private System.Windows.Forms.Button buttonRendben;\r
+ private System.Windows.Forms.Button buttonOK;\r
}\r
}
\ No newline at end of file
public partial class FileNameForm : Form {\r
private String result;\r
private MainForm mainForm;\r
- private String id;\r
+ public string ID { get; internal set; }\r
\r
public FileNameForm(MainForm mainForm, AudioRecorderSettings settings) {\r
InitializeComponent();\r
}\r
\r
private void IdChangedEvent(string id, string name, string text) {\r
- //TODO\r
- this.id = name;\r
- buttonRendben.Enabled = !String.IsNullOrEmpty(id);\r
+ buttonOK.Enabled = !String.IsNullOrEmpty(id);\r
+ ID = name;\r
}\r
\r
- private void FileNameForm_Load(object sender, EventArgs e)\r
- {\r
-\r
- }\r
-\r
- private void cancelButton_Click(object sender, EventArgs e)\r
- {\r
- Dispose();\r
+ \r
+ private void cancelButton_Click(object sender, EventArgs e) {\r
+ DialogResult = DialogResult.Cancel;\r
+ Close();\r
}\r
\r
- private void buttonRendben_Click(object sender, EventArgs e) {\r
- result = String.Format("{0}.wav", id);\r
- if (!result.EndsWith(".wav"))\r
- result = String.Format("{0}{1}", result, StringResources.DOT_WAV);\r
- mainForm.recordFireEvent(result, id);\r
- Dispose();\r
+ private void buttonOK_Click(object sender, EventArgs e) {\r
+ DialogResult = DialogResult.OK;\r
+ Close();\r
}\r
}\r
}\r
this.pauseButton = new System.Windows.Forms.Button();\r
this.groupBox2 = new System.Windows.Forms.GroupBox();\r
this.pmVolume = new Ernzo.WinForms.Controls.PeakMeterCtrl();\r
- this.fileNameLabel = new System.Windows.Forms.Label();\r
+ this.txtRecordFilePath = new System.Windows.Forms.Label();\r
this.playButton = new System.Windows.Forms.Button();\r
this.groupBox3 = new System.Windows.Forms.GroupBox();\r
this.tbVolume = new System.Windows.Forms.TrackBar();\r
// \r
// fileNameLabel\r
// \r
- this.fileNameLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
- this.fileNameLabel.Location = new System.Drawing.Point(8, 45);\r
- this.fileNameLabel.Name = "fileNameLabel";\r
- this.fileNameLabel.Size = new System.Drawing.Size(233, 23);\r
- this.fileNameLabel.TabIndex = 8;\r
+ this.txtRecordFilePath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+ this.txtRecordFilePath.Location = new System.Drawing.Point(8, 45);\r
+ this.txtRecordFilePath.Name = "fileNameLabel";\r
+ this.txtRecordFilePath.Size = new System.Drawing.Size(233, 23);\r
+ this.txtRecordFilePath.TabIndex = 8;\r
// \r
// playButton\r
// \r
// \r
this.groupBox3.Controls.Add(this.btnSelectAudio);\r
this.groupBox3.Controls.Add(this.playButton);\r
- this.groupBox3.Controls.Add(this.fileNameLabel);\r
+ this.groupBox3.Controls.Add(this.txtRecordFilePath);\r
this.groupBox3.Location = new System.Drawing.Point(15, 258);\r
this.groupBox3.Name = "groupBox3";\r
this.groupBox3.Size = new System.Drawing.Size(332, 86);\r
private System.Windows.Forms.Button btnSelectAudio;\r
private System.Windows.Forms.GroupBox groupBox1;\r
private System.Windows.Forms.GroupBox groupBox2;\r
- private System.Windows.Forms.Label fileNameLabel;\r
+ private System.Windows.Forms.Label txtRecordFilePath;\r
private System.Windows.Forms.Button playButton;\r
private System.Windows.Forms.Button pauseButton;\r
private System.Windows.Forms.GroupBox groupBox3;\r
private AudioRecorderSettings parameters;\r
private ITimeCodeWorker timeCodeWorker;\r
private IFileWorker fileWorker;\r
- private String currentFileName;\r
- private String currentFilePath;\r
private bool recording;\r
private Timer countDownTimer;\r
private int countDown = 3;\r
}\r
\r
void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data) {\r
- //customTrackBar1.SetValue((int)CurrentDevice.AudioEndpointVolume.MasterVolumeLevel);\r
+ this.BeginInvoke(new Action(() => {\r
+ tbVolume.Value = (int)Math.Round(CurrentDevice.AudioEndpointVolume.MasterVolumeLevel);\r
+ }));\r
}\r
\r
\r
- //private void RefreshVolumePanel() {\r
- // try {\r
- // if (recording) {\r
- // if (volumeHeight >= parameters.loud_percent)\r
- // //SendMessage(verticalProgressBar1.Handle, 1040, 2, 0);\r
- // verticalProgressBar1.ForeColor = Color.Red;\r
- // else\r
- // // SendMessage(verticalProgressBar1.Handle, 1040, 1, 0);\r
- // verticalProgressBar1.ForeColor = Color.Green;\r
- // verticalProgressBar1.Value = (int)volumeHeight;\r
- // }\r
- // } catch (Exception e) {\r
- // Console.WriteLine(e.Message);\r
- // }\r
- //}\r
-\r
-\r
private void stop_Click(object sender, EventArgs e) {\r
stopRecording();\r
}\r
\r
-\r
private void startRecord() {\r
try {\r
recording = true;\r
- currentFilePath = Path.Combine(parameters.working_dir, "1.wav");\r
- recorder.StartRecording(currentFilePath);\r
+ recorder.StartRecording(txtRecordFilePath.Text);\r
timeCodeWorker.Start();\r
pauseButton.Enabled = true;\r
recordButton.Enabled = false;\r
}\r
\r
private void OnRecordClick(object sender, EventArgs e) {\r
- //FileNameForm nameForm = new FileNameForm(this, parameters);\r
- //nameForm.ShowDialog();\r
-\r
- startRecord();\r
+ FileNameForm idSelectorForm = new FileNameForm(this, parameters);\r
+ if (idSelectorForm.ShowDialog() == DialogResult.Cancel)\r
+ return;\r
+ //string fileName = String.Format("{0}{1}", StringResources.DOT_WAV);\r
+ //currentFilePath = Path.Combine(parameters.working_dir, fileName);\r
+ recordFireEvent(idSelectorForm.ID);\r
+ //startRecord();\r
}\r
\r
- public void recordFireEvent(String currentFileName, string id) {\r
+ public void recordFireEvent(String id) {\r
recordButton.Enabled = false;\r
- String path = String.Format("{0}\\{1}", parameters.working_dir, id);\r
- if (!Directory.Exists(path))\r
- Directory.CreateDirectory(path);\r
- SetCurrentFileNameAndPath(currentFileName, path);\r
- fileNameLabel.Text = currentFileName;\r
- setToolTipToFileNameLabel(currentFilePath);\r
+ if (!Directory.Exists(parameters.working_dir))\r
+ Directory.CreateDirectory(parameters.working_dir);\r
+ \r
+ txtRecordFilePath.Text = GetCurrentFileNameAndPath(parameters.working_dir, id); ;\r
countDownTimer.Start();\r
}\r
\r
- private void SetCurrentFileNameAndPath(string currentFileName, string path) {\r
- String filePath = String.Format("{0}\\{1}", path, currentFileName);\r
- int i = 0;\r
- this.currentFileName = currentFileName;\r
- currentFilePath = String.Format("{0}\\{1}", path, currentFileName);\r
- while (File.Exists(this.currentFilePath)) {\r
- this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("-{0}", i)) : currentFileName;\r
- currentFilePath = String.Format("{0}\\{1}", path, this.currentFileName);\r
+ private string GetCurrentFileNameAndPath(string path, string id) {\r
+ string fileName = String.Format("{0}{1}", id, ".WAV");\r
+ int i = 1;\r
+ string fullPath = Path.Combine(path, fileName);\r
+ while (File.Exists(fullPath)) {\r
+ fileName = String.Format("{0}-{1}{2}", id, i, ".WAV");\r
+ fullPath = Path.Combine(path, fileName);\r
i++;\r
}\r
-\r
+ return fileName;\r
}\r
\r
void timer_Tick(object sender, EventArgs e) {\r
}\r
}\r
\r
- private void setToolTipToFileNameLabel(String filePath) {\r
- ToolTip toolTip = new ToolTip();\r
- String uncPath = String.Format("{0}{1}{2}", parameters.unc_path, Path.DirectorySeparatorChar, currentFileName);\r
- String tip = String.Format("{0}\n{1}", filePath, uncPath);\r
- toolTip.SetToolTip(fileNameLabel, tip);\r
- }\r
-\r
private void selectAudioButton_Click(object sender, EventArgs e) {\r
ShowAudioDeviceSelectorForm(true);\r
}\r
private void OnPlayClick(object sender, EventArgs e) {\r
Process process = new Process();\r
ProcessStartInfo startInfo = new ProcessStartInfo();\r
- startInfo.FileName = new FileInfo(currentFilePath).FullName;\r
+ startInfo.FileName = new FileInfo(txtRecordFilePath.Text).FullName;\r
process.StartInfo = startInfo;\r
process.Start();\r
}\r
{\r
"title": "Stúdió",\r
- "active": false,\r
+ "active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"filter": "avi",\r
"address": "ws://10.10.1.28/services/nexio"\r
},\r
"remote": {\r
- "address": "ftp://10.10.1.56:2098",\r
+ "address": "ftp://10.10.1.55:2098",\r
"userName": "administrator",\r
"password": "+QtkeQdCTiOvZOgK/kUND4pO4/D+//r7ZIyluwMMdiqMEgO8iJErAG10ooWhPfiljQeXrdeyMzo7gWEZtcWpNSomGeDIbdMyQwtpqmMo1VEM3A27ZfzigY09YD46ECRh"\r
}\r
return;\r
DataGridViewRow row = dgSource.Rows[e.RowIndex];\r
if (item.IsHighlighted) {\r
- row.DefaultCellStyle.BackColor = MaestroColors.Green200;\r
- row.DefaultCellStyle.ForeColor = Color.White;\r
+ row.DefaultCellStyle.BackColor = MaestroColors.LightGreen100;\r
+ row.DefaultCellStyle.ForeColor = Color.Black;\r
} else\r
row.DefaultCellStyle = null;\r
}\r
using NLog;\r
using System.Collections.Generic;\r
using MaestroShared.Commons;\r
+using MaestroShared.Metadata;\r
\r
namespace Maestro.Sources {\r
class NexioRESTSource : BindingList<NexioSourceItem>, ISource {\r
HeaderText = StringResources.UGYNOKSEG,\r
AutoSizeMode = DataGridViewAutoSizeColumnMode.None\r
},\r
+ new DataGridViewTextBoxColumn(){\r
+ DataPropertyName = "Duration",\r
+ HeaderText = StringResources.HOSSZ,\r
+ AutoSizeMode = DataGridViewAutoSizeColumnMode.None\r
+ },\r
new DataGridViewTextBoxColumn() {\r
DataPropertyName = "Created",\r
HeaderText = StringResources.FELVETEL_DATUMA,\r
case "Created":\r
result = i.Created;\r
break;\r
+ case "Duration":\r
+ result = i.Duration;\r
+ break;\r
}\r
return result;\r
}\r
\r
private void SetItem(ref NexioSourceItem item, JToken token) {\r
item.ID = token[ID].ToString();\r
- item.Name = token[LONGNAMEID].ToString() + ".mxf";\r
+ item.Name = token[LONGNAMEID].ToString() + ".MXF";\r
item.Agency = token[EXTAGENCY]?.ToString();\r
item.Created = DateTime.Parse(token[RECORDDATE]?.ToString());\r
item.Modified = DateTime.Parse(token[MODIFIED]?.ToString());\r
+ int d = token.Value<int>(DURATION);\r
+ if (d < 0)\r
+ d = d * -1;\r
+ item.Duration = new Timecode(d).ToString();\r
}\r
\r
\r
} else {\r
parent.SafeCall(() => {\r
SetItem(ref item, token);\r
+ item.IsHighlighted = true;\r
if (item.CanHandle(acceptableAgencies))\r
return;\r
Remove(item);\r
private DateTime modified;\r
private string agency;\r
private string id;\r
+ private string duration;\r
\r
public event PropertyChangedEventHandler PropertyChanged;\r
\r
}\r
}\r
\r
+ public string Duration {\r
+ get => duration;\r
+ set {\r
+ duration = value;\r
+ NotifyPropertyChanged();\r
+ }\r
+ }\r
+\r
public bool CanHandle(List<String> extensions) {\r
if (extensions == null || extensions.Count < 1)\r
return true;\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Looks up a localized string similar to Hossz.\r
+ /// </summary>\r
+ internal static string HOSSZ {\r
+ get {\r
+ return ResourceManager.GetString("HOSSZ", resourceCulture);\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Looks up a localized string similar to Idő.\r
/// </summary>\r
<data name="HIBAS_TARGET_REFERENCE_CONFIG" xml:space="preserve">\r
<value>Hibás reference configuráció a(z) {0} targetba</value>\r
</data>\r
+ <data name="HOSSZ" xml:space="preserve">\r
+ <value>Hossz</value>\r
+ </data>\r
<data name="IDO" xml:space="preserve">\r
<value>Idő</value>\r
</data>\r
\r
namespace MaestroShared.Resources {\r
public class MaestroColors {\r
- public static readonly Color Green200 = Color.FromArgb(0xFF, 0xC5, 0xE1, 0xA5);\r
+ public static readonly Color LightGreen200 = Color.FromArgb(0xFF, 0xC5, 0xE1, 0xA5);\r
+ public static readonly Color LightGreen100 = Color.FromArgb(0xFF, 0xDC, 0xED, 0xC8);\r
public static readonly Color Yellow200 = Color.FromArgb(0xFF, 0xE6, 0xEE, 0x9C);\r
public static readonly Color Orange200 = Color.FromArgb(0xFF, 0xFF, 0xCC, 0x80);\r
public static readonly Color Red200 = Color.FromArgb(0xFF, 0xEF, 0x9A, 0x9A);\r
priority = 0;\r
}\r
\r
- /* \r
+ /*\r
@Override\r
public int compareTo(IJob other) {\r
int res = 0;\r
}\r
*/\r
/**\r
- * 1. szempont prioritas\r
- * 2. szempont azonos prioritasnal a rogzites datuma\r
+ * 1. szempont prioritas 2. szempont azonos prioritasnal a rogzites datuma\r
*/\r
@Override\r
public int compareTo(IJob job0) {\r
} catch (Exception e) {\r
// System.out.println(e);\r
}\r
- try {\r
- jsClip.put(DURATION, clip.getDuration());\r
- } catch (Exception e) {\r
- // System.out.println(e);\r
- }\r
//jsClip.put(RECORDDATE, new DateTime(rs.getString(i++)).toDate());\r
//jsClip.put(EXTAGENCY, rs.getString(i++));\r
//jsClip.put(START, rs.getString(i++));\r
BasicDBObject jsonClip = convertClipToJSON(clip);\r
String fileName = jsonClip.getString(LONGNAMEID);\r
String agency = jsonClip.getString(EXTAGENCY);\r
+ int duration = jsonClip.getInt(DURATION);\r
if (fileName != null && !"".equals(fileName)) {\r
- logger.debug("Found NEXIO clip: {} {} {}", clip.getId(), fileName, agency);\r
+ logger.debug("Found NEXIO clip: {} duration: {} agency: {}", fileName, duration, agency);\r
this.saveClipIntoMongo(jsonClip, emptyMap, emptyMap);\r
} else {\r
logger.debug("Found NEXIO clip: {} XID IS MISSING!!", clip.getId());\r
}\r
\r
/*\r
- \r
+\r
int c = connection.read(buffer, 0, 2);\r
//2 bytes hosszan az idokozben hozzaadott id-k szamossaga\r
if (c < 2) {\r
throw new ProtocolException("c, 2, 2");\r
}\r
//MSB, LSB\r
- \r
+\r
return nofIds;\r
*/\r
return ret;\r
public Calendar getKillDate() throws ClipNotFoundException, IOException, ProtocolException;
+ byte[] getMetadata();
+
public Calendar getModifiedTimestamp() throws ClipNotFoundException, IOException, ProtocolException;
Calendar getRecordDateTimestamp() throws ClipNotFoundException, IOException, ProtocolException;
metadata = protocol.executeGetIDMetadata(id);
checkClipExists(metadata);
}
- return metadata[16] + (metadata[17] << 8) + (metadata[18] << 16) + (metadata[19] << 24);
+ //return metadata[16] + (metadata[17] << 8) + (metadata[18] << 16) + (metadata[19] << 24);
+ return metadata[19] << 24 | (metadata[18] & 0xFF) << 16 | (metadata[17] & 0xFF) << 8 | (metadata[16] & 0xFF);
}
@Override
return result;
}
+ @Override
+ public byte[] getMetadata() {
+ return metadata;
+ }
+
@Override
public Calendar getModifiedTimestamp() throws ClipNotFoundException, IOException, ProtocolException {
if (timestamp == null) {
<div height="100%" width="100%" style="background: #e3e3e3" align="left">\r
<groupbox height="94%" closable="false">\r
<caption sclass="boldfont" label="Aktív folyamatok" />\r
- <listbox id="lbJobList" sizedByContent="false" model="@load(jlm.jobList)" multiple="true" autopaging="true" mold="default" vflex="true" checkmark="true" \r
+ <listbox id="lbJobList" sizedByContent="false" model="@load(jlm.jobList)" multiple="true" autopaging="true" mold="paging" vflex="true" checkmark="true" \r
onSelect="@command('selectJob')" style="border: none; background: #e3e3e3 !important;" oddRowSclass="listbox-odd-style" sclass="listbox-normal-style" >\r
<listhead sizable="true">\r
<listheader label="Id" hflex="min" align="left"/>\r
- <listheader label="Name" hflex="150px" align="left"/>\r
+ <listheader label="Submitted" hflex="min" align="left"/>\r
+ <listheader label="Finished" hflex="min" align="left"/>\r
+ <listheader label="Name" hflex="min" align="left"/>\r
<listheader label="Priority" hflex="min" align="left"/>\r
- <listheader label="Status" hflex="50px" align="left"/>\r
- <listheader label="Progress" width="200px" align="left"/>\r
- <listheader label="Message" align="left"/>\r
+ <listheader label="Status" hflex="min" align="left"/>\r
+ <listheader label="Progress" width="100px" align="left"/>\r
+ <listheader label="Message" align="max"/>\r
</listhead>\r
\r
<template name="model">\r
<listitem>\r
<listcell label="@load(each.id)"/>\r
+ <listcell label="@load(each.submitted)"/>\r
+ <listcell label="@load(each.finished)"/>\r
<listcell label="@load(each.name)"/>\r
<listcell label="@load(each.priority)"/>\r
<listcell label="@load(each.status)"/>\r
</listitem>\r
</template>\r
</listbox>\r
- <hbox width="100%" pack="end">\r
+ <hbox width="100%" pack="center" align="center">\r
<button id="closeButton" label="Mégsem" onClick="@command('close')" />\r
<button id="executeButton" label="Futtatás" onClick="@command('execute')" />\r
</hbox>\r
</row>\r
</rows>\r
</grid>\r
- <hbox width="100%" pack="end">\r
+ <hbox width="100%" pack="center">\r
<button id="closeButton" label="Mégsem" onClick="@command('close')" />\r
<button id="executeButton" label="Végrehajtás" onClick="@command('execute')" />\r
</hbox>\r
status = JobStatus.RUNABLE;
}
+ public JobRuntime(IJob job) {
+ variables = null;
+ jobEngine = null;
+ program = null;
+ listeners = null;
+ id = job.getId();
+ description = job.getDescription();
+ name = job.getName();
+ owner = job.getOwner();
+ priority = job.getPriority();
+ status = job.getStatus();
+ progress = job.getProgress();
+ template = job.getTemplate();
+ finished = job.getFinished();
+ submitted = job.getSubmitted();
+ }
+
public JobRuntime(IJobEngine jobEngine, IJobRuntime runtime, IProgram program) {
this.program = program;
this.jobEngine = jobEngine;
jobRuntime.setFinished(new Timestamp(System.currentTimeMillis()));\r
jobRuntime.NotifyUpdate();\r
jobRuntime.done();\r
+ jobRuntime.modify();\r
jobEngine.removeJob(jobRuntime.getId());\r
}\r
}\r
\r
public class JobListModel extends BaseModel implements IJobChangedListener {\r
\r
- private List<JobChangedEvent> jobEvents = new ArrayList<JobChangedEvent>();\r
- private static final Logger logger = LogManager.getLogger();\r
- //protected CachedListModel searchResult = null;\r
- private ListModelList<IJobRuntime> jobList = new ListModelList<IJobRuntime>();\r
- private IJobRuntime selectedJob = null;\r
- private IJobEngine jobEngine = null;\r
- private int newPriority = 1;\r
-\r
- @Init\r
- public void init() {\r
- try {\r
- jobList.setMultiple(true);\r
-\r
- this.jobEngine = JobEngine.getInstance();\r
+ class JobTweaker implements Runnable {\r
+ public JobTweaker() {\r
+ Thread t = new Thread(this, "JobTweaker");\r
+ t.start();\r
+ }\r
\r
- //TESTJOBOK\r
- //test();\r
+ @Override\r
+ public void run() {\r
+ for (int c = 1000; true; c++) {\r
+ try {\r
+ for (int j = 0; j < jobList.size(); j++) {\r
+ IJobRuntime job = jobList.get(j);\r
+ if (j % 2 == 0) {\r
+ if (job.getProgress() < 100) {\r
+ job.setProgress(job.getProgress() + 2);\r
+ jobEngine.fireJobChangedEvent(new JobChangedEvent(job, SignalType.UPDATE));\r
+ }\r
+ }\r
+ if (job.getProgress() >= 100) {\r
+ //calls : fireJobChangedEvent(new JobChangedEvent(job, SignalType.DELETE));\r
+ jobEngine.removeJob(job.getId());\r
+ jobEngine.fireJobChangedEvent(new JobChangedEvent(job, SignalType.DELETE));\r
+ }\r
+ }\r
\r
- this.jobEngine.addJobChangedEventListener(this);\r
- Map<Long, IJobRuntime> jobMap = this.jobEngine.getJobs();\r
- jobList.addAll(jobMap.values());\r
- Collections.sort((List) jobList); //forditott sorrend?\r
- } catch (Exception exc) {\r
- logger.error("", exc);\r
+ if (c % 3 == 0) {\r
+ IJobRuntime newJob = createTestJob(c, 1, 50, "NEW" + c);\r
+ //calls : fireJobChangedEvent(new JobChangedEvent(jobRuntime, SignalType.CREATE));\r
+ jobEngine.addToRunQueue(newJob);\r
+ jobEngine.fireJobChangedEvent(new JobChangedEvent(newJob, SignalType.CREATE));\r
+ }\r
+ Thread.sleep(1000);\r
+ } catch (Exception exc) {\r
+ logger.error("", exc);\r
+ }\r
+ }\r
}\r
}\r
\r
- public void setSelectedJob(IJobRuntime _selectedJob) {\r
- this.selectedJob = _selectedJob;\r
- }\r
+ private static final Logger logger = LogManager.getLogger();\r
+ private List<JobChangedEvent> jobEvents = new ArrayList<JobChangedEvent>();\r
+ //protected CachedListModel searchResult = null;\r
+ private ListModelList<IJobRuntime> jobList = new ListModelList<IJobRuntime>();\r
+ private IJobRuntime selectedJob = null;\r
+ private IJobEngine jobEngine = null;\r
\r
- public IJobRuntime getSelectedJob() {\r
- return this.selectedJob;\r
- }\r
+ private int newPriority = 1;\r
\r
- public ListModelList<IJobRuntime> getJobList() {\r
- return jobList;\r
- }\r
+ private JobTweaker jobTweaker = null;\r
\r
- public void setJobList(ListModelList<IJobRuntime> jobList) {\r
- this.jobList = jobList;\r
- }\r
+ private int nofJobs = 10;\r
\r
@Command\r
public void changeJobsPriority() {\r
}\r
}\r
\r
+ private IJobRuntime createTestJob(int id, int prio, int progress, String name) {\r
+ IJobRuntime job = new JobRuntime();\r
+ job.setId(id);\r
+ job.setName(name == null ? ("Name " + id) : name);\r
+ job.setPriority(prio);\r
+ job.setProgress(progress);\r
+ return job;\r
+ }\r
+\r
@Command\r
public void executeJob() {\r
Map<String, Object> arguments = new HashMap<String, Object>();\r
window.doModal();\r
}\r
\r
- @Command\r
- @NotifyChange({ "updatePriorityDisabled" })\r
- public void selectJob() {\r
- //only for notification\r
+ public ListModelList<IJobRuntime> getJobList() {\r
+ return jobList;\r
+ }\r
+\r
+ public int getNewPriority() {\r
+ return newPriority;\r
+ }\r
+\r
+ public IJobRuntime getSelectedJob() {\r
+ return this.selectedJob;\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Init\r
+ public void init() {\r
+ try {\r
+ jobList.setMultiple(true);\r
+\r
+ this.jobEngine = JobEngine.getInstance();\r
+\r
+ //TESTJOBOK\r
+ //test();\r
+\r
+ this.jobEngine.addJobChangedEventListener(this);\r
+ Map<Long, IJobRuntime> jobMap = this.jobEngine.getJobs();\r
+\r
+ jobList.addAll(jobMap.values());\r
+ // List<IEntityBase> allItems = jobEngine.getItemManager().getAll(Job.class);\r
+ // for (IEntityBase entity : allItems) {\r
+ // jobList.add(new JobRuntime((IJob) entity));\r
+ // }\r
+ Collections.sort((List) jobList); //forditott sorrend?\r
+ } catch (Exception exc) {\r
+ logger.error("", exc);\r
+ }\r
}\r
\r
public boolean isUpdatePriorityDisabled() {\r
return true;\r
}\r
\r
+ //TEST CODE *****************************************************\r
+\r
+ @Override\r
+ public void jobChanged(JobChangedEvent event) {\r
+ if (event != null) {\r
+ synchronized (jobEvents) {\r
+ jobEvents.add(event);\r
+ }\r
+ }\r
+ }\r
+\r
@Command\r
//@NotifyChange({ "jobList" })\r
public void refreshJobList() {\r
}\r
}\r
\r
- @Override\r
- public void jobChanged(JobChangedEvent event) {\r
- if (event != null) {\r
- synchronized (jobEvents) {\r
- jobEvents.add(event);\r
- }\r
- }\r
- }\r
-\r
- //TEST CODE *****************************************************\r
-\r
- private JobTweaker jobTweaker = null;\r
- private int nofJobs = 10;\r
-\r
- private void test() {\r
- this.jobEngine = new JobEngine();\r
- for (int j = 0; j < nofJobs; j++) {\r
- this.jobEngine.addToRunQueue(createTestJob(j, 1, j, null));\r
- }\r
- jobTweaker = new JobTweaker();\r
- }\r
-\r
- private IJobRuntime createTestJob(int id, int prio, int progress, String name) {\r
- IJobRuntime job = new JobRuntime();\r
- job.setId(id);\r
- job.setName(name == null ? ("Name " + id) : name);\r
- job.setPriority(prio);\r
- job.setProgress(progress);\r
- return job;\r
+ @Command\r
+ @NotifyChange({ "updatePriorityDisabled" })\r
+ public void selectJob() {\r
+ //only for notification\r
}\r
\r
- public int getNewPriority() {\r
- return newPriority;\r
+ public void setJobList(ListModelList<IJobRuntime> jobList) {\r
+ this.jobList = jobList;\r
}\r
\r
public void setNewPriority(int newPriority) {\r
this.newPriority = newPriority;\r
}\r
\r
- class JobTweaker implements Runnable {\r
- public JobTweaker() {\r
- Thread t = new Thread(this, "JobTweaker");\r
- t.start();\r
- }\r
-\r
- @Override\r
- public void run() {\r
- for (int c = 1000; true; c++) {\r
- try {\r
- for (int j = 0; j < jobList.size(); j++) {\r
- IJobRuntime job = jobList.get(j);\r
- if (j % 2 == 0) {\r
- if (job.getProgress() < 100) {\r
- job.setProgress(job.getProgress() + 2);\r
- jobEngine.fireJobChangedEvent(new JobChangedEvent(job, SignalType.UPDATE));\r
- }\r
- }\r
- if (job.getProgress() >= 100) {\r
- //calls : fireJobChangedEvent(new JobChangedEvent(job, SignalType.DELETE));\r
- jobEngine.removeJob(job.getId());\r
- jobEngine.fireJobChangedEvent(new JobChangedEvent(job, SignalType.DELETE));\r
- }\r
- }\r
+ public void setSelectedJob(IJobRuntime _selectedJob) {\r
+ this.selectedJob = _selectedJob;\r
+ }\r
\r
- if (c % 3 == 0) {\r
- IJobRuntime newJob = createTestJob(c, 1, 50, "NEW" + c);\r
- //calls : fireJobChangedEvent(new JobChangedEvent(jobRuntime, SignalType.CREATE));\r
- jobEngine.addToRunQueue(newJob);\r
- jobEngine.fireJobChangedEvent(new JobChangedEvent(newJob, SignalType.CREATE));\r
- }\r
- Thread.sleep(1000);\r
- } catch (Exception exc) {\r
- logger.error("", exc);\r
- }\r
- }\r
+ private void test() {\r
+ this.jobEngine = new JobEngine();\r
+ for (int j = 0; j < nofJobs; j++) {\r
+ this.jobEngine.addToRunQueue(createTestJob(j, 1, j, null));\r
}\r
+ jobTweaker = new JobTweaker();\r
}\r
\r
//END OF TEST CODE ************************************************\r