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');
itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
initComponent : function() {
this.buildComponents(this);
this.tbar = this.content.tbar;
this.replaceItems = [];
delete this.content;
Ext.apply(this,
......@@ -19,9 +17,8 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
, autoScroll: true
, cls: 'FormContainer'
});
itasks.ttc.FormContainer.superclass.initComponent.apply(this,arguments);
},
buildComponents: function(data){
......@@ -33,8 +30,10 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
}
this.descpanel = {
xtype: 'itasks.ttc.form.description',
html: data.description
xtype: 'itasks.ttc.common.description',
cls: 'FormDescription',
description: data.description,
headerButton: this.headerButton
}
},
......@@ -202,31 +201,43 @@ itasks.ttc.FormContainer = Ext.extend(Ext.Panel, {
enabledPresent = true;
break;
}
var cls = 'GroupToolbarNoEnabledItems';
var cls = 'ToolbarNoEnabledItems';
if(enabledPresent)
tb.removeClass(cls);
else {
tb.removeClass(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, {
initComponent : function(){
......@@ -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.panel', itasks.ttc.form.FormPanel);
Ext.reg('itasks.ttc.form.description', itasks.ttc.form.FormDescription);
/*
itasks.ttc.FormContainer = Ext.extend(Ext.Panel,{
......
This diff is collapsed.
......@@ -8,10 +8,10 @@ itasks.ttc.InstructionContainer = Ext.extend(Ext.Panel,{
, unstyled: true
, taskUpdates : {}
, items: [
{ xtype: 'panel'
, unstyled: true
, html: this.label
, cls: 'InstructionContainer-Description task-description'
{ xtype: 'itasks.ttc.common.description'
, cls: 'InstructionContainer-Description'
, description: this.label
, headerButton: this.headerButton
},
{ xtype: 'panel'
, unstyled: true
......
......@@ -32,8 +32,10 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
}
this.descpanel = {
xtype: 'itasks.ttc.message.description',
html: data.description
xtype: 'itasks.ttc.common.description',
cls: 'MessageDescription',
description: data.description,
headerButton: this.headerButton
}
},
......@@ -54,7 +56,7 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
if(delay) {
new Ext.util.DelayedTask().delay(250,this.sendUpdates,this);
} else {
var wt = this.findParentByType(itasks.WorkPanel);
var wt = this.findParentByType(itasks.WorkPanel) || this.workPanel;
if(!wt) return;
wt.sendTaskUpdates(this.taskId,this.taskUpdates);
......@@ -72,30 +74,43 @@ itasks.ttc.MessageContainer = Ext.extend(Ext.Panel, {
enabledPresent = true;
break;
}
var cls = 'GroupToolbarNoEnabledItems';
var cls = 'ToolbarNoEnabledItems';
if(enabledPresent)
tb.removeClass(cls);
else {
tb.removeClass(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');
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, {
initComponent : function(){
......@@ -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.panel', itasks.ttc.message.MessagePanel);
Ext.reg('itasks.ttc.message.description', itasks.ttc.message.MessageDescription);
\ No newline at end of file
Ext.reg('itasks.ttc.message.panel', itasks.ttc.message.MessagePanel);
\ No newline at end of file
......@@ -7,17 +7,31 @@ itasks.ttc.MonitorContainer = Ext.extend(Ext.Panel,{
unstyled: true
},
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);
},
update: function(data){
if(this.rendered){
this.el.update(data.html);
if(this.get(1).rendered){
this.get(1).el.update(data.html);
}else{
this.html = data.html;
this.get(1).html = data.html;
}
}
});
......
......@@ -13,7 +13,10 @@ itasks.ttc.ParallelContainer = Ext.extend(Ext.TabPanel, {
Ext.apply(this,
{ activeTab: 0
, items: []
});
});
if (Ext.isDefined(this.headerButton))
this.tbar = [this.headerButton];
itasks.ttc.ParallelContainer.superclass.initComponent.apply(this,arguments);
......@@ -132,7 +135,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{
items: [
{ xtype: 'panel'
, cls: 'task-description ParallelControlDescription'
, width: 700
, unstyled: true
, html: this.label
},
......@@ -147,7 +149,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{
this.grid
]
, cls: 'ParallelControlPanel'
, width: 700
, unstyled: true
, buttons: [
{ xtype: 'button'
......@@ -285,12 +286,6 @@ itasks.ttc.parallel.Control = Ext.extend(Ext.Panel,{
itasks.ttc.parallel.ManageWindow = Ext.extend(Ext.Window,{
initComponent : function(){
var vsize = Ext.getDoc().getViewSize();
var x = (vsize.width-735)/2;
var y = (vsize.height-300)/2;
Ext.apply(this,
{ width: 735
, height: 300
......@@ -298,8 +293,8 @@ itasks.ttc.parallel.ManageWindow = Ext.extend(Ext.Window,{
, modal: true
, closable: true
, resizable: false
, x: x
, y: y
, renderTo: this.parent.getEl()
, constrain: true
, items: [
{ xtype: 'itasks.ttc.proc-control'
, taskId: this.properties.systemProps.processId
......
......@@ -8,10 +8,10 @@ itasks.ttc.ProcessControlContainer = Ext.extend(Ext.Panel,{
, cls: 'ProcessControlContainer'
, description: 'Control process properties'
, items: [
{ xtype: 'panel'
, cls: 'ProcessControlDescription task-description'
, unstyled: true
, html: 'Control process properties'
{ xtype: 'itasks.ttc.common.description'
, cls: 'ProcessControlDescription'
, description: 'Control process properties'
, headerButton: this.headerButton
},
{ xtype: 'panel'
, unstyled: true
......
......@@ -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 @@
.GroupFixedNoFocus .ProcessControlPanel,
.GroupFixedNoFocus .InstructionContainer-Text,
.GroupFixedNoFocus .InstructionContainer-Context,
.GroupFixedNoFocus .MessagePanel {
.GroupFixedNoFocus .MessagePanel,
.GroupFixedNoFocus .MonitorPanel {
background-image : url('img/ttc-icons/TTCBackgroundNoFocus.png') !important;
border-bottom:1px solid #ddd;
border-left:1px solid #ddd;
......@@ -64,27 +65,38 @@
color:#888899;
}
.GroupFloating .x-window-body {
background-color: white;
}
.GroupFloating .GroupUnpinButton {
display: none;
}
.GroupFloating .FormPanel,
.GroupFloating .ProcessControlPanel,
.GroupFloating .InstructionContainer-Text,
.GroupFloating .InstructionContainer-Context,
.GroupFloating .MessagePanel {
.GroupFloating .MessagePanel,
.GroupFloating .MonitorPanel {
margin: 0px;
border: none;
width: auto;
}
.GroupFloating .task-description {
display: none;
}
/*.GroupFloating .FormPanel {
width: auto;
}*/
.GroupFloating .GroupToolbarNoEnabledItems {
.GroupFloating .ToolbarNoEnabledItems,
.GroupFloating .ToolbarGroupActionsOnly {
display: none;
}
.x-window-maximized .ToolbarGroupActionsOnly {
display: block;
}
/* Finished Container */
.FinishedContainer{
background-color: #eee;
......@@ -149,6 +161,7 @@
background-repeat: repeat-x;
border: 1px solid #99BBE8;
margin: 10px 0px 0px 10px;
width: 700px;
}
.ParallelControlPanel{
......@@ -158,6 +171,7 @@
border-right: 1px solid #99BBE8;
margin: 0px 0px 0px 10px;
background-repeat: repeat;
width: 700px;
}
/* Instruction Container */
......@@ -258,5 +272,29 @@
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
open sid =
getAllFileNames
>>= \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
>>= \(action,(name, Hidden fid)). case action of
ActionOk = addToRecentlyOpened name fid
......@@ -95,11 +95,11 @@ replaceT :: (DBid AppState) -> Task Void
replaceT sid = replaceT` {searchFor = "", replaceWith = ""}
where
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
ActionReplaceAll = readDB sid
>>= \(AppState (Note txt) file). writeDB sid (AppState (Note (replaceSubString v.searchFor v.replaceWith txt)) file)
>>| replaceT` v <<@ subtaskBehaviour
>>| replaceT` v
_ = stop
:: TextStatistics = { lines :: Int
......@@ -133,7 +133,7 @@ ActionReplace :== ActionLabel "replace"
ActionStats :== ActionLabel "stats"
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
titleListener = listener { listenerFrom = \(AppState _ file) -> case file of
Nothing = "New Text Document"
......@@ -146,18 +146,18 @@ where
textEditorApp :: Task Void
textEditorApp =
createDB initState
>>= \sid. dynamicGroupAOnly [textEditorMain sid] (groupActions sid)
>>= \sid. dynamicGroupAOnly [textEditorMain sid <<@ GBFixed] (groupActions sid)
>>| deleteDB sid
where
groupActions sid = [ GroupAction ActionNew (GOExtend [ignoreResult (writeDB sid initState)]) GroupAlways
, GroupAction ActionOpen (GOExtend [open sid <<@ GBModal]) GroupAlways
, GroupActionParam actionOpenFile (\fid -> GOExtend [openFile (DBRef (toInt fid)) sid]) GroupAlways
, GroupAction ActionSave (GOExtend [save sid]) (SharedPredicate sid (\(SharedValue (AppState _ file)) -> isJust file))
, GroupAction ActionSaveAs (GOExtend [saveAs sid <<@ GBModal]) GroupAlways
, GroupAction ActionReplace (GOExtend [replaceT sid <<@ subtaskBehaviour]) (SharedPredicate sid (\(SharedValue (AppState (Note txt) _)) -> txt <> ""))
, GroupAction ActionStats (GOExtend [statistics sid <<@ subtaskBehaviour]) GroupAlways
, GroupAction ActionShowAbout (GOExtend [showMessage "iTextEditor V0.01" <<@ subtaskBehaviour]) GroupAlways
, GroupAction ActionQuit GOStop GroupAlways
groupActions sid = [ GroupAction ActionNew (GOExtend [ignoreResult (writeDB sid initState)]) GroupAlways
, GroupAction ActionOpen (GOExtend [open sid <<@ GBModal]) GroupAlways
, GroupActionParam actionOpenFile (\fid -> GOExtend [openFile (DBRef (toInt fid)) sid]) GroupAlways
, GroupAction ActionSave (GOExtend [save sid]) (SharedPredicate sid (\(SharedValue (AppState _ file)) -> isJust file))
, GroupAction ActionSaveAs (GOExtend [saveAs sid <<@ GBModal]) GroupAlways
, GroupAction ActionReplace (GOExtend [replaceT sid <<@ subtaskBehaviour]) (SharedPredicate sid (\(SharedValue (AppState (Note txt) _)) -> txt <> ""))
, GroupAction ActionStats (GOExtend [statistics sid <<@ subtaskBehaviour]) GroupAlways
, GroupAction ActionShowAbout (GOExtend [showMessageAbout "About" "iTextEditor V0.01" <<@ subtaskBehaviour]) GroupAlways
, GroupAction ActionQuit GOStop GroupAlways
]
initTextEditor :: Task Void
......
......@@ -104,6 +104,7 @@ derive JSONEncode TTCFormContainer, TTCMonitorContainer, TTCResultContainer, TTC
, taskId :: !String
, content :: ![GroupContainerElement]
, subtaskId :: !(Maybe String)
, groupAMenu :: ![TUIDef]
}
:: GroupContainerElement =
......
......@@ -111,6 +111,7 @@ buildTaskPanel` tree menus gActions currentUser tst=:{menusChanged} = case tree
, taskId = ti.TaskInfo.taskId
, content = containers
, subtaskId = Nothing
, groupAMenu = makeMenuBar menus [] gActions ti
})
= (container,tst)
(TTParallelTask ti tpi tasks)
......@@ -286,6 +287,7 @@ buildSubtaskPanels tree stnr menus manager partype inClosed procProps tst=:{menu
, taskId = ti.TaskInfo.taskId
, content = reverse containers
, subtaskId = Just (subtaskNrToString stnr)
, groupAMenu = makeMenuBar menus [] gActions ti
}
}], tst)
(TTParallelTask ti tpi tasks)
......
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