13 |
13 |
14 |
14 |
15 |
15 |
16 |
16 |
17 ResourceSpecEditor subclass:#DataSetBuilder |
17 ResourceSpecEditor subclass:#DataSetBuilder |
18 instanceVariableNames:'rowClass rowSuperClass hasChanged columnView columns |
18 instanceVariableNames:'rowClass rowSuperClass columnView columns selectedColumnIndex |
19 selectedColumnIndex tabSelectionIndex' |
19 modalOpened' |
20 classVariableNames:'' |
20 classVariableNames:'' |
21 poolDictionaries:'' |
21 poolDictionaries:'' |
22 category:'Interface-UIPainter' |
22 category:'Interface-UIPainter' |
23 ! |
23 ! |
24 |
24 |
25 !DataSetBuilder class methodsFor:'documentation'! |
25 !DataSetBuilder class methodsFor:'documentation'! |
26 |
26 |
27 copyright |
27 copyright |
28 " |
28 " |
29 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
29 COPYRIGHT (c) 1997 by eXept Software AG |
30 All Rights Reserved |
30 All Rights Reserved |
31 |
31 |
32 This software is furnished under a license and may be used |
32 This software is furnished under a license and may be used |
33 only in accordance with the terms of that license and with the |
33 only in accordance with the terms of that license and with the |
34 inclusion of the above copyright notice. This software may not |
34 inclusion of the above copyright notice. This software may not |
1103 |
1145 |
1104 #(#FullSpec |
1146 #(#FullSpec |
1105 #window: |
1147 #window: |
1106 #(#WindowSpec |
1148 #(#WindowSpec |
1107 #name: 'Data Set Builder' |
1149 #name: 'Data Set Builder' |
1108 #layout: #(#LayoutFrame 487 0 189 0 1031 0 690 0) |
1150 #layout: #(#LayoutFrame 314 0 309 0 853 0 808 0) |
1109 #label: 'Data Set Builder' |
1151 #label: 'Data Set Builder' |
1110 #min: #(#Point 10 10) |
1152 #min: #(#Point 10 10) |
1111 #max: #(#Point 1152 900) |
1153 #max: #(#Point 1152 900) |
1112 #bounds: #(#Rectangle 487 189 1032 691) |
1154 #bounds: #(#Rectangle 314 309 854 809) |
1113 #menu: #menu |
1155 #menu: #menu |
1114 #usePreferredExtent: false |
1156 #usePreferredExtent: false |
1115 ) |
1157 ) |
1116 #component: |
1158 #component: |
1117 #(#SpecCollection |
1159 #(#SpecCollection |
1118 #collection: |
1160 #collection: |
1119 #( |
1161 #( |
1120 #(#ViewSpec |
1162 #(#MenuPanelSpec |
1121 #name: 'Box1' |
1163 #name: 'menuToolbarView' |
1122 #layout: #(#LayoutFrame 0 0.0 100 0.0 0 1.0 0 1.0) |
1164 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) |
|
1165 #menu: #menuToolbar |
|
1166 ) |
|
1167 #(#VariableVerticalPanelSpec |
|
1168 #name: 'VariableVerticalPanel1' |
|
1169 #layout: #(#LayoutFrame 0 0.0 38 0.0 0 1.0 -26 1.0) |
1123 #component: |
1170 #component: |
1124 #(#SpecCollection |
1171 #(#SpecCollection |
1125 #collection: |
1172 #collection: |
1126 #( |
1173 #( |
1127 #(#MenuPanelSpec |
1174 #(#FramedBoxSpec |
1128 #name: 'menuToolbarView' |
1175 #name: 'FramedBox' |
1129 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) |
1176 #component: |
1130 #menu: #menuToolbar |
1177 #(#SpecCollection |
|
1178 #collection: |
|
1179 #( |
|
1180 #(#DataSetSpec |
|
1181 #name: 'columnView' |
|
1182 #layout: #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0) |
|
1183 #hasHorizontalScrollBar: true |
|
1184 #hasVerticalScrollBar: false |
|
1185 #miniScrollerHorizontal: true |
|
1186 #rowClassName: 'CodingExamples_GUI::GUIDemoDataSetView::Row' |
|
1187 #useIndex: false |
|
1188 #has3Dsepartors: true |
|
1189 ) |
|
1190 ) |
|
1191 ) |
|
1192 #label: 'Table Columns' |
|
1193 #labelPosition: #topLeft |
1131 ) |
1194 ) |
1132 #(#VariableHorizontalPanelSpec |
1195 #(#VariableHorizontalPanelSpec |
1133 #name: 'VariablePanel' |
1196 #name: 'VariablePanel' |
1134 #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
|
1135 #component: |
1197 #component: |
1136 #(#SpecCollection |
1198 #(#SpecCollection |
1137 #collection: |
1199 #collection: |
1138 #( |
1200 #( |
1139 #(#ViewSpec |
1201 #(#ViewSpec |
1184 ) |
1246 ) |
1185 #level: -1 |
1247 #level: -1 |
1186 ) |
1248 ) |
1187 ) |
1249 ) |
1188 ) |
1250 ) |
1189 #handles: #(#Any 0.346072 1.0) |
1251 #level: -1 |
1190 ) |
1252 #handles: #(#Any 0.311111 1.0) |
1191 #(#UISubSpecification |
|
1192 #name: 'infoBarSubSpec' |
|
1193 #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
1194 #majorKey: #ToolApplicationModel |
|
1195 #minorKey: #windowSpecForInfoBar |
|
1196 ) |
1253 ) |
1197 ) |
1254 ) |
1198 ) |
1255 ) |
|
1256 #handles: #(#Any 0.25 1.0) |
1199 ) |
1257 ) |
1200 #(#FramedBoxSpec |
1258 #(#UISubSpecification |
1201 #name: 'ColumnFrame' |
1259 #name: 'infoBarSubSpec' |
1202 #layout: #(#LayoutFrame 0 0.0 5 0.0 0 1.0 100 0) |
1260 #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
1203 #component: |
1261 #majorKey: #ToolApplicationModel |
1204 #(#SpecCollection |
1262 #minorKey: #windowSpecForInfoBar |
1205 #collection: |
|
1206 #( |
|
1207 #(#DataSetSpec |
|
1208 #name: 'columnView' |
|
1209 #layout: #(#LayoutFrame 14 0.0 18 0.0 14 1.0 14 1.0) |
|
1210 #hasHorizontalScrollBar: true |
|
1211 #hasVerticalScrollBar: false |
|
1212 #miniScrollerHorizontal: true |
|
1213 #rowClassName: 'CodingExamples_GUI::GUIDemoDataSetView::Row' |
|
1214 #useIndex: false |
|
1215 #has3Dsepartors: true |
|
1216 ) |
|
1217 ) |
|
1218 ) |
|
1219 #label: 'Table Columns' |
|
1220 #labelPosition: #topLeft |
|
1221 ) |
1263 ) |
1222 ) |
1264 ) |
1223 ) |
1265 ) |
1224 ) |
1266 ) |
1225 ! ! |
1267 ! ! |
1361 ) nil |
1403 ) nil |
1362 nil |
1404 nil |
1363 ) |
1405 ) |
1364 ) |
1406 ) |
1365 #(#MenuItem |
1407 #(#MenuItem |
1366 #label: 'History' |
1408 #label: 'Settings' |
1367 #activeHelpKey: #history |
|
1368 #submenuChannel: #menuHistory |
|
1369 ) |
|
1370 #(#MenuItem |
|
1371 #label: 'Help' |
|
1372 #startGroup: #right |
|
1373 #submenu: |
1409 #submenu: |
1374 #(#Menu |
1410 #(#Menu |
1375 |
1411 |
1376 #( |
1412 #( |
1377 #(#MenuItem |
1413 #(#MenuItem |
1378 #label: 'Documentation' |
1414 #label: 'Fonts' |
1379 #value: #openHTMLDocument: |
1415 #submenuChannel: #menuFont |
1380 #activeHelpKey: #helpTutorial |
|
1381 #argument: 'tools/uipainter/DataSetBuilder.html' |
|
1382 ) |
|
1383 #(#MenuItem |
|
1384 #label: '-' |
|
1385 ) |
|
1386 #(#MenuItem |
|
1387 #label: 'Help Tool' |
|
1388 #value: #openHTMLDocument: |
|
1389 #activeHelpKey: #helpHelpTool |
|
1390 #argument: 'tools/uipainter/HelpTool.html' |
|
1391 ) |
|
1392 #(#MenuItem |
|
1393 #label: '-' |
|
1394 ) |
|
1395 #(#MenuItem |
|
1396 #label: 'Show Help Texts' |
|
1397 #activeHelpKey: #helpShowHelp |
|
1398 #indication: #showHelp: |
|
1399 ) |
1416 ) |
1400 ) nil |
1417 ) nil |
1401 nil |
1418 nil |
1402 ) |
1419 ) |
1403 ) |
1420 ) |
|
1421 #(#MenuItem |
|
1422 #label: 'History' |
|
1423 #activeHelpKey: #history |
|
1424 #submenuChannel: #menuHistory |
|
1425 ) |
|
1426 #(#MenuItem |
|
1427 #label: 'Help' |
|
1428 #startGroup: #right |
|
1429 #submenuChannel: #menuHelp |
|
1430 ) |
1404 ) nil |
1431 ) nil |
1405 nil |
1432 nil |
1406 ) |
1433 ) |
1407 ! |
1434 ! |
1408 |
1435 |
1409 menuEdit |
1436 menuEdit |
1410 "this window spec was automatically generated by the ST/X MenuEditor" |
1437 "This resource specification was automatically generated |
1411 |
1438 by the MenuEditor of ST/X." |
1412 "do not manually edit this - the builder may not be able to |
1439 |
1413 handle the specification if its corrupted." |
1440 "Do not manually edit this!! If it is corrupted, |
|
1441 the MenuEditor may not be able to read the specification." |
1414 |
1442 |
1415 " |
1443 " |
1416 MenuEditor new openOnClass:DataSetBuilder andSelector:#menuEdit |
1444 MenuEditor new openOnClass:DataSetBuilder andSelector:#menuEdit |
1417 (Menu new fromLiteralArrayEncoding:(DataSetBuilder menuEdit)) startUp |
1445 (Menu new fromLiteralArrayEncoding:(DataSetBuilder menuEdit)) startUp |
1418 " |
1446 " |
1423 |
1451 |
1424 #(#Menu |
1452 #(#Menu |
1425 |
1453 |
1426 #( |
1454 #( |
1427 #(#MenuItem |
1455 #(#MenuItem |
1428 #'label:' 'Cut' |
1456 #label: 'Cut' |
1429 #'value:' #doCutColumn |
1457 #value: #doCut |
1430 #'activeHelpKey:' #editCut |
1458 #activeHelpKey: #editCut |
1431 #'enabled:' #isColumnSelected |
1459 #enabled: #isColumnSelected |
1432 ) |
1460 ) |
1433 #(#MenuItem |
1461 #(#MenuItem |
1434 #'label:' 'Copy' |
1462 #label: 'Copy' |
1435 #'value:' #doCopyColumn |
1463 #value: #doCopy |
1436 #'activeHelpKey:' #editCopy |
1464 #activeHelpKey: #editCopy |
1437 #'enabled:' #isColumnSelected |
1465 #enabled: #isColumnSelected |
1438 ) |
1466 ) |
1439 #(#MenuItem |
1467 #(#MenuItem |
1440 #'label:' 'Paste' |
1468 #label: 'Paste' |
1441 #'value:' #doPasteColumn |
1469 #value: #doPaste |
1442 #'activeHelpKey:' #editPaste |
1470 #activeHelpKey: #editPaste |
1443 #'enabled:' #valueOfHavingClipboard |
1471 #enabled: #valueOfHavingClipboard |
1444 ) |
1472 ) |
1445 #(#MenuItem |
1473 #(#MenuItem |
1446 #'label:' '-' |
1474 #label: 'Delete' |
1447 ) |
1475 #value: #doDelete |
1448 #(#MenuItem |
1476 #activeHelpKey: #editPaste |
1449 #'label:' 'Move Up' |
1477 #enabled: #valueOfHavingClipboard |
1450 #'value:' #'doMoveColumn:' |
1478 ) |
1451 #'activeHelpKey:' #editMoveUp |
1479 #(#MenuItem |
1452 #'enabled:' #isColumnSelected |
1480 #label: '-' |
1453 #'argument:' #up |
1481 ) |
1454 #'labelImage:' #(#ResourceRetriever #DataSetBuilder #upIcon 'Move Up') |
1482 #(#MenuItem |
1455 ) |
1483 #label: 'Move Up' |
1456 #(#MenuItem |
1484 #value: #doMoveColumn: |
1457 #'label:' 'Move Down' |
1485 #activeHelpKey: #editMoveUp |
1458 #'value:' #'doMoveColumn:' |
1486 #enabled: #isColumnSelected |
1459 #'activeHelpKey:' #editMoveDown |
1487 #argument: #up |
1460 #'enabled:' #isColumnSelected |
1488 #labelImage: #(#ResourceRetriever #DataSetBuilder #upIcon 'Move Up') |
1461 #'argument:' #down |
1489 ) |
1462 #'labelImage:' #(#ResourceRetriever #DataSetBuilder #downIcon 'Move Down') |
1490 #(#MenuItem |
|
1491 #label: 'Move Down' |
|
1492 #value: #doMoveColumn: |
|
1493 #activeHelpKey: #editMoveDown |
|
1494 #enabled: #isColumnSelected |
|
1495 #argument: #down |
|
1496 #labelImage: #(#ResourceRetriever #DataSetBuilder #downIcon 'Move Down') |
1463 ) |
1497 ) |
1464 ) nil |
1498 ) nil |
1465 nil |
1499 nil |
1466 ) |
1500 ) |
1467 ! |
1501 ! |
1468 |
1502 |
1469 menuToolbar |
1503 menuToolbar |
1470 "this window spec was automatically generated by the ST/X MenuEditor" |
1504 "This resource specification was automatically generated |
1471 |
1505 by the MenuEditor of ST/X." |
1472 "do not manually edit this - the builder may not be able to |
1506 |
1473 handle the specification if its corrupted." |
1507 "Do not manually edit this!! If it is corrupted, |
|
1508 the MenuEditor may not be able to read the specification." |
1474 |
1509 |
1475 " |
1510 " |
1476 MenuEditor new openOnClass:DataSetBuilder andSelector:#menuToolbar |
1511 MenuEditor new openOnClass:DataSetBuilder andSelector:#menuToolbar |
1477 (Menu new fromLiteralArrayEncoding:(DataSetBuilder menuToolbar)) startUp |
1512 (Menu new fromLiteralArrayEncoding:(DataSetBuilder menuToolbar)) startUp |
1478 " |
1513 " |
1483 |
1518 |
1484 #(#Menu |
1519 #(#Menu |
1485 |
1520 |
1486 #( |
1521 #( |
1487 #(#MenuItem |
1522 #(#MenuItem |
1488 #'label:' 'Add Column' |
1523 #label: 'New' |
1489 #'isButton:' true |
1524 #isButton: true |
1490 #'value:' #doCreateColumn |
1525 #value: #doNew |
1491 #'activeHelpKey:' #addColumn |
1526 #activeHelpKey: #fileNew |
1492 #'enabled:' #columnIsNotEditing |
1527 #labelImage: #(#ResourceRetriever nil #newIcon) |
1493 #'labelImage:' #(#ResourceRetriever nil #newColumnIcon) |
1528 ) |
1494 ) |
1529 #(#MenuItem |
1495 #(#MenuItem |
1530 #label: 'Load' |
1496 #'label:' '' |
1531 #isButton: true |
1497 ) |
1532 #value: #doLoad |
1498 #(#MenuItem |
1533 #activeHelpKey: #fileLoad |
1499 #'label:' 'Move Up' |
1534 #labelImage: #(#ResourceRetriever nil #loadIcon) |
1500 #'isButton:' true |
1535 ) |
1501 #'value:' #'doMoveColumn:' |
1536 #(#MenuItem |
1502 #'activeHelpKey:' #editMoveUp |
1537 #label: 'Save' |
1503 #'enabled:' #isColumnSelected |
1538 #isButton: true |
1504 #'argument:' #up |
1539 #value: #doSave |
1505 #'labelImage:' #(#ResourceRetriever nil #upIcon) |
1540 #activeHelpKey: #fileSave |
1506 ) |
1541 #labelImage: #(#ResourceRetriever nil #saveIcon) |
1507 #(#MenuItem |
1542 ) |
1508 #'label:' 'Move Down' |
1543 #(#MenuItem |
1509 #'isButton:' true |
1544 #label: '' |
1510 #'value:' #'doMoveColumn:' |
1545 ) |
1511 #'activeHelpKey:' #editMoveDown |
1546 #(#MenuItem |
1512 #'enabled:' #isColumnSelected |
1547 #label: 'Cut' |
1513 #'argument:' #down |
1548 #isButton: true |
1514 #'labelImage:' #(#ResourceRetriever nil #downIcon) |
1549 #value: #doCut |
|
1550 #activeHelpKey: #editCut |
|
1551 #enabled: #isColumnSelected |
|
1552 #labelImage: #(#ResourceRetriever nil #cutIcon) |
|
1553 ) |
|
1554 #(#MenuItem |
|
1555 #label: 'Copy' |
|
1556 #isButton: true |
|
1557 #value: #doCopy |
|
1558 #activeHelpKey: #editCopy |
|
1559 #enabled: #isColumnSelected |
|
1560 #labelImage: #(#ResourceRetriever nil #copyIcon) |
|
1561 ) |
|
1562 #(#MenuItem |
|
1563 #label: 'Paste' |
|
1564 #isButton: true |
|
1565 #value: #doPaste |
|
1566 #activeHelpKey: #editPaste |
|
1567 #enabled: #valueOfCanPaste |
|
1568 #labelImage: #(#ResourceRetriever nil #pasteIcon) |
|
1569 ) |
|
1570 #(#MenuItem |
|
1571 #label: 'Delete' |
|
1572 #isButton: true |
|
1573 #value: #doDelete |
|
1574 #activeHelpKey: #editDelete |
|
1575 #enabled: #isColumnSelected |
|
1576 #labelImage: #(#ResourceRetriever nil #deleteIcon) |
|
1577 ) |
|
1578 #(#MenuItem |
|
1579 #label: '' |
|
1580 ) |
|
1581 #(#MenuItem |
|
1582 #label: 'Add Column' |
|
1583 #isButton: true |
|
1584 #value: #doCreateColumn |
|
1585 #activeHelpKey: #addColumn |
|
1586 #enabled: #columnIsNotEditing |
|
1587 #labelImage: #(#ResourceRetriever nil #newColumnIcon) |
|
1588 ) |
|
1589 #(#MenuItem |
|
1590 #label: '' |
|
1591 ) |
|
1592 #(#MenuItem |
|
1593 #label: 'Move Up' |
|
1594 #isButton: true |
|
1595 #value: #doMoveColumn: |
|
1596 #activeHelpKey: #editMoveUp |
|
1597 #enabled: #isColumnSelected |
|
1598 #argument: #up |
|
1599 #labelImage: #(#ResourceRetriever nil #upIcon) |
|
1600 ) |
|
1601 #(#MenuItem |
|
1602 #label: 'Move Down' |
|
1603 #isButton: true |
|
1604 #value: #doMoveColumn: |
|
1605 #activeHelpKey: #editMoveDown |
|
1606 #enabled: #isColumnSelected |
|
1607 #argument: #down |
|
1608 #labelImage: #(#ResourceRetriever nil #downIcon) |
1515 ) |
1609 ) |
1516 ) nil |
1610 ) nil |
1517 nil |
1611 nil |
1518 ) |
1612 ) |
1519 ! ! |
1613 ! ! |
1520 |
1614 |
1521 !DataSetBuilder class methodsFor:'resources'! |
1615 !DataSetBuilder class methodsFor:'resources'! |
1522 |
1616 |
1523 newColumnIcon |
1617 newColumnIcon |
1524 "Generated by the Image Editor" |
1618 "This resource specification was automatically generated |
1525 " |
1619 by the ImageEditor of ST/X." |
1526 ImageEditor openOnClass:self andSelector:#newColumnIcon |
1620 |
|
1621 "Do not manually edit this!! If it is corrupted, |
|
1622 the ImageEditor may not be able to read the specification." |
|
1623 |
|
1624 " |
|
1625 self newColumnIcon inspect |
|
1626 ImageEditor openOnClass:self andSelector:#newColumnIcon |
1527 " |
1627 " |
1528 |
1628 |
1529 <resource: #image> |
1629 <resource: #image> |
1530 |
1630 |
1531 ^Icon |
1631 ^Icon |
1532 constantNamed:#'DataSetBuilder newColumnIcon' |
1632 constantNamed:#'DataSetBuilder newColumnIcon' |
1533 ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UT@@@@UPUTUUUXUPUTZ**,UPUTZB",UPUTX*H,UYUTX*H,UPUTZB",UPQTZ**,UPUTX*H,UPUTX*H,UPUTX*H,UPUTXB@,UPUTZ**,UPUTZ**,UPUTX"H,UYUTXB@,UPUTX"@,UPUTX"H,UPUTZ**,UPUTZ**,UPUT/??<UPUT@@@@UP'); colorMap:(((Array new:4) at:1 put:((Color black)); at:2 put:((Color white)); at:3 put:((Color grey:66.9978)); at:4 put:((Color grey:49.9962)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A??@A??@A??@A??@A??@A??@A??@A??@A??CA??@A??@A??@A??@A??CA??AA??@A??CA??@A??CA??@A??@A??A'); yourself); yourself]! ! |
1633 ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UT@@@@UPUTUUUXUPUTZ**,UPUTZB",UPUTX*H,UYUTX*H,UPUTZB",UPQTZ**,UPUTX*H,UPUTX*H,UPUTX*H,UPUTXB@,UPUTZ**,UPUTZ**,UPUTX"H,UYUTXB@,UPUTX"@,UPUTX"H,UPUTZ**,UPUTZ**,UPUT/??<UPUT@@@@UP') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A??@A??@A??@A??@A??@A??@A??@A??@A??CA??@A??@A??@A??@A??CA??AA??@A??CA??@A??CA??@A??@A??A') ; yourself); yourself]! ! |
1534 |
1634 |
1535 !DataSetBuilder methodsFor:'accessing'! |
1635 !DataSetBuilder methodsFor:'accessing'! |
1536 |
1636 |
1537 columns |
1637 columns |
1538 "returns list of columns" |
1638 "returns list of columns" |
1576 |cls| |
1675 |cls| |
1577 |
1676 |
1578 rowSuperClass := nil. |
1677 rowSuperClass := nil. |
1579 |
1678 |
1580 (rowClass := aClassName) notNil ifTrue:[ |
1679 (rowClass := aClassName) notNil ifTrue:[ |
1581 (cls := self resolveRowClassNamed) notNil |
1680 (cls := self resolveClassNamed) notNil |
1582 ifTrue: [rowSuperClass := cls superclass name asString] |
1681 ifTrue: [rowSuperClass := cls superclass name asString] |
1583 ifFalse:[rowSuperClass := 'Object'] |
1682 ifFalse:[rowSuperClass := 'Object'] |
1584 ] |
1683 ] |
1585 |
1684 |
1586 ! ! |
1685 ! ! |
1587 |
1686 |
1588 !DataSetBuilder methodsFor:'aspects'! |
1687 !DataSetBuilder methodsFor:'aspects'! |
1589 |
|
1590 aspectFor:aKey |
|
1591 "returns aspect for a key or nil" |
|
1592 |
|
1593 ^aspects at:aKey ifAbsent:[super aspectFor:aKey] |
|
1594 |
|
1595 |
|
1596 ! |
|
1597 |
1688 |
1598 columnIsNotEditing |
1689 columnIsNotEditing |
1599 "returns a boolean value holder which is set to true if column is not editing" |
1690 "returns a boolean value holder which is set to true if column is not editing" |
1600 |
1691 |
1601 ^builder valueAspectFor:#columnIsNotEditing initialValue: true |
1692 ^builder valueAspectFor:#columnIsNotEditing initialValue: true |
1701 |
1782 |
1702 tabList |
1783 tabList |
1703 |
1784 |
1704 ^self class slices collect:[:aSlice|aSlice first] |
1785 ^self class slices collect:[:aSlice|aSlice first] |
1705 |
1786 |
1706 ! |
1787 ! ! |
1707 |
1788 |
1708 tabModel |
1789 !DataSetBuilder methodsFor:'building'! |
1709 "returns a value holder which keeps the index of the current selected tab or 0" |
1790 |
1710 |
1791 buildFromClass:aClass andSelector:aSelector |
1711 |holder| |
1792 |
1712 |
1793 |updateBlock cls list| |
1713 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
1794 |
1714 holder := AspectAdaptor new subject:self; forAspect:#tabSelectionIndex. |
1795 selectedColumnIndex := 0. |
1715 builder aspectAt:#tabModel put:holder. |
1796 |
|
1797 updateBlock := [ |
|
1798 columns notEmpty ifTrue: [ |
|
1799 self tabModel value: 0. |
|
1800 self tabModel value: 1. |
|
1801 self selectedColumnModel value: nil. |
|
1802 self selectedColumnModel value: 1. |
|
1803 self updateColumnView. |
|
1804 self updateInputFields. |
|
1805 self updateInfoLabel. |
|
1806 self updateHistory |
|
1807 ] |
1716 ]. |
1808 ]. |
1717 ^ holder |
1809 |
1718 ! ! |
1810 "if opened on table columns" |
1719 |
1811 |
1720 !DataSetBuilder methodsFor:'building'! |
1812 aClass isNil ifTrue: [ |
1721 |
1813 self tabModel value: 0. |
1722 buildFromClass:aClass andSelector:aSelector |
1814 self columns removeAll. |
1723 |cls list| |
1815 self seqList removeAll. |
|
1816 self updateColumnView. |
|
1817 self updateInfoLabel. |
|
1818 self specChannel value:nil. |
|
1819 self isColumnSelected value: false. |
|
1820 ^self |
|
1821 ]. |
|
1822 |
|
1823 specSelector isNil ifTrue: [updateBlock value. ^self]. |
1724 |
1824 |
1725 list := nil. |
1825 list := nil. |
1726 |
1826 |
1727 (aClass notNil or:[self isStandAlone or:[self window shown]]) ifTrue:[ |
1827 (aClass notNil or:[self isStandAlone or:[self window shown]]) ifTrue:[ |
1728 |
1828 |
1734 ] |
1834 ] |
1735 ] |
1835 ] |
1736 ] ifFalse:[ |
1836 ] ifFalse:[ |
1737 list := columns |
1837 list := columns |
1738 ]. |
1838 ]. |
1739 self columns:list |
1839 self columns:list. |
|
1840 updateBlock value |
|
1841 |
1740 ! |
1842 ! |
1741 |
1843 |
1742 buildFromResourceSpec:aResourceSpec |
1844 buildFromResourceSpec:aResourceSpec |
1743 |
1845 |
1744 self columns:aResourceSpec |
1846 self columns:aResourceSpec. |
|
1847 |
|
1848 columns notEmpty ifTrue: [ |
|
1849 self tabModel value: 1. |
|
1850 self selectedColumnModel value: nil. |
|
1851 self selectedColumnModel value: 1. |
|
1852 self updateInputFields. |
|
1853 self updateInfoLabel. |
|
1854 self updateHistory |
|
1855 ] |
1745 ! ! |
1856 ! ! |
1746 |
1857 |
1747 !DataSetBuilder methodsFor:'change & update'! |
1858 !DataSetBuilder methodsFor:'change & update'! |
1748 |
1859 |
1749 update:something with:aParameter from:someObject |
1860 update:something with:aParameter from:someObject |
1750 "one of my aspects has changed; update modified channel" |
1861 "one of my aspects has changed; update modified channel" |
1751 |
1862 |
1752 self valueOfEnablingCommitButtons value: true. |
1863 super update:something with:aParameter from:someObject. |
|
1864 |
1753 self columnIsNotEditing value: false |
1865 self columnIsNotEditing value: false |
1754 |
1866 |
1755 ! ! |
1867 ! ! |
1756 |
1868 |
1757 !DataSetBuilder methodsFor:'code generation'! |
1869 !DataSetBuilder methodsFor:'code generation'! |
2022 ! ! |
2134 ! ! |
2023 |
2135 |
2024 !DataSetBuilder methodsFor:'initialization'! |
2136 !DataSetBuilder methodsFor:'initialization'! |
2025 |
2137 |
2026 initialize |
2138 initialize |
2027 "setup aspects used by column description specifications" |
2139 "initializes" |
2028 |
|
2029 |holder| |
|
2030 |
2140 |
2031 super initialize. |
2141 super initialize. |
|
2142 |
2032 selectedColumnIndex := 0. |
2143 selectedColumnIndex := 0. |
2033 tabSelectionIndex := 0. |
|
2034 columns := OrderedCollection new. |
2144 columns := OrderedCollection new. |
2035 hasChanged := false. |
2145 modalOpened := false |
2036 |
2146 |
2037 #( |
|
2038 label |
|
2039 canSelect |
|
2040 choices |
|
2041 editorType |
|
2042 formatString |
|
2043 labelIsImage |
|
2044 size |
|
2045 type |
|
2046 width |
|
2047 minWidth |
|
2048 height |
|
2049 menu |
|
2050 foregroundSelector |
|
2051 backgroundSelector |
|
2052 doubleClickedSelector |
|
2053 selectSelector |
|
2054 printSelector |
|
2055 readSelector |
|
2056 writeSelector |
|
2057 rendererType |
|
2058 showColSeparator |
|
2059 showRowSeparator |
|
2060 backgroundColor |
|
2061 foregroundColor |
|
2062 labelForegroundColor |
|
2063 labelBackgroundColor |
|
2064 labelFont |
|
2065 labelActionSelector |
|
2066 labelActionArgument |
|
2067 labelAlignment |
|
2068 columnAlignment |
|
2069 ) do:[:aKey| |
|
2070 aspects at:aKey put:(holder := ValueHolder new). |
|
2071 holder addDependent:self |
|
2072 ] |
|
2073 |
2147 |
2074 ! ! |
2148 ! ! |
2075 |
2149 |
2076 !DataSetBuilder methodsFor:'private'! |
2150 !DataSetBuilder methodsFor:'private'! |
2077 |
2151 |
2078 checkMenuItemModified |
2152 askForListModification |
2079 "check column modification" |
2153 "asks for resource modification" |
2080 |
2154 |
2081 self valueOfEnablingCommitButtons value |
2155 modalOpened |
2082 ifTrue: |
2156 ifFalse: |
2083 [ |
2157 [ |
2084 ((YesNoBox title:'Column was modified!!\Save it?\' withCRs) |
2158 ^super askForListModification |
2085 noText:'No'; |
|
2086 yesText:'Yes'; |
|
2087 showAtPointer; |
|
2088 accepted) ifFalse: [self valueOfEnablingCommitButtons value: false. ^true]. |
|
2089 self accept |
|
2090 ]. |
2159 ]. |
2091 ^true |
2160 ^true |
2092 |
2161 |
2093 ! |
2162 ! |
2094 |
2163 |
2095 labelFromColumn:aColumn |
2164 labelFromColumn:aColumn |
2096 ^ aColumn rendererType == #rowSelector ifFalse:[aColumn label] |
2165 |
2097 ifTrue:['Row Selector']. |
2166 ^ aColumn rendererType == #rowSelector |
2098 ! |
2167 ifFalse:[aColumn label] |
2099 |
2168 ifTrue: ['Row Selector']. |
2100 resolveRowClassNamed |
|
2101 "returns current class or nil" |
|
2102 |
|
2103 ^Smalltalk resolveName:rowClass inClass:self class. |
|
2104 |
|
2105 ! |
2169 ! |
2106 |
2170 |
2107 updateColumnView |
2171 updateColumnView |
2108 "update column view from column descriptions" |
2172 "updates column view from column descriptions" |
2109 columnView notNil ifTrue:[columnView columnDescriptors:columns] |
2173 |
|
2174 columnView notNil ifTrue:[ |
|
2175 |previewColumns columnItems columnList| |
|
2176 columnList := List new. |
|
2177 previewColumns := columns deepCopy. |
|
2178 columns notEmpty |
|
2179 ifTrue: |
|
2180 [ |
|
2181 previewColumns do: |
|
2182 [:column| |
|
2183 column readSelector: #at:. |
|
2184 column writeSelector: #at:put:. |
|
2185 column backgroundSelector:nil. |
|
2186 column foregroundSelector:nil. |
|
2187 column selectSelector: nil. |
|
2188 column doubleClickedSelector: nil. |
|
2189 column printSelector: nil. |
|
2190 column menu: nil |
|
2191 ]. |
|
2192 #('1' '2' '...' 'x') do: |
|
2193 [:suffix| |
|
2194 columnItems := Array new: previewColumns size. |
|
2195 1 to: previewColumns size do: [:i| columnItems at: i put: (previewColumns at: i) label ? 'Cell', suffix]. |
|
2196 columnList add: columnItems. |
|
2197 ] |
|
2198 ]. |
|
2199 columnView list: #(). |
|
2200 columnView columnDescriptors: previewColumns. |
|
2201 columnView list: columnList. |
|
2202 ] |
2110 ! |
2203 ! |
2111 |
2204 |
2112 updateInputFields |
2205 updateInputFields |
2113 "reload item value into input fields" |
2206 "reloads item value into input fields" |
2114 |
2207 |
2115 |column| |
2208 |column| |
2116 |
2209 |
2117 (column := self selectedColumn) isNil |
2210 (column := self selectedColumn) isNil |
2118 ifTrue: |
2211 ifTrue: |
2120 self tabModel value:0. |
2213 self tabModel value:0. |
2121 ] |
2214 ] |
2122 ifFalse: |
2215 ifFalse: |
2123 [ |
2216 [ |
2124 aspects keysAndValuesDo:[:aKey :aModel|aModel value:(column perform:aKey) withoutNotifying: self]. |
2217 aspects keysAndValuesDo:[:aKey :aModel|aModel value:(column perform:aKey) withoutNotifying: self]. |
2125 tabSelectionIndex == 0 ifTrue:[self tabModel value:1] |
2218 tabSelection == 0 ifTrue:[self tabModel value:1] |
2126 ] |
2219 ] |
2127 ! ! |
2220 ! ! |
2128 |
2221 |
2129 !DataSetBuilder methodsFor:'queries'! |
|
2130 |
|
2131 hasChanged |
|
2132 "returns true if changes are done to the original column description" |
|
2133 |
|
2134 ^hasChanged |
|
2135 ! ! |
|
2136 |
|
2137 !DataSetBuilder methodsFor:'selection'! |
2222 !DataSetBuilder methodsFor:'selection'! |
2138 |
2223 |
2139 selectedColumn |
2224 selectedColumn |
2140 "returns selected column or nil" |
2225 "returns selected column or nil" |
2141 |
2226 |
2142 ^selectedColumnIndex == 0 |
2227 ^selectedColumnIndex == 0 |
2143 ifFalse:[columns at:selectedColumnIndex] |
2228 ifFalse:[columns at:selectedColumnIndex ifAbsent: nil] |
2144 ifTrue: [nil] |
2229 ifTrue: [nil] |
2145 ! |
2230 ! |
2146 |
2231 |
2147 selectedColumnIndex |
2232 selectedColumnIndex |
2148 "returns selected column index or 0" |
2233 "returns selected column index or 0" |
2149 |
2234 |
2150 ^selectedColumnIndex |
2235 ^selectedColumnIndex |
2151 ! |
2236 ! |
2152 |
2237 |
2153 selectedColumnIndex:something |
2238 selectedColumnIndex:something |
2154 "change selected column and update specifications" |
2239 "changes selected column and update specifications" |
2155 |
2240 |
2156 something == selectedColumnIndex |
2241 something == selectedColumnIndex |
2157 ifFalse: |
2242 ifFalse: |
2158 [ |
2243 [ |
2159 selectedColumnIndex := something ? 0. |
2244 selectedColumnIndex := something ? 0. |
2160 self isColumnSelected value: true |
2245 self isColumnSelected value: true |
2161 ] |
2246 ] |
2162 |
2247 |
2163 ! |
2248 ! |
2164 |
2249 |
2165 tabSelectionIndex |
2250 tabSelection:something |
2166 "returns selected tab index or 0" |
2251 "changes selected tab and set corresponding specification" |
2167 |
|
2168 ^tabSelectionIndex |
|
2169 ! |
|
2170 |
|
2171 tabSelectionIndex:something |
|
2172 "change selected tab and set corresponding specification" |
|
2173 |
2252 |
2174 |specSelector| |
2253 |specSelector| |
2175 |
2254 |
2176 something == tabSelectionIndex ifTrue:[^self]. |
2255 something == tabSelection ifTrue:[^self]. |
2177 self selectedColumn isNil |
2256 self selectedColumn isNil |
2178 ifTrue: |
2257 ifTrue: |
2179 [ |
2258 [ |
2180 tabSelectionIndex == 0 ifTrue:[^self]. |
2259 tabSelection == 0 ifTrue:[^self]. |
2181 tabSelectionIndex := 0 |
2260 tabSelection := 0 |
2182 ] |
2261 ] |
2183 ifFalse: |
2262 ifFalse: |
2184 [ |
2263 [ |
2185 (tabSelectionIndex := something) ~~ 0 |
2264 (tabSelection := something) ~~ 0 |
2186 ifTrue: [specSelector := (self class slices at:tabSelectionIndex) last] |
2265 ifTrue: [specSelector := (self class slices at:tabSelection) last] |
2187 ]. |
2266 ]. |
2188 self specChannel value:specSelector |
2267 self specChannel value:specSelector. |
2189 |
2268 (self window notNil and: [self window shown]) ifTrue: [self updateFonts] |
2190 |
2269 |
2191 ! ! |
2270 ! ! |
2192 |
2271 |
2193 !DataSetBuilder methodsFor:'startup / release'! |
2272 !DataSetBuilder methodsFor:'startup / release'! |
2194 |
2273 |
2195 closeRequest |
2274 openModalOnResourceSpec: aListSpec |
2196 "close request" |
2275 "sets the modalOpened flag, so later, |
2197 |
2276 there is no need to ask for saving into a class" |
2198 self checkMenuItemModified ifTrue: [super closeRequest] |
2277 |
|
2278 modalOpened := true. |
|
2279 |
|
2280 super openModalOnResourceSpec: aListSpec |
|
2281 |
|
2282 |
2199 ! |
2283 ! |
2200 |
2284 |
2201 postBuildWith:builder |
2285 postBuildWith:builder |
2202 |
2286 |
2203 columnView := self builder componentAt:#columnView. |
2287 columnView := self builder componentAt:#columnView. |
2204 columnView labelView enabled:false. |
2288 columnView labelView enabled:false. |
2205 |
2289 |
2206 super postBuildWith:builder. |
2290 super postBuildWith:builder. |
2207 |
2291 |
2208 (builder componentAt: #labelAndColumns) |
2292 (builder componentAt: #labelAndColumns) |
2209 selectConditionBlock: [:i|self checkMenuItemModified]; |
2293 selectConditionBlock: [:i|self askForItemModification]; |
2210 action: [:i|self cancel]; |
2294 action: [:i|self cancel]; |
2211 selection: 1. |
2295 selection: 1. |
2212 |
2296 |
2213 |
2297 |
|
2298 |
2214 ! ! |
2299 ! ! |
2215 |
2300 |
2216 !DataSetBuilder methodsFor:'user actions'! |
2301 !DataSetBuilder methodsFor:'user actions'! |
2217 |
2302 |
2218 accept |
2303 accept |
2219 "accept changes made" |
2304 "accept changes made" |
2220 |
2305 |
2221 |column type| |
2306 |column type| |
2222 |
2307 |
2223 self valueOfEnablingCommitButtons value == false ifTrue: [^self]. |
2308 super accept. |
2224 hasChanged := true. |
|
2225 |
2309 |
2226 (column := self selectedColumn) isNil ifTrue: [^self cancel]. |
2310 (column := self selectedColumn) isNil ifTrue: [^self cancel]. |
2227 |
2311 |
2228 type := (aspects at:#rendererType) value. |
2312 type := (aspects at:#rendererType) value. |
2229 |
2313 |
2280 |
2366 |
2281 list := self seqList. |
2367 list := self seqList. |
2282 label := 'Column ', (list size + 1) printString. |
2368 label := 'Column ', (list size + 1) printString. |
2283 columns add:(DataSetColumnSpec label:label selector:nil) afterIndex:selectedColumnIndex. |
2369 columns add:(DataSetColumnSpec label:label selector:nil) afterIndex:selectedColumnIndex. |
2284 self seqList add:label afterIndex:selectedColumnIndex. |
2370 self seqList add:label afterIndex:selectedColumnIndex. |
2285 hasChanged := true. |
|
2286 self valueOfEnablingCommitButtons value ifFalse:[self selectedColumnModel value:selectedColumnIndex + 1]. |
2371 self valueOfEnablingCommitButtons value ifFalse:[self selectedColumnModel value:selectedColumnIndex + 1]. |
2287 self cancel. |
2372 self cancel. |
2288 self updateColumnView |
2373 self updateColumnView. |
2289 |
2374 modified := true. |
2290 ! |
2375 |
2291 |
2376 ! |
2292 doCutColumn |
2377 |
|
2378 doCut |
2293 "remove selected column and put it to the clipboard" |
2379 "remove selected column and put it to the clipboard" |
2294 |
2380 |
2295 |idx| |
2381 |idx| |
2296 |
2382 |
2297 ((idx := selectedColumnIndex) ~~ 0 and: [self checkMenuItemModified]) |
2383 ((idx := selectedColumnIndex) ~~ 0 and: [self askForItemModification]) |
2298 ifTrue: |
2384 ifTrue: |
2299 [ |
2385 [ |
2300 self selectedColumnModel value:0. |
2386 self selectedColumnModel value:0. |
2301 self clipboard: (columns at: idx). |
2387 self clipboard: (columns at: idx). |
2302 columns removeIndex:idx. |
2388 columns removeIndex:idx. |
2373 ]. |
2459 ]. |
2374 self information: 'set superclassName' |
2460 self information: 'set superclassName' |
2375 ] |
2461 ] |
2376 ifFalse: |
2462 ifFalse: |
2377 [ |
2463 [ |
2378 (cls isNil or:[rowSuperClass = cls]) ifTrue:[hasChanged := true. ^self]. |
2464 (cls isNil or:[rowSuperClass = cls]) ifTrue:[^self]. |
2379 self information:('A global named ' , rowClass , ' exists,\' , |
2465 self information:('A global named ' , rowClass , ' exists,\' , |
2380 'but is not a subclass of ' , rowSuperClass, '.\\' , |
2466 'but is not a subclass of ' , rowSuperClass, '.\\' , |
2381 'Check and try again if that is not what you want.') withCRs. |
2467 'Check and try again if that is not what you want.') withCRs. |
2382 |
2468 |
2383 rowSuperClass := cls |
2469 rowSuperClass := cls |
2384 ] |
2470 ] |
2385 ] |
2471 ] |
2386 ] |
2472 ] |
2387 ! |
2473 ! |
2388 |
2474 |
|
2475 doDelete |
|
2476 "remove selected column and put it to the clipboard" |
|
2477 |
|
2478 |idx| |
|
2479 |
|
2480 ((idx := selectedColumnIndex) ~~ 0 and: [self askForItemModification]) |
|
2481 ifTrue: |
|
2482 [ |
|
2483 self selectedColumnModel value:0. |
|
2484 columns removeIndex:idx. |
|
2485 self seqList removeIndex:idx. |
|
2486 columns size > 0 ifTrue: [self selectedColumnModel value: ((idx - 1) max: 1)]. |
|
2487 self updateColumnView. |
|
2488 self updateInputFields. |
|
2489 columns isEmpty ifTrue: [self isColumnSelected value: false]. |
|
2490 self cancel. |
|
2491 modified := true. |
|
2492 ] |
|
2493 ! |
|
2494 |
2389 doGenerateCode |
2495 doGenerateCode |
2390 "generate code for column values" |
2496 "generate code for column values" |
2391 |
2497 |
2392 |cls superclass| |
2498 |cls superclass| |
2393 |
2499 |
2394 rowClass isNil ifTrue:[^self information:'No class defined!!']. |
2500 rowClass isNil ifTrue:[^self information:'No class defined!!']. |
2395 cls := self resolveRowClassNamed. |
2501 cls := self resolveClassNamed. |
2396 |
2502 |
2397 cls isNil |
2503 cls isNil |
2398 ifTrue: |
2504 ifTrue: |
2399 [ |
2505 [ |
2400 superclass := Smalltalk resolveName:rowSuperClass inClass:self class. |
2506 superclass := Smalltalk resolveName:rowSuperClass inClass:self class. |
2451 list add:label beforeIndex:idx. |
2556 list add:label beforeIndex:idx. |
2452 self selectedColumnModel value:idx. |
2557 self selectedColumnModel value:idx. |
2453 self updateColumnView. |
2558 self updateColumnView. |
2454 ! |
2559 ! |
2455 |
2560 |
2456 doPasteColumn |
2561 doPaste |
2457 "paste clipboard copy column after selected column or at left (nothing selected)" |
2562 "paste clipboard copy column after selected column or at left (nothing selected)" |
2458 |
2563 |
2459 |col lbl| |
2564 |col lbl| |
2460 |
2565 |
2461 self checkMenuItemModified ifFalse: [^nil]. |
2566 self askForItemModification ifFalse: [^nil]. |
2462 col := self class clipboard deepCopy. |
2567 col := self class clipboard deepCopy. |
2463 lbl := self labelFromColumn:col. |
2568 lbl := self labelFromColumn:col. |
2464 |
2569 |
2465 columns add:col afterIndex:selectedColumnIndex. |
2570 columns add:col afterIndex:selectedColumnIndex. |
2466 self seqList add:lbl afterIndex:selectedColumnIndex. |
2571 self seqList add:lbl afterIndex:selectedColumnIndex. |
2467 hasChanged := true. |
|
2468 |
2572 |
2469 self valueOfEnablingCommitButtons value ifFalse:[ |
2573 self valueOfEnablingCommitButtons value ifFalse:[ |
2470 self selectedColumnModel value:selectedColumnIndex + 1 |
2574 self selectedColumnModel value:selectedColumnIndex + 1 |
2471 ]. |
2575 ]. |
2472 self updateColumnView. |
2576 self updateColumnView. |
2473 self updateInputFields. |
2577 self updateInputFields. |
|
2578 modified := true. |
|
2579 |
2474 ! |
2580 ! |
2475 |
2581 |
2476 doPickColumns |
2582 doPickColumns |
2477 |
2583 |
2478 |view cls| |
2584 |view cls| |