Search in sources :

Example 1 with EFamFamFlagIcon

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;
}
Also used : Locale(java.util.Locale) HCDiv(com.helger.html.hc.html.grouping.HCDiv) SMPBusinessCardContact(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardContact) BootstrapCard(com.helger.photon.bootstrap4.card.BootstrapCard) HCNodeList(com.helger.html.hc.impl.HCNodeList) EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) BootstrapTable(com.helger.photon.bootstrap4.table.BootstrapTable) BootstrapViewForm(com.helger.photon.bootstrap4.form.BootstrapViewForm) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) BootstrapFormGroup(com.helger.photon.bootstrap4.form.BootstrapFormGroup) SMPBusinessCardIdentifier(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier) Nonnull(javax.annotation.Nonnull)

Example 2 with EFamFamFlagIcon

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();
}
Also used : EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) Nullable(javax.annotation.Nullable)

Example 3 with EFamFamFlagIcon

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);
}
Also used : Locale(java.util.Locale) HCNodeList(com.helger.html.hc.impl.HCNodeList) HCA(com.helger.html.hc.html.textlevel.HCA) SMPBusinessCardEntity(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardEntity) HCRow(com.helger.html.hc.html.tabular.HCRow) PDTToString(com.helger.commons.datetime.PDTToString) PDTFromString(com.helger.commons.datetime.PDTFromString) SMPBusinessCardIdentifier(com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier) ISMPBusinessCard(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCard) ISMPBusinessCardManager(com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager) HCTable(com.helger.html.hc.html.tabular.HCTable) EFamFamFlagIcon(com.helger.photon.uictrls.famfam.EFamFamFlagIcon) DTCol(com.helger.photon.uictrls.datatables.column.DTCol) ISimpleURL(com.helger.commons.url.ISimpleURL) BootstrapDTColAction(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDTColAction) BootstrapButton(com.helger.photon.bootstrap4.button.BootstrapButton) BootstrapButtonToolbar(com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar) DataTables(com.helger.photon.uictrls.datatables.DataTables) BootstrapDataTables(com.helger.photon.bootstrap4.uictrls.datatables.BootstrapDataTables)

Aggregations

EFamFamFlagIcon (com.helger.photon.uictrls.famfam.EFamFamFlagIcon)3 PDTFromString (com.helger.commons.datetime.PDTFromString)2 PDTToString (com.helger.commons.datetime.PDTToString)2 HCRow (com.helger.html.hc.html.tabular.HCRow)2 HCNodeList (com.helger.html.hc.impl.HCNodeList)2 SMPBusinessCardIdentifier (com.helger.phoss.smp.domain.businesscard.SMPBusinessCardIdentifier)2 Locale (java.util.Locale)2 ISimpleURL (com.helger.commons.url.ISimpleURL)1 HCDiv (com.helger.html.hc.html.grouping.HCDiv)1 HCTable (com.helger.html.hc.html.tabular.HCTable)1 HCA (com.helger.html.hc.html.textlevel.HCA)1 ISMPBusinessCard (com.helger.phoss.smp.domain.businesscard.ISMPBusinessCard)1 ISMPBusinessCardManager (com.helger.phoss.smp.domain.businesscard.ISMPBusinessCardManager)1 SMPBusinessCardContact (com.helger.phoss.smp.domain.businesscard.SMPBusinessCardContact)1 SMPBusinessCardEntity (com.helger.phoss.smp.domain.businesscard.SMPBusinessCardEntity)1 BootstrapButton (com.helger.photon.bootstrap4.button.BootstrapButton)1 BootstrapButtonToolbar (com.helger.photon.bootstrap4.buttongroup.BootstrapButtonToolbar)1 BootstrapCard (com.helger.photon.bootstrap4.card.BootstrapCard)1 BootstrapFormGroup (com.helger.photon.bootstrap4.form.BootstrapFormGroup)1 BootstrapViewForm (com.helger.photon.bootstrap4.form.BootstrapViewForm)1