Commit 22575b31 authored by Steffen Michels's avatar Steffen Michels

group container:

  - fix some problems with the toolbar
  - add styles for ProcessControl- and Instruction-container as children of group
  - change order in which tasks are added, now new tasks are added at the top
  - add modal dialogs
  - add fade-in/out effects for (un)docking of tasks

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@944 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 4571b05e
......@@ -43,7 +43,7 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
itasks.ttc.common.attachTaskHandlers(this);
var tb = this.getTopToolbar();
if(tb) tb.setVisible(tb.items.length > 0);
this.setupToolbar(tb);
},
addUpdate: function(name, value) {
......@@ -177,13 +177,32 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
tb.removeAll();
if(data.content.tbar)
tb.add(data.content.tbar);
tb.setVisible(tb.items.length > 0);
this.setupToolbar(tb);
//Attach eventhandlers
//this.attachTaskHandlers(this);
itasks.ttc.common.attachTaskHandlers(this);
}
}
},
setupToolbar: function(tb) {
tb.setVisible(tb.items.length > 0);
var enabledPresent = false;
for(var i = 0; i < tb.items.length; i++)
if(!tb.get(i).disabled) {
enabledPresent = true;
break;
}
var cls = 'GroupToolbarNoEnabledItems';
if(enabledPresent)
tb.removeClass(cls);
else {
tb.removeClass(cls);
tb.addClass(cls);
}
}
});
Ext.ns('itasks.ttc.form');
......
......@@ -30,33 +30,10 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
var group = this;
if(Ext.isNumber(id))
id = this.mkElementId(id);
// add undock button to toolbar for (un)dockable tasks
if((behaviour == 'GBFixed' || behaviour == 'GBFloating') && cont.content) {
var undockButton = {
iconCls: 'icon-unpin',
cls: 'GroupToolbarUndockControls',
handler: function() {
var panel = group.focusedContainer;
var pos = group.items.indexOf(panel);
delete group.focusedContainer;
var cont = panel.get(0);
panel.removeAll(false);
panel.destroy();
// copy toolbar back from shared one
group.copyTbar(group.getTopToolbar(), cont.getTopToolbar());
group.addContainer(cont, 'GBFloating', panel.id, false, pos);
group.doLayout();
group.focusFirstContainer();
}
};
var tbar = cont.content.tbar;
tbar[tbar.length] = {xtype: 'tbseparator', cls: 'GroupToolbarUndockControls'};
tbar[tbar.length] = undockButton;
}
switch(behaviour) {
case 'GBFixed':
var undockable = true;
case 'GBAlwaysFixed':
var panel = {
xtype: 'panel',
......@@ -64,14 +41,18 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
id: id,
items: [cont],
unstyled: true,
disabled: this.modalDlg,
listeners: {
afterrender: function(p) {
p.el.fadeIn();
p.el.on('mousedown', function() {
group.focusContainer(p);
});
if(focus)
if(focus) {
p.el.frame();
group.focusContainer(p);
}
}
},
focusFixed: function() {
......@@ -82,33 +63,64 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
this.removeClass('GroupFixedNoFocus');
this.addClass('GroupFixedNoFocus');
this.doLayout();
}
},
undockable: undockable
};
break;
case 'GBFloating':
var tools = [{
id: 'pin',
handler: function(ev,el,window) {
var pos = group.items.indexOf(window);
var cont = window.get(0);
window.removeAll(false);
window.destroy();
group.addContainer(cont, 'GBFixed', window.id, true, pos);
group.doLayout();
cont.getTopToolbar().doLayout();
}
}];
case 'GBAlwaysFloating':
default:
if (behaviour == 'GBFloating')
var tools = [{
id: 'pin',
handler: function(ev,el,window) {
window.getEl().fadeOut({callback: function() {
var pos = group.items.indexOf(window);
var cont = window.get(0);
window.removeAll(false);
window.destroy();
group.addContainer(cont, 'GBFixed', window.id, true, pos);
group.doLayout();
}});
}
}];
else if(behaviour == 'GBModal') {
this.disable();
// also disable all windows
this.items.each(function(cont) {
cont.disable();
});
this.modalDlg = true;
}
var panel = {
xtype: 'window',
cls: 'GroupFloating',
id: id,
initHidden: false,
closable: false,
resizable: false,
shadow: false,
items: [cont],
title: cont.description || "No Description",
tools: tools
tools: tools,
disabled: this.modalDlg && behaviour != 'GBModal',
listeners: {
afterrender: function(p) {
if(behaviour == 'GBModal')
p.toFront();
else
p.toBack();
p.el.fadeIn();
},
destroy: function(){
if(behaviour == 'GBModal') {
this.enable();
this.items.each(function(cont) {
cont.enable();
});
this.modalDlg = false;
}
}.createDelegate(this)
}
};
break;
}
......@@ -122,22 +134,78 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
focusContainer: function(cont) {
if(cont == this.focusedContainer)
return;
var groupTbar = this.getTopToolbar();
if(Ext.isDefined(this.focusedContainer)) {
// copy top toolbar back to container
var prevTbar = this.focusedContainer.get(0).getTopToolbar();
this.copyTbar(groupTbar, prevTbar);
if (prevTbar) {
var groupTbar = this.getTopToolbar();
groupTbar.items.each(function(item) {
if(item.undockControl)
item.destroy();
});
this.copyTbar(groupTbar, prevTbar);
}
this.focusedContainer.unfocusFixed();
} else {
groupTbar.removeAll();
}
this.mkSharedTbar(cont);
// focus container
cont.focusFixed();
this.focusedContainer = cont;
},
mkSharedTbar: function(cont) {
var groupTbar = this.getTopToolbar();
groupTbar.removeAll();
// copy top toolbar to shared group toolbar
var taskTbar = cont.get(0).getTopToolbar();
if(taskTbar)
if(taskTbar) {
this.copyTbar(taskTbar, groupTbar);
}
if(cont.undockable) {
// add undock button to toolbar for undockable tasks
var group = this;
var undockButton = {
iconCls: 'icon-unpin',
cls: 'GroupToolbarUndockControls',
handler: function() {
var panel = group.focusedContainer;
panel.getEl().fadeOut({callback: function() {
var pos = group.items.indexOf(panel);
delete group.focusedContainer;
var cont = panel.get(0);
panel.removeAll(false);
panel.destroy();
// copy toolbar back from shared one
var contTbar = cont.getTopToolbar();
if(contTbar) {
var groupTbar = group.getTopToolbar();
groupTbar.items.each(function(item) {
if(item.undockControl)
item.destroy();
});
group.copyTbar(groupTbar, contTbar);
}
group.addContainer(cont, 'GBFloating', panel.id, false, pos);
group.doLayout();
group.focusFirstContainer();
}});
},
undockControl: true
};
if(groupTbar.items.length > 0)
groupTbar.add({xtype: 'tbseparator', undockControl: true});
groupTbar.add(undockButton);
groupTbar.doLayout();
}
groupTbar.setVisible(groupTbar.items.length > 0);
//apply the taskId to the new TB, so that attachTaskHandlers nows on which subtask the actions should
......@@ -148,10 +216,6 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
});
});
itasks.ttc.common.attachTaskHandlers(groupTbar,cont.get(0).taskId);
// focus container
cont.focusFixed();
this.focusedContainer = cont;
},
copyTbar: function(src,dst) {
......@@ -228,6 +292,10 @@ itasks.ttc.GroupContainer = Ext.extend(Ext.Panel,{
this.removeContainer(this.items.length-1);
}
if(Ext.isDefined(this.focusedContainer) && this.focusedContainer.get(0).getTopToolbar() && this.focusedContainer.get(0).getTopToolbar().items.length > 0) {
this.mkSharedTbar(this.focusedContainer);
}
this.doLayout();
},
......
......@@ -10,13 +10,11 @@ itasks.ttc.InstructionContainer = Ext.extend(Ext.Panel,{
, items: [
{ xtype: 'panel'
, unstyled: true
, html: this.label
, width: 700
, html: this.label
, cls: 'InstructionContainer-Description task-description'
},
{ xtype: 'panel'
, unstyled: true
, width: 700
, html: this.instruction
, cls: 'InstructionContainer-Text'
, buttons: [
......@@ -37,7 +35,6 @@ itasks.ttc.InstructionContainer = Ext.extend(Ext.Panel,{
if(this.context != null){
this.insert(1,{
xtype: 'panel',
width: 700,
//html: '<div class="task-description">Context Information:</div>'+this.context,
html: this.context,
unstyled: true,
......
......@@ -5,19 +5,18 @@ itasks.ttc.ProcessControlContainer = Ext.extend(Ext.Panel,{
Ext.apply(this,
{ unstyled: true
, cls: 'ProcessControlContainer'
, cls: 'ProcessControlContainer'
, description: 'Control process properties'
, items: [
{ xtype: 'panel'
, cls: 'ProcessControlDescription task-description'
, unstyled: true
, html: 'Control process properties'
, width: 700
},
{ xtype: 'panel'
, unstyled: true
, layout: "form"
, defaultType: "staticfield"
, width: 700
, cls: 'ProcessControlPanel'
, items: [
{ html: "Waiting for <i>" + this.properties.managerProps.subject + "</i>"
......
......@@ -42,28 +42,34 @@
display: none;
}
.GroupFixedNoFocus .FormPanel {
.GroupFixedNoFocus .FormPanel,
.GroupFixedNoFocus .ProcessControlPanel,
.GroupFixedNoFocus .InstructionContainer-Text,
.GroupFixedNoFocus .InstructionContainer-Context {
background-image : url('img/ttc-icons/TTCBackgroundNoFocus.png') !important;
border-bottom:1px solid #ddd;
border-left:1px solid #ddd;
border-right:1px solid #ddd;
}
.GroupFixedNoFocus .FormDescription {
.GroupFixedNoFocus .task-description {
background-image: url("img/ttc-icons/TTCDescriptionBackgroundNoFocus.png") !important;
border:1px solid #ddd;
}
.GroupFixedNoFocus div.task-description {
.GroupFixedNoFocus .task-description {
color:#888899;
}
.GroupFloating .FormPanel {
.GroupFloating .FormPanel,
.GroupFloating .ProcessControlPanel,
.GroupFloating .InstructionContainer-Text,
.GroupFloating .InstructionContainer-Context {
margin: 0px;
border: none;
}
.GroupFloating .FormDescription {
.GroupFloating .task-description {
display: none;
}
......@@ -71,10 +77,6 @@
width: auto;
}*/
.GroupFloating .GroupToolbarUndockControls {
display: none;
}
.GroupFloating .GroupToolbarNoEnabledItems {
display: none;
}
......@@ -205,6 +207,7 @@
background-repeat: repeat-x;
border: 1px solid #99BBE8;
margin: 10px 0px 0px 10px;
width: 700px;
}
.ProcessControlPanel {
......@@ -214,6 +217,7 @@
border-bottom: 1px solid #99BBE8;
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
width: 700px;
}
......
......@@ -147,10 +147,10 @@ textEditorMain sid = GBFixed @>> (
updateShared "Text Editor" [MenuParamAction ("openFile", Always):(map MenuAction actions)] sid [titleListener,mainEditor]
>>= \(action, _). case action of
ActionNew = writeDB sid initState >>| return (AppAction (Extend [textEditorMain sid]))
ActionOpen = return (AppAction (Extend [textEditorMain sid, open sid <<@ subtaskBehaviour]))
ActionOpen = return (AppAction (Extend [textEditorMain sid, open sid <<@ GBModal]))
ActionParam "openFile" fid = openFile (DBRef (toInt fid)) sid >>| return (AppAction (Extend [textEditorMain sid]))
ActionSave = save sid >>| return (AppAction (Extend [textEditorMain sid]))
ActionSaveAs = return (AppAction (Extend [textEditorMain sid, saveAs sid <<@ subtaskBehaviour]))
ActionSaveAs = return (AppAction (Extend [textEditorMain sid, saveAs sid <<@ GBModal]))
ActionReplace = return (AppAction (Extend [textEditorMain sid, replaceT sid <<@ subtaskBehaviour]))
ActionStats = return (AppAction (Extend [textEditorMain sid, statistics sid <<@ subtaskBehaviour]))
ActionShowAbout = return (AppAction (Extend [textEditorMain sid, about <<@ subtaskBehaviour]))
......
......@@ -170,7 +170,7 @@ where
Stop = (TaskFinished pst.state,pst,tst)
Continue = processAllTasks pst (inc idx) tst
Extend tlist
# pst = {PSt | pst & tasks = pst.tasks ++ [(assignTask task,False) \\ task <- tlist]}
# pst = {PSt | pst & tasks = pst.tasks ++ (if (isJust mbParType) id reverse) [(assignTask task,False) \\ task <- tlist]}
= processAllTasks pst (inc idx) tst
loadPSt taskNr tst
......
......@@ -94,7 +94,7 @@ buildTaskPanel tree menus currentUser tst = case tree of
# container = (TTCGroupContainer {TTCGroupContainer
| xtype = "itasks.ttc.group"
, taskId = ti.TaskInfo.taskId
, content = containers
, content = reverse containers
})
= (container,tst)
(TTParallelTask ti tpi tasks)
......
......@@ -79,4 +79,5 @@ from TUIDefinition import :: TUIDef, :: TUIUpdate
:: GroupedBehaviour = GBFixed //The editor is fixed in the window, user can undock editor (making it floating)
| GBFloating //The editor is shown in a floating window, user can dock editor (making it fixed)
| GBAlwaysFixed //Same as Fixed, but user cannot undock
| GBAlwaysFloating //Same as Floating, but user cannot dock
\ No newline at end of file
| GBAlwaysFloating //Same as Floating, but user cannot dock
| GBModal //The editor is shown in a modal dialog
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment