use of com.helger.photon.uictrls.famfam.EFamFamFlagIcon in project phoss-smp by phax.
the class PageSecureBusinessCard method showBusinessCardEntity.
@Nonnull
public static IHCNode showBusinessCardEntity(@Nonnull final SMPBusinessCardEntity aEntity, final int nIndex, @Nonnull final Locale aDisplayLocale) {
final BootstrapCard aPanel = new BootstrapCard();
aPanel.createAndAddHeader().addChild("Business Entity " + nIndex);
final BootstrapViewForm aForm2 = aPanel.createAndAddBody().addAndReturnChild(new BootstrapViewForm());
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Name").setCtrl(aEntity.names().getFirst().getName()));
{
final Locale aCountry = CountryCache.getInstance().getCountry(aEntity.getCountryCode());
final HCNodeList aCtrl = new HCNodeList();
final EFamFamFlagIcon eIcon = EFamFamFlagIcon.getFromIDOrNull(aCountry.getCountry());
if (eIcon != null) {
aCtrl.addChild(eIcon.getAsNode());
aCtrl.addChild(" ");
}
aCtrl.addChild(aCountry.getDisplayCountry(aDisplayLocale) + " [" + aEntity.getCountryCode() + "]");
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Country code").setCtrl(aCtrl));
}
if (aEntity.hasGeographicalInformation()) {
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Geographical information").setCtrl(HCExtHelper.nl2divList(aEntity.getGeographicalInformation())));
}
if (aEntity.identifiers().isNotEmpty()) {
final BootstrapTable aTable = new BootstrapTable(HCCol.star(), HCCol.star());
aTable.addHeaderRow().addCells("Scheme", "Value");
for (final SMPBusinessCardIdentifier aIdentifier : aEntity.identifiers()) aTable.addBodyRow().addCells(aIdentifier.getScheme(), aIdentifier.getValue());
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Identifiers").setCtrl(aTable));
}
if (aEntity.websiteURIs().isNotEmpty()) {
final HCNodeList aNL = new HCNodeList();
for (final String sWebsiteURI : aEntity.websiteURIs()) aNL.addChild(new HCDiv().addChild(HCA.createLinkedWebsite(sWebsiteURI)));
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Website URIs").setCtrl(aNL));
}
if (aEntity.contacts().isNotEmpty()) {
final BootstrapTable aTable = new BootstrapTable(HCCol.star(), HCCol.star(), HCCol.star(), HCCol.star());
aTable.addHeaderRow().addCells("Type", "Name", "Phone number", "Email address");
for (final SMPBusinessCardContact aContact : aEntity.contacts()) {
final HCRow aBodyRow = aTable.addBodyRow();
aBodyRow.addCells(aContact.getType(), aContact.getName(), aContact.getPhoneNumber());
aBodyRow.addCell(HCA_MailTo.createLinkedEmail(aContact.getEmail()));
}
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Contacts").setCtrl(aTable));
}
if (aEntity.hasAdditionalInformation()) {
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Additional information").setCtrl(HCExtHelper.nl2divList(aEntity.getAdditionalInformation())));
}
if (aEntity.hasRegistrationDate()) {
aForm2.addFormGroup(new BootstrapFormGroup().setLabel("Registration date").setCtrl(PDTToString.getAsString(aEntity.getRegistrationDate(), aDisplayLocale)));
}
return aPanel;
}
use of com.helger.photon.uictrls.famfam.EFamFamFlagIcon in project phoss-directory by phax.
the class PDCommonUI method getFlagNode.
@Nullable
public static IHCNode getFlagNode(@Nullable final String sCountryCode) {
final EFamFamFlagIcon eFlagIcon = EFamFamFlagIcon.getFromIDOrNull(sCountryCode);
if (eFlagIcon == null)
return null;
PhotonCSS.registerCSSIncludeForThisRequest(EUICtrlsCSSPathProvider.FAMFAM_FLAGS);
return eFlagIcon.getAsNode();
}
use of com.helger.photon.uictrls.famfam.EFamFamFlagIcon in project phoss-smp by phax.
the class PageSecureBusinessCard method showListOfExistingObjects.
@Override
protected void showListOfExistingObjects(@Nonnull final WebPageExecutionContext aWPEC) {
final Locale aDisplayLocale = aWPEC.getDisplayLocale();
final HCNodeList aNodeList = aWPEC.getNodeList();
final ISMPBusinessCardManager aBusinessCardMgr = SMPMetaManager.getBusinessCardMgr();
final ICommonsList<ISMPBusinessCard> aAllBusinessCards = aBusinessCardMgr.getAllSMPBusinessCards();
final BootstrapButtonToolbar aToolbar = new BootstrapButtonToolbar(aWPEC);
aToolbar.addButton("Create new Business Card", createCreateURL(aWPEC), EDefaultIcon.NEW);
aToolbar.addChild(new BootstrapButton().setOnClick(aWPEC.getSelfHref().add(CPageParam.PARAM_ACTION, ACTION_PUBLISH_ALL_TO_INDEXER)).setIcon(EFamFamIcon.ARROW_REDO).addChild("Update all Business Cards in " + SMPWebAppConfiguration.getDirectoryName()).setDisabled(aAllBusinessCards.isEmpty()));
aNodeList.addChild(aToolbar);
final HCTable aTable = new HCTable(new DTCol("Service Group").setDataSort(0, 1).setInitialSorting(ESortOrder.ASCENDING), new DTCol("Name"), new DTCol("Country"), new DTCol("GeoInfo"), new DTCol("Identifiers"), new BootstrapDTColAction(aDisplayLocale)).setID(getID());
for (final ISMPBusinessCard aCurObject : aAllBusinessCards) {
final ISimpleURL aViewLink = createViewURL(aWPEC, aCurObject);
final String sDisplayName = aCurObject.getID();
if (aCurObject.getEntityCount() == 0) {
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
for (int i = 1; i < aTable.getColumnCount() - 1; ++i) aRow.addCell();
aRow.addCell(_createActionCell(aWPEC, aCurObject));
} else {
for (final SMPBusinessCardEntity aEntity : aCurObject.getAllEntities()) {
final HCRow aRow = aTable.addBodyRow();
aRow.addCell(new HCA(aViewLink).addChild(sDisplayName));
aRow.addCell(aEntity.names().getFirst().getName());
final Locale aCountry = CountryCache.getInstance().getCountry(aEntity.getCountryCode());
final IHCCell<?> aCountryCell = aRow.addCell();
final EFamFamFlagIcon eIcon = EFamFamFlagIcon.getFromIDOrNull(aCountry.getCountry());
if (eIcon != null)
aCountryCell.addChild(eIcon.getAsNode()).addChild(" ");
aCountryCell.addChild(aCountry.getDisplayCountry(aDisplayLocale));
aRow.addCell(HCExtHelper.nl2divList(aEntity.getGeographicalInformation()));
{
final HCNodeList aIdentifiers = new HCNodeList();
for (final SMPBusinessCardIdentifier aIdentifier : aEntity.identifiers()) aIdentifiers.addChild(div(aIdentifier.getScheme()).addChild(" - ").addChild(aIdentifier.getValue()));
aRow.addCell(aIdentifiers);
}
aRow.addCell(_createActionCell(aWPEC, aCurObject));
}
}
}
final DataTables aDataTables = BootstrapDataTables.createDefaultDataTables(aWPEC, aTable);
aNodeList.addChild(aTable).addChild(aDataTables);
}
Aggregations