Injected planner global commands in common area over perspectives
FEA: ItEr75S04BugFixing
This commit is contained in:
parent
ae1361c7b2
commit
33db5b2086
5 changed files with 60 additions and 36 deletions
|
|
@ -480,40 +480,17 @@ public class Planner extends HtmlMacroComponent {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void insertGlobalCommands() {
|
||||
Component toolbar = getToolbar();
|
||||
Component firstSeparator = getFirstSeparatorFromToolbar();
|
||||
toolbar.getChildren().removeAll(getBefore(toolbar, firstSeparator));
|
||||
Component toolbar = getCommandsInsertionPoint();
|
||||
toolbar.getChildren().removeAll(toolbar.getChildren());
|
||||
for (CommandContextualized<?> c : contextualizedGlobalCommands) {
|
||||
toolbar.insertBefore(c.toButton(), firstSeparator);
|
||||
toolbar.appendChild(c.toButton());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Component> getBefore(Component parent, Component child) {
|
||||
List<Component> children = parent.getChildren();
|
||||
List<Component> result = new ArrayList<Component>();
|
||||
for (Component object : children) {
|
||||
if (object == child) {
|
||||
break;
|
||||
}
|
||||
result.add(object);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Component getFirstSeparatorFromToolbar() {
|
||||
Component toolbar = getToolbar();
|
||||
List<Component> children = toolbar.getChildren();
|
||||
List<Separator> separators = ComponentsFinder
|
||||
.findComponentsOfType(
|
||||
Separator.class, children);
|
||||
return separators.get(0);
|
||||
}
|
||||
|
||||
private Component getToolbar() {
|
||||
Component toolbar = getFellow("toolbar");
|
||||
return toolbar;
|
||||
private Component getCommandsInsertionPoint() {
|
||||
Component insertionPoint = getPage().getFellow(
|
||||
"perspectiveButtonsInsertionPoint");
|
||||
return insertionPoint;
|
||||
}
|
||||
|
||||
void removeTask(Task task) {
|
||||
|
|
|
|||
|
|
@ -253,6 +253,46 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
.getFellow("checkIncludeOrderElements");
|
||||
|
||||
checkCreationPermissions();
|
||||
setupGlobalButtons();
|
||||
|
||||
}
|
||||
|
||||
private void setupGlobalButtons() {
|
||||
|
||||
Hbox perspectiveButtonsInsertionPoint = (Hbox) page
|
||||
.getFellow("perspectiveButtonsInsertionPoint");
|
||||
|
||||
List<Component> children = perspectiveButtonsInsertionPoint
|
||||
.getChildren();
|
||||
perspectiveButtonsInsertionPoint.getChildren().removeAll(children);
|
||||
|
||||
createOrderButton.setParent(perspectiveButtonsInsertionPoint);
|
||||
createOrderButton.addEventListener(Events.ON_CLICK,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
goToCreateForm();
|
||||
}
|
||||
});
|
||||
|
||||
createOrderFromTemplateButton
|
||||
.setParent(perspectiveButtonsInsertionPoint);
|
||||
createOrderFromTemplateButton.addEventListener(Events.ON_CLICK,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
createOrderFromTemplate();
|
||||
}
|
||||
});
|
||||
|
||||
saveOrderAndContinueButton.setParent(perspectiveButtonsInsertionPoint);
|
||||
saveOrderAndContinueButton.addEventListener(Events.ON_CLICK,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
saveAndContinue();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initEditOrderElementWindow() {
|
||||
|
|
|
|||
|
|
@ -1609,6 +1609,15 @@ input.z-datebox-text-disd {
|
|||
background-color: transparent;
|
||||
}
|
||||
|
||||
.global-commands .z-button {
|
||||
padding-bottom:0;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.global-commands {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.z-button .z-button-cm {
|
||||
background-image: none;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ signature="java.lang.Boolean isDefaultPasswordsControl()"?>
|
|||
<!-- borderlayout class="main-layout" height="2000px" width="2000px"-->
|
||||
<west class="perspectives-column" width="90px">
|
||||
<vbox>
|
||||
<vbox id="perspectiveButtonsInsertionPoint" sclass="toolbar-box" height="31px" style="margin-bottom:10px"/>
|
||||
<hbox id="perspectiveButtonsInsertionPoint" sclass="toolbar-box global-commands" height="30px" width="100%" />
|
||||
<vbox id="registeredItemsInsertionPoint" width="90px"/>
|
||||
</vbox>
|
||||
</west>
|
||||
|
|
|
|||
|
|
@ -32,15 +32,13 @@
|
|||
caption="${i18n:_('Choosing Template')}" />
|
||||
|
||||
<button id="createOrderButton" image="/common/img/ico_add.png" sclass="planner-icon"
|
||||
tooltiptext="${i18n:_('Create New Project')}" onClick="controller.goToCreateForm()"
|
||||
visible="false" />
|
||||
tooltiptext="${i18n:_('Create New Project')}" visible="false" />
|
||||
|
||||
<button id="createOrderFromTemplateButton" image="/common/img/ico_copy.png" sclass="planner-icon"
|
||||
tooltiptext="${i18n:_('Create From Template')}" onClick="controller.createOrderFromTemplate()"
|
||||
visible="false" />
|
||||
tooltiptext="${i18n:_('Create From Template')}" visible="false" />
|
||||
|
||||
<button id="saveOrderAndContinueButton" image="/common/img/ico_save.png" sclass="planner-icon"
|
||||
tooltiptext="${i18n:_('Save Project')}" onClick="controller.saveAndContinue();" />
|
||||
tooltiptext="${i18n:_('Save Project')}" />
|
||||
|
||||
<hbox id="orderFilter" visible="false"/>
|
||||
<vbox id="orderElementFilter" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue