当前位置: 首页>>代码示例>>Java>>正文


Java MessageFormat.format方法代码示例

本文整理汇总了Java中java.text.MessageFormat.format方法的典型用法代码示例。如果您正苦于以下问题:Java MessageFormat.format方法的具体用法?Java MessageFormat.format怎么用?Java MessageFormat.format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.MessageFormat的用法示例。


在下文中一共展示了MessageFormat.format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArrowInfo

import java.text.MessageFormat; //导入方法依赖的package包/类
/**
 * @return String with informations about each arrow in the connectionLayer.
 */
private String getArrowInfo() {
    List<Widget> connectionWidgets = connectionLayer.getChildren();
    StringBuilder sb = new StringBuilder("Number of arrows: " + connectionWidgets.size() + '\n');
    
    int arrowIndex = 0; 
    for (Widget connectionWidget : connectionWidgets) {
        ArrowWidget arrow = (ArrowWidget) connectionWidget;
        
        Widget sourceAnchorWidget = arrow.getSourceAnchor().getRelatedWidget();
        Point sourceAnchorSceneLocation = arrow.getSourceAnchor().getRelatedSceneLocation();
        
        Widget targetAnchorWidget = arrow.getTargetAnchor().getRelatedWidget();
        Point targetAnchorSceneLocation = arrow.getTargetAnchor().getRelatedSceneLocation();
        
        String arrowInfo = MessageFormat.format("Arrow {0,number,##}: {1} -> {2};  {3} -> {4}", 
                arrowIndex, 
                sourceAnchorWidget, targetAnchorWidget, 
                sourceAnchorSceneLocation, targetAnchorSceneLocation);
        sb.append(arrowInfo).append('\n');

        ++arrowIndex;
    }
    return sb.toString();
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:28,代码来源:ShedScene.java

示例2: openInAWT

import java.text.MessageFormat; //导入方法依赖的package包/类
private void openInAWT() {
    if (!formDataObject.isValid()) {
        return;
    }
    if (Boolean.TRUE.equals(formDataObject.getPrimaryFile().getAttribute("nonEditableTemplate"))) { // NOI18N
        String pattern = FormUtils.getBundleString("MSG_NonEditableTemplate"); // NOI18N
        String message = MessageFormat.format(pattern, new Object[] {formDataObject.getNodeDelegate().getName()});
        DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message));
        return;
    }
    elementToOpen = JAVA_ELEMENT_INDEX;
    super.open();
    
    // This method must be executed in AWT thread because
    // otherwise multiview is opened in AWT using invokeLater
    // and we don't have multiviewTC correctly set
    MultiViewHandler handler = MultiViews.findMultiViewHandler(multiviewTC);
    if (handler != null) {
        handler.requestActive(handler.getPerspectives()[JAVA_ELEMENT_INDEX]);
        // will continue in loadOpeningForm
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:FormEditorSupport.java

示例3: getRevWalk

import java.text.MessageFormat; //导入方法依赖的package包/类
@Override
public RevWalk getRevWalk() {
	throw new UnsupportedOperationException(MessageFormat.format(
			JGitText.get().isAStaticFlagAndHasNorevWalkInstance, toString()));
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:6,代码来源:RevFlag.java

示例4: createConnection

import java.text.MessageFormat; //导入方法依赖的package包/类
public CommunicationConnection createConnection(CommunicationParam params) {
    if (params == null) {
        throw new IllegalArgumentException("param is null!");
    }

    // 构造对应的url
    String serviceUrl = MessageFormat.format(DUBBO_SERVICE_URL, params.getIp(), String.valueOf(params.getPort()));
    CommunicationEndpoint endpoint = connections.get(serviceUrl);
    return new DubboCommunicationConnection(params, endpoint);

}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:12,代码来源:DubboCommunicationConnectionFactory.java

示例5: checkStreaming

import java.text.MessageFormat; //导入方法依赖的package包/类
public Exception checkStreaming(final String fileName) {
    try {
        final InputStream is = HexDumpReader.getStreamFromHexDump(fileName + ".txt");
        final ObjectInputStream in = new ObjectInputStream(is);
        final MessageFormat form = (MessageFormat)in.readObject();
        final Object[] testArgs = {12373L, "MyDisk"};
        final String result = form.format(testArgs);
        in.close();
    } catch (Exception e) {
        return e;
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:Bug4185816Test.java

示例6: getMessage

import java.text.MessageFormat; //导入方法依赖的package包/类
String getMessage(String key, Object arg1, Object arg2) {
    String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
    MessageFormat msgfmt = new MessageFormat(basemsgfmt);
    Object msgobj[] = new Object[2];
    if (arg1 == null) {
        arg1 = "null";
    }
    if (arg2 == null) {
        arg2 = "null";
    }
    msgobj[0] = arg1;
    msgobj[1] = arg2;
    return msgfmt.format(msgobj);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AppletMessageHandler.java

示例7: getCalibrationData

import java.text.MessageFormat; //导入方法依赖的package包/类
private synchronized boolean getCalibrationData(boolean getStoredData)
                                         throws ClientUtils.TargetAppOrVMTerminated {
    int cmdType = getStoredData ? Command.GET_STORED_CALIBRATION_DATA : Command.RUN_CALIBRATION_AND_GET_DATA;
    sendSimpleCmdToServer(cmdType);

    Response resp = getLastResponse();

    if (!resp.isOK()) {
        String msg = resp.getErrorMessage();

        if (getStoredData) {
            msg = MessageFormat.format(CORRUPTED_TARGET_CALIBRATION_DATA_MSG, new Object[] { msg });
        }

        appStatusHandler.displayError(msg);

        return false;
    }

    CalibrationDataResponse cdr = (CalibrationDataResponse) resp;
    status.methodEntryExitCallTime = cdr.getMethodEntryExitCallTime();
    status.methodEntryExitInnerTime = cdr.getMethodEntryExitInnerTime();
    status.methodEntryExitOuterTime = cdr.getMethodEntryExitOuterTime();
    status.timerCountsInSecond = cdr.getTimerCountsInSecond();

    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ProfilerClient.java

示例8: storeExceptionInProgressMessageService

import java.text.MessageFormat; //导入方法依赖的package包/类
public void storeExceptionInProgressMessageService(DelegateExecution context, Throwable t) {
    try {
        ProgressMessage msg = new ProgressMessage(getCorrelationId(context), indexedStepName, ProgressMessageType.ERROR,
            MessageFormat.format(Messages.UNEXPECTED_ERROR, t.getMessage()), new Timestamp(System.currentTimeMillis()));
        progressMessageService.add(msg);
    } catch (SLException e) {
        getLogger(context).error(Messages.SAVING_ERROR_MESSAGE_FAILED, e);
    }
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:10,代码来源:ProcessStepHelper.java

示例9: onCreate

import java.text.MessageFormat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stop_arrival_check);
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);


    //Initialize a new Array List to store arrival information for a specific stop ID
    stopInfoResultList = new ArrayList<>();

    //Find listView box in which it is going to display arrival information
    lv = (ListView) findViewById(R.id.stopInfoListView);

    //Get data that is being passed from Main Activity
    Bundle stopData = getIntent().getExtras();
    if (stopData != null)
    {
        stopId = stopData.getString("stopIdInput");

        stopIDEditText = (EditText) findViewById(R.id.stopIdInputBox);
        stopIDEditText.setText(stopId);
        //Define the URL that going to be retrieve data from
        url = MessageFormat.format("https://developer.trimet.org/ws/V2/arrivals?locIDs={0}&appID={1}&json=true",
                stopId, trimetApiKey);

        //Get the result and set content to ListView
        new GetStopInfo().execute(url);
    }
    else
        Toast.makeText(StopArrivalCheckActivity.this,"Enter Stop ID to see Arrival Information !!!", Toast.LENGTH_LONG).show();
}
 
开发者ID:mezau532,项目名称:smart_commuter,代码行数:33,代码来源:StopArrivalCheckActivity.java

示例10: getQueryForObjectMethod

import java.text.MessageFormat; //导入方法依赖的package包/类
public String getQueryForObjectMethod(String sqlMapNamespace, String statementId,
        String parameter) {
    String answer = MessageFormat.format(queryForObjectMethodTemplate,
            new String[] { sqlMapNamespace, statementId, parameter });

    return answer;
}
 
开发者ID:ajtdnyy,项目名称:PackagePlugin,代码行数:8,代码来源:AbstractDAOTemplate.java

示例11: generateLabelString

import java.text.MessageFormat; //导入方法依赖的package包/类
/**
 * Generates a for the specified item.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 *
 * @return The label (possibly <code>null</code>).
 */
protected String generateLabelString(CategoryDataset dataset, int row, int column) {
    if (dataset == null) {
        throw new IllegalArgumentException("Null 'dataset' argument.");
    }
    String result = null;   
    Object[] items = createItemArray(dataset, row, column);
    result = MessageFormat.format(this.labelFormat, items);
    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:AbstractCategoryItemLabelGenerator.java

示例12: buildContextMenu

import java.text.MessageFormat; //导入方法依赖的package包/类
private ContextMenu buildContextMenu() {
    ContextMenu menu = new ContextMenu();
    Menu lookBackMenu = new Menu(Messages.getString("AgendaView.MENU_ITEM_LOOK_BACK")); //$NON-NLS-1$
    Menu lookAheadMenu = new Menu(Messages.getString("AgendaView.MENU_ITEM_LOOK_AHEAD")); //$NON-NLS-1$

    String format = Messages.getString("AgendaView.MENU_ITEM_DAYS"); //$NON-NLS-1$

    MenuItem lookBack0 = new MenuItem(MessageFormat.format(format, 0));
    MenuItem lookBack10 = new MenuItem(MessageFormat.format(format, 10));
    MenuItem lookBack20 = new MenuItem(MessageFormat.format(format, 20));
    MenuItem lookBack30 = new MenuItem(MessageFormat.format(format, 30));
    MenuItem lookAhead0 = new MenuItem(MessageFormat.format(format, 0));
    MenuItem lookAhead10 = new MenuItem(MessageFormat.format(format, 10));
    MenuItem lookAhead20 = new MenuItem(MessageFormat.format(format, 20));
    MenuItem lookAhead30 = new MenuItem(MessageFormat.format(format, 30));
    lookBackMenu.getItems().addAll(lookBack0, lookBack10, lookBack20, lookBack30);
    lookAheadMenu.getItems().addAll(lookAhead0, lookAhead10, lookAhead20, lookAhead30);
    menu.getItems().addAll(lookBackMenu, lookAheadMenu);

    lookBack0.setOnAction(evt -> setLookBackPeriodInDays(0));
    lookBack10.setOnAction(evt -> setLookBackPeriodInDays(10));
    lookBack20.setOnAction(evt -> setLookBackPeriodInDays(20));
    lookBack30.setOnAction(evt -> setLookBackPeriodInDays(30));

    lookAhead0.setOnAction(evt -> setLookAheadPeriodInDays(0));
    lookAhead10.setOnAction(evt -> setLookAheadPeriodInDays(10));
    lookAhead20.setOnAction(evt -> setLookAheadPeriodInDays(20));
    lookAhead30.setOnAction(evt -> setLookAheadPeriodInDays(30));

    return menu;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:32,代码来源:AgendaView.java

示例13: ceateInfoBaiduXmlSiteMap

import java.text.MessageFormat; //导入方法依赖的package包/类
/**
 * 制作小说介绍页的网站地图<br>
 * 
 * @param sitemapUri
 * 
 * @param 文件列表
 */
private List<String> ceateInfoBaiduXmlSiteMap(String sitemapDir, String sitemapUri, boolean isCreateMobileSiteMap) {
    int count = articleService.getCount(new ArticleSearchBean());
    int files = count / COUNT_PER_FILE;
    if (count % COUNT_PER_FILE > 0) {
        files++;
    }

    List<String> urlList = new ArrayList<String>();
    String fileNameFormat = "sitemap_info_{0}.xml";
    if (isCreateMobileSiteMap) {
        fileNameFormat = mobileSitemapPrefix + "sitemap_info_{0}.xml";
    }
    String fileName = "";
    for (int i = 1; i <= files; i++) {
        StringBuffer sb = new StringBuffer();
        sb = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
        sb.append("<urlset>\n");
        ArticleSearchBean searchBean = new ArticleSearchBean();
        Pagination pagination = new Pagination(COUNT_PER_FILE, i);
        searchBean.setPagination(pagination);
        List<TArticle> articleList = articleService.find(searchBean);
        for (TArticle article : articleList) {
            sb.append(createURL(constructURL(article, isCreateMobileSiteMap), article.getLastupdate(),
                    CHANGEFREQ_DAILY, PRIORITY_09));
        }
        sb.append("</urlset>");
        fileName = MessageFormat.format(sitemapDir + fileNameFormat, i);
        FileUtils.writeFile(new File(fileName), sb.toString(), false);
        urlList.add(MessageFormat.format(sitemapUri + fileNameFormat, i));
    }
    return urlList;
}
 
开发者ID:Chihpin,项目名称:Yidu,代码行数:40,代码来源:CreateSiteMapJob.java

示例14: getString

import java.text.MessageFormat; //导入方法依赖的package包/类
public static String getString(String key, Object... args)
{
    return MessageFormat.format(getString(key), args);
}
 
开发者ID:s-store,项目名称:s-store,代码行数:5,代码来源:Resources.java

示例15: getActivity

import java.text.MessageFormat; //导入方法依赖的package包/类
@Override
public String getActivity() {
    return MessageFormat.format(LocaleFactory.localizedString("Writing metadata of {0}", "Status"),
            this.toString(files));
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:6,代码来源:WriteEncryptionWorker.java


注:本文中的java.text.MessageFormat.format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。