Commit a919e226 authored by Steffen Michels's avatar Steffen Michels

new implementation of group-container

  - fix many problems of old version
  - put unpin buttons inside header of children
  - make windows resizable
  - show menu with group-actions for groups without fixed children
  - TODO:
    * fix small layout issues with IE
    * make parallel or other groups as children of group-container working

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@974 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 6f8c372c
...@@ -3,11 +3,9 @@ Ext.ns('itasks.ttc'); ...@@ -3,11 +3,9 @@ Ext.ns('itasks.ttc');
itasks.ttc.FormContainer = Ext.extend(Ext.Panel, { itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
initComponent : function() { initComponent : function() {
this.buildComponents(this); this.buildComponents(this);
this.tbar = this.content.tbar; this.tbar = this.content.tbar;
this.replaceItems = []; this.replaceItems = [];
delete this.content; delete this.content;
Ext.apply(this, Ext.apply(this,
...@@ -19,9 +17,8 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, { ...@@ -19,9 +17,8 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
, autoScroll: true , autoScroll: true
, cls: 'FormContainer' , cls: 'FormContainer'
}); });
itasks.ttc.FormContainer.superclass.initComponent.apply(this,arguments); itasks.ttc.FormContainer.superclass.initComponent.apply(this,arguments);
}, },
buildComponents: function(data){ buildComponents: function(data){
...@@ -33,8 +30,10 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, { ...@@ -33,8 +30,10 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
} }
this.descpanel = { this.descpanel = {
xtype: 'itasks.ttc.form.description', xtype: 'itasks.ttc.common.description',
html: data.description cls: 'FormDescription',
description: data.description,
headerButton: this.headerButton
} }
}, },
...@@ -202,31 +201,43 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, { ...@@ -202,31 +201,43 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
enabledPresent = true; enabledPresent = true;
break; break;
} }
var cls = 'GroupToolbarNoEnabledItems'; var cls = 'ToolbarNoEnabledItems';
if(enabledPresent) if(enabledPresent)
tb.removeClass(cls); tb.removeClass(cls);
else { else {
tb.removeClass(cls); tb.removeClass(cls);
tb.addClass(cls); tb.addClass(cls);
} }
},
});
Ext.ns('itasks.ttc.form');
itasks.ttc.form.FormDescription = Ext.extend(Ext.Panel,{
initComponent : function(){
Ext.apply(this,{
cls: 'task-description FormDescription',
unstyled: true,
});
itasks.ttc.form.FormDescription.superclass.initComponent.apply(this,arguments); var checkGroupOnly = function(item) {
if(item.disabled)
return true;
if(item.name) {
return item.name == '_group';
} else if (item.getXType() != 'menuseparator') {
var children = item.items || item.menu.items;
for(var i = 0; i < children.length; i++) {
if (!checkGroupOnly(children.get(i)))
return false;
}
}
return true;
};
var cls = 'ToolbarGroupActionsOnly';
if(checkGroupOnly(tb)) {
tb.removeClass(cls);
tb.addClass(cls);
} else {
tb.removeClass(cls);
}
} }
}); });
Ext.ns('itasks.ttc.form');
itasks.ttc.form.FormPanel = Ext.extend(Ext.Panel, { itasks.ttc.form.FormPanel = Ext.extend(Ext.Panel, {
initComponent : function(){ initComponent : function(){
...@@ -243,7 +254,6 @@ itasks.ttc.form.FormPanel = Ext.extend(Ext.Panel, { ...@@ -243,7 +254,6 @@ itasks.ttc.form.FormPanel = Ext.extend(Ext.Panel, {
Ext.reg('itasks.ttc.form',itasks.ttc.FormContainer); Ext.reg('itasks.ttc.form',itasks.ttc.FormContainer);
Ext.reg('itasks.ttc.form.panel', itasks.ttc.form.FormPanel); Ext.reg('itasks.ttc.form.panel', itasks.ttc.form.FormPanel);
Ext.reg('itasks.ttc.form.description', itasks.ttc.form.FormDescription);
/* /*
itasks.ttc.FormContainer = Ext.extend(Ext.Panel,{ itasks.ttc.FormContainer = Ext.extend(Ext.Panel,{
......
This diff is collapsed.
...@@ -8,10 +8,10 @@ itasks.ttc.InstructionContainer = Ext.extend(Ext.Panel,{ ...@@ -8,10 +8,10 @@ itasks.ttc.InstructionContainer = Ext.extend(Ext.Panel,{
, unstyled: true , unstyled: true
, taskUpdates : {} , taskUpdates : {}
, items: [ , items: [
{ xtype: 'panel' { xtype: 'itasks.ttc.common.description'
, unstyled: true , cls: 'InstructionContainer-Description'
, html: this.label , description: this.label
, cls: 'InstructionContainer-Description task-description' , headerButton: this.headerButton
}, },
{ xtype: 'panel' { xtype: 'panel'
, unstyled: true , unstyled: true
......
...@@ -32,8 +32,10 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, { ...@@ -32,8 +32,10 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
} }
this.descpanel = { this.descpanel = {
xtype: 'itasks.ttc.message.description', xtype: 'itasks.ttc.common.description',
html: data.description cls: 'MessageDescription',
description: data.description,
headerButton: this.headerButton
} }
}, },
...@@ -54,7 +56,7 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, { ...@@ -54,7 +56,7 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
if(delay) { if(delay) {
new Ext.util.DelayedTask().delay(250,this.sendUpdates,this); new Ext.util.DelayedTask().delay(250,this.sendUpdates,this);
} else { } else {
var wt = this.findParentByType(itasks.WorkPanel); var wt = this.findParentByType(itasks.WorkPanel) || this.workPanel;
if(!wt) return; if(!wt) return;
wt.sendTaskUpdates(this.taskId,this.taskUpdates); wt.sendTaskUpdates(this.taskId,this.taskUpdates);
...@@ -72,30 +74,43 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, { ...@@ -72,30 +74,43 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
enabledPresent = true; enabledPresent = true;
break; break;
} }
var cls = 'GroupToolbarNoEnabledItems'; var cls = 'ToolbarNoEnabledItems';
if(enabledPresent) if(enabledPresent)
tb.removeClass(cls); tb.removeClass(cls);
else { else {
tb.removeClass(cls); tb.removeClass(cls);
tb.addClass(cls); tb.addClass(cls);
} }
var checkGroupOnly = function(item) {
if(item.disabled)
return true;
if(item.name) {
return item.name == '_group';
} else if (item.getXType() != 'menuseparator') {
var children = item.items || item.menu.items;
for(var i = 0; i < children.length; i++) {
if (!checkGroupOnly(children.get(i)))
return false;
}
}
return true;
};
var cls = 'ToolbarGroupActionsOnly';
if(checkGroupOnly(tb)) {
tb.removeClass(cls);
tb.addClass(cls);
} else {
tb.removeClass(cls);
}
} }
}); });
Ext.ns('itasks.ttc.message'); Ext.ns('itasks.ttc.message');
itasks.ttc.message.MessageDescription = Ext.extend(Ext.Panel,{
initComponent : function(){
Ext.apply(this,{
cls: 'task-description MessageDescription',
unstyled: true,
});
itasks.ttc.message.MessageDescription.superclass.initComponent.apply(this,arguments);
}
});
itasks.ttc.message.MessagePanel = Ext.extend(Ext.Panel, { itasks.ttc.message.MessagePanel = Ext.extend(Ext.Panel, {
initComponent : function(){ initComponent : function(){
...@@ -111,5 +126,4 @@ itasks.ttc.message.MessagePanel = Ext.extend(Ext.Panel, { ...@@ -111,5 +126,4 @@ itasks.ttc.message.MessagePanel = Ext.extend(Ext.Panel, {
}); });
Ext.reg('itasks.ttc.message',itasks.ttc.MessageContainer); Ext.reg('itasks.ttc.message',itasks.ttc.MessageContainer);
Ext.reg('itasks.ttc.message.panel', itasks.ttc.message.MessagePanel); Ext.reg('itasks.ttc.message.panel', itasks.ttc.message.MessagePanel);
Ext.reg('itasks.ttc.message.description', itasks.ttc.message.MessageDescription); \ No newline at end of file
\ No newline at end of file
...@@ -7,17 +7,31 @@ itasks.ttc.MonitorContainer = Ext.extend(Ext.Panel,{ ...@@ -7,17 +7,31 @@ itasks.ttc.MonitorContainer = Ext.extend(Ext.Panel,{
unstyled: true unstyled: true
}, },
bodyStyle: 'padding: 10px', bodyStyle: 'padding: 10px',
unstyled: true unstyled: true,
cls: 'MonitorContainer',
items: [
{ xtype: 'itasks.ttc.common.description'
, cls: 'MonitorContainerDescription'
, description: 'Monitor task'
, headerButton: this.headerButton
},
{ xtype: 'panel'
, cls: 'MonitorPanel'
, unstyled: true
, html: this.html
}
]
}); });
delete this.html;
itasks.ttc.MonitorContainer.superclass.initComponent.apply(this,arguments); itasks.ttc.MonitorContainer.superclass.initComponent.apply(this,arguments);
}, },
update: function(data){ update: function(data){
if(this.rendered){ if(this.get(1).rendered){
this.el.update(data.html); this.get(1).el.update(data.html);
}else{ }else{
this.html = data.html; this.get(1).html = data.html;
} }
} }
}); });
......
...@@ -13,7 +13,10 @@ itasks.ttc.ParallelContainer = Ext.extend(Ext.TabPanel, { ...@@ -13,7 +13,10 @@ itasks.ttc.ParallelContainer = Ext.extend(Ext.TabPanel, {
Ext.apply(this, Ext.apply(this,
{ activeTab: 0 { activeTab: 0
, items: [] , items: []
}); });
if (Ext.isDefined(this.headerButton))
this.tbar = [this.headerButton];
itasks.ttc.ParallelContainer.superclass.initComponent.apply(this,arguments); itasks.ttc.ParallelContainer.superclass.initComponent.apply(this,arguments);
...@@ -132,7 +135,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{ ...@@ -132,7 +135,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{
items: [ items: [
{ xtype: 'panel' { xtype: 'panel'
, cls: 'task-description ParallelControlDescription' , cls: 'task-description ParallelControlDescription'
, width: 700
, unstyled: true , unstyled: true
, html: this.label , html: this.label
}, },
...@@ -147,7 +149,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{ ...@@ -147,7 +149,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{
this.grid this.grid
] ]
, cls: 'ParallelControlPanel' , cls: 'ParallelControlPanel'
, width: 700
, unstyled: true , unstyled: true
, buttons: [ , buttons: [
{ xtype: 'button' { xtype: 'button'
...@@ -285,12 +286,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{ ...@@ -285,12 +286,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{
itasks.ttc.parallel.ManageWindow = Ext.extend(Ext.Window,{ itasks.ttc.parallel.ManageWindow = Ext.extend(Ext.Window,{
initComponent : function(){ initComponent : function(){
var vsize = Ext.getDoc().getViewSize();
var x = (vsize.width-735)/2;
var y = (vsize.height-300)/2;
Ext.apply(this, Ext.apply(this,
{ width: 735 { width: 735
, height: 300 , height: 300
...@@ -298,8 +293,8 @@ itasks.ttc.parallel.ManageWindow = Ext.extend(Ext.Window,{ ...@@ -298,8 +293,8 @@ itasks.ttc.parallel.ManageWindow = Ext.extend(Ext.Window,{
, modal: true , modal: true
, closable: true , closable: true
, resizable: false , resizable: false
, x: x , renderTo: this.parent.getEl()
, y: y , constrain: true
, items: [ , items: [
{ xtype: 'itasks.ttc.proc-control' { xtype: 'itasks.ttc.proc-control'
, taskId: this.properties.systemProps.processId , taskId: this.properties.systemProps.processId
......
...@@ -8,10 +8,10 @@ itasks.ttc.ProcessControlContainer = Ext.extend(Ext.Panel,{ ...@@ -8,10 +8,10 @@ itasks.ttc.ProcessControlContainer = Ext.extend(Ext.Panel,{
, cls: 'ProcessControlContainer' , cls: 'ProcessControlContainer'
, description: 'Control process properties' , description: 'Control process properties'
, items: [ , items: [
{ xtype: 'panel' { xtype: 'itasks.ttc.common.description'
, cls: 'ProcessControlDescription task-description' , cls: 'ProcessControlDescription'
, unstyled: true , description: 'Control process properties'
, html: 'Control process properties' , headerButton: this.headerButton
}, },
{ xtype: 'panel' { xtype: 'panel'
, unstyled: true , unstyled: true
......
...@@ -135,4 +135,23 @@ itasks.ttc.common.attachDocumentLinkInformation = function() { ...@@ -135,4 +135,23 @@ itasks.ttc.common.attachDocumentLinkInformation = function() {
} }
} }
} }
}; };
\ No newline at end of file
itasks.ttc.common.DescriptionPanel = Ext.extend(Ext.Panel,{
initComponent : function(){
Ext.apply(this,{
cls: this.cls + ' task-description',
unstyled: true
});
if(Ext.isDefined(this.headerButton)) {
this.items = [{html: this.description, unstyled: true, columnWidth: 1}, this.headerButton];
this.layout = 'column';
} else {
this.html = this.description;
}
itasks.ttc.common.DescriptionPanel.superclass.initComponent.apply(this,arguments);
}
});
Ext.reg('itasks.ttc.common.description', itasks.ttc.common.DescriptionPanel);
\ No newline at end of file
...@@ -47,7 +47,8 @@ ...@@ -47,7 +47,8 @@
.GroupFixedNoFocus .ProcessControlPanel, .GroupFixedNoFocus .ProcessControlPanel,
.GroupFixedNoFocus .InstructionContainer-Text, .GroupFixedNoFocus .InstructionContainer-Text,
.GroupFixedNoFocus .InstructionContainer-Context, .GroupFixedNoFocus .InstructionContainer-Context,
.GroupFixedNoFocus .MessagePanel { .GroupFixedNoFocus .MessagePanel,
.GroupFixedNoFocus .MonitorPanel {
background-image : url('img/ttc-icons/TTCBackgroundNoFocus.png') !important; background-image : url('img/ttc-icons/TTCBackgroundNoFocus.png') !important;
border-bottom:1px solid #ddd; border-bottom:1px solid #ddd;
border-left:1px solid #ddd; border-left:1px solid #ddd;
...@@ -64,27 +65,38 @@ ...@@ -64,27 +65,38 @@
color:#888899; color:#888899;
} }
.GroupFloating .x-window-body {
background-color: white;
}
.GroupFloating .GroupUnpinButton {
display: none;
}
.GroupFloating .FormPanel, .GroupFloating .FormPanel,
.GroupFloating .ProcessControlPanel, .GroupFloating .ProcessControlPanel,
.GroupFloating .InstructionContainer-Text, .GroupFloating .InstructionContainer-Text,
.GroupFloating .InstructionContainer-Context, .GroupFloating .InstructionContainer-Context,
.GroupFloating .MessagePanel { .GroupFloating .MessagePanel,
.GroupFloating .MonitorPanel {
margin: 0px; margin: 0px;
border: none; border: none;
width: auto;
} }
.GroupFloating .task-description { .GroupFloating .task-description {
display: none; display: none;
} }
/*.GroupFloating .FormPanel { .GroupFloating .ToolbarNoEnabledItems,
width: auto; .GroupFloating .ToolbarGroupActionsOnly {
}*/
.GroupFloating .GroupToolbarNoEnabledItems {
display: none; display: none;
} }
.x-window-maximized .ToolbarGroupActionsOnly {
display: block;
}
/* Finished Container */ /* Finished Container */
.FinishedContainer{ .FinishedContainer{
background-color: #eee; background-color: #eee;
...@@ -149,6 +161,7 @@ ...@@ -149,6 +161,7 @@
background-repeat: repeat-x; background-repeat: repeat-x;
border: 1px solid #99BBE8; border: 1px solid #99BBE8;
margin: 10px 0px 0px 10px; margin: 10px 0px 0px 10px;
width: 700px;
} }
.ParallelControlPanel{ .ParallelControlPanel{
...@@ -158,6 +171,7 @@ ...@@ -158,6 +171,7 @@
border-right: 1px solid #99BBE8; border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px; margin: 0px 0px 0px 10px;
background-repeat: repeat; background-repeat: repeat;
width: 700px;
} }
/* Instruction Container */ /* Instruction Container */
...@@ -258,5 +272,29 @@ ...@@ -258,5 +272,29 @@
width: 700px; width: 700px;
} }
/* Monitor Container */
.MonitorContainer {
background-color: #eee;
#background-image : url('img/ttc-icons/TTCMessageContainer.png') !important;
background-repeat: no-repeat ;
background-position: 3px 3px;
}
.MonitorPanel {
background-image : url('img/ttc-icons/TTCBackground80.png') !important;
padding: 4px;
border-left: 1px solid #99BBE8;
border-bottom: 1px solid #99BBE8;
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
width: 700px;
background-repeat: repeat;
}
.MonitorContainerDescription {
background-image : url('img/ttc-icons/TTCDescriptionBackground.png') !important;
background-repeat: repeat-x;
border: 1px solid #99BBE8;
margin: 10px 0px 0px 10px;
width: 700px;
}
...@@ -55,7 +55,7 @@ open :: (DBid AppState) -> Task Void ...@@ -55,7 +55,7 @@ open :: (DBid AppState) -> Task Void
open sid = open sid =
getAllFileNames getAllFileNames
>>= \files. if (isEmpty files) >>= \files. if (isEmpty files)
(showMessage "No files to open!") (showMessageAbout "Open File" "No files to open!")
( enterChoiceA "Open File" [ButtonAction (ActionCancel, Always), ButtonAction (ActionOk, IfValid)] files ( enterChoiceA "Open File" [ButtonAction (ActionCancel, Always), ButtonAction (ActionOk, IfValid)] files
>>= \(action,(name, Hidden fid)). case action of >>= \(action,(name, Hidden fid)). case action of
ActionOk = addToRecentlyOpened name fid ActionOk = addToRecentlyOpened name fid
...@@ -95,11 +95,11 @@ replaceT :: (DBid AppState) -> Task Void ...@@ -95,11 +95,11 @@ replaceT :: (DBid AppState) -> Task Void
replaceT sid = replaceT` {searchFor = "", replaceWith = ""} replaceT sid = replaceT` {searchFor = "", replaceWith = ""}
where where
replaceT` repl = replaceT` repl =
updateInformationA "Replace..." [ButtonAction (ActionClose, Always), ButtonAction (ActionReplaceAll, IfValid)] repl updateInformationA "Replace" [ButtonAction (ActionClose, Always), ButtonAction (ActionReplaceAll, IfValid)] repl
>>= \(action, v). case action of >>= \(action, v). case action of
ActionReplaceAll = readDB sid ActionReplaceAll = readDB sid
>>= \(AppState (Note txt) file). writeDB sid (AppState (Note (replaceSubString v.searchFor v.replaceWith txt)) file) >>= \(AppState (Note txt) file). writeDB sid (AppState (Note (replaceSubString v.searchFor v.replaceWith txt)) file)
>>| replaceT` v <<@ subtaskBehaviour >>| replaceT` v
_ = stop _ = stop
:: TextStatistics = { lines :: Int :: TextStatistics = { lines :: Int
...@@ -133,7 +133,7 @@ ActionReplace :== ActionLabel "replace" ...@@ -133,7 +133,7 @@ ActionReplace :== ActionLabel "replace"
ActionStats :== ActionLabel "stats" ActionStats :== ActionLabel "stats"
textEditorMain :: (DBid AppState) -> Task Void textEditorMain :: (DBid AppState) -> Task Void
textEditorMain sid = GBFixed @>> ignoreResult (updateShared "Text Editor" [] sid [titleListener,mainEditor]) textEditorMain sid = ignoreResult (updateShared "Text Editor" [] sid [titleListener,mainEditor])
where where
titleListener = listener { listenerFrom = \(AppState _ file) -> case file of titleListener = listener { listenerFrom = \(AppState _ file) -> case file of
Nothing = "New Text Document" Nothing = "New Text Document"
...@@ -146,18 +146,18 @@ where ...@@ -146,18 +146,18 @@ where
textEditorApp :: Task Void textEditorApp :: Task Void
textEditorApp = textEditorApp =
createDB initState createDB initState
>>= \sid. dynamicGroupAOnly [textEditorMain sid] (groupActions sid) >>= \sid. dynamicGroupAOnly [textEditorMain sid