Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
208 additions
and
3 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...n-gui/src/main/java/com/evolveum/midpoint/gui/api/component/button/DropdownButtonDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.evolveum.midpoint.gui.api.component.button; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
import com.evolveum.midpoint.web.component.data.column.InlineMenuable; | ||
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem; | ||
|
||
public class DropdownButtonDto implements Serializable, InlineMenuable{ | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 1L; | ||
private String info; | ||
private String icon; | ||
private String label; | ||
|
||
private List<InlineMenuItem> items; | ||
|
||
public DropdownButtonDto(String info, String icon, String label, List<InlineMenuItem> items) { | ||
this.info = info; | ||
this.icon = icon; | ||
this.label = label; | ||
this.items = items; | ||
} | ||
|
||
public String getInfo() { | ||
return info; | ||
} | ||
|
||
public void setInfo(String info) { | ||
this.info = info; | ||
} | ||
|
||
public String getIcon() { | ||
return icon; | ||
} | ||
|
||
public void setIcon(String icon) { | ||
this.icon = icon; | ||
} | ||
|
||
public String getLabel() { | ||
return label; | ||
} | ||
|
||
public void setLabel(String label) { | ||
this.label = label; | ||
} | ||
|
||
|
||
@Override | ||
public List<InlineMenuItem> getMenuItems() { | ||
return items; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...gui/src/main/java/com/evolveum/midpoint/gui/api/component/button/DropdownButtonPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
~ Copyright (c) 2010-2016 Evolveum | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html xmlns:wicket="http://wicket.apache.org"> | ||
<wicket:panel> | ||
<a class="btn btn-app" data-toggle="dropdown"> | ||
<span class="badge bg-teal" wicket:id="info"></span> | ||
<i class="fa " wicket:id="icon"></i> | ||
<label wicket:id="label" ></label> | ||
</a> | ||
<ul class="dropdown-menu pull-right" role="menu"> | ||
<li wicket:id="menuItem"> | ||
<div wicket:id="menuItemBody"/> | ||
</li> | ||
</ul> | ||
|
||
</wicket:panel> | ||
</html> |
115 changes: 115 additions & 0 deletions
115
...gui/src/main/java/com/evolveum/midpoint/gui/api/component/button/DropdownButtonPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
package com.evolveum.midpoint.gui.api.component.button; | ||
|
||
import java.io.Serializable; | ||
|
||
import org.apache.wicket.AttributeModifier; | ||
import org.apache.wicket.markup.html.WebMarkupContainer; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.list.ListItem; | ||
import org.apache.wicket.markup.html.list.ListView; | ||
import org.apache.wicket.model.Model; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem; | ||
import com.evolveum.midpoint.web.component.menu.cog.MenuLinkPanel; | ||
|
||
public class DropdownButtonPanel extends BasePanel<DropdownButtonDto>{ | ||
|
||
private static final String ID_BUTTON = "button"; | ||
private static final String ID_INFO = "info"; | ||
private static final String ID_ICON = "icon"; | ||
private static final String ID_LABEL = "label"; | ||
private static final String ID_MENU = "menu"; | ||
|
||
private static String ID_MENU_ITEM = "menuItem"; | ||
private static String ID_MENU_ITEM_BODY = "menuItemBody"; | ||
|
||
|
||
public DropdownButtonPanel(String id, DropdownButtonDto model) { | ||
super(id); | ||
initLayout(model); | ||
} | ||
|
||
private void initLayout(DropdownButtonDto model){ | ||
|
||
// AjaxButton button = new AjaxButton(ID_BUTTON) { | ||
// | ||
// @Override | ||
// public void onClick(AjaxRequestTarget target) { | ||
// ApplicationButtonPanel.this.onClick(target); | ||
// } | ||
// }; | ||
// add(button); | ||
|
||
Label info = new Label(ID_INFO, model.getInfo()); | ||
add(info); | ||
// button.add(info); | ||
|
||
Label label = new Label(ID_LABEL, model.getLabel()); | ||
add(label); | ||
// button.add(label); | ||
|
||
WebMarkupContainer icon = new WebMarkupContainer(ID_ICON); | ||
icon.add(AttributeModifier.append("class", model.getIcon())); | ||
add(icon); | ||
// button.add(icon); | ||
|
||
|
||
ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM, new Model((Serializable) model.getMenuItems())) { | ||
|
||
@Override | ||
protected void populateItem(ListItem<InlineMenuItem> item) { | ||
initMenuItem(item); | ||
} | ||
}; | ||
|
||
add(li); | ||
|
||
// InlineMenu assignmentMenu = new InlineMenu(ID_MENU, new Model((Serializable) model.getMenuItems())); | ||
// add(assignmentMenu); | ||
} | ||
|
||
private void initMenuItem(ListItem<InlineMenuItem> menuItem) { | ||
final InlineMenuItem item = menuItem.getModelObject(); | ||
|
||
// menuItem.add(AttributeModifier.append("class", new AbstractReadOnlyModel<String>() { | ||
// | ||
// @Override | ||
// public String getObject() { | ||
// if (item.isMenuHeader()) { | ||
// return "dropdown-header"; | ||
// } else if (item.isDivider()) { | ||
// return "divider"; | ||
// } | ||
// | ||
// return getBoolean(item.getEnabled(), true) ? null : "disabled"; | ||
// } | ||
// })); | ||
|
||
// if (item.getEnabled() != null || item.getVisible() != null) { | ||
// menuItem.add(new VisibleEnableBehaviour() { | ||
// | ||
// @Override | ||
// public boolean isEnabled() { | ||
// return getBoolean(item.getEnabled(), true); | ||
// } | ||
// | ||
// @Override | ||
// public boolean isVisible() { | ||
// return getBoolean(item.getVisible(), true); | ||
// } | ||
// }); | ||
// } | ||
|
||
WebMarkupContainer menuItemBody; | ||
// if (item.isMenuHeader() || item.isDivider()) { | ||
// menuItemBody = new MenuDividerPanel(ID_MENU_ITEM_BODY, menuItem.getModel()); | ||
// } else { | ||
menuItemBody = new MenuLinkPanel(ID_MENU_ITEM_BODY, menuItem.getModel()); | ||
// } | ||
menuItemBody.setRenderBodyOnly(true); | ||
menuItem.add(menuItemBody); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters